Skip to content

Commit 27857a0

Browse files
committed
syntax: module level public/private vars
fix #51
1 parent a3ad779 commit 27857a0

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

syntaxes/tests/other.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Attribute VB_Name = "SyntaxTest"
77
' ^^^^^^^^^^^^^^ comment.line.quote
88

99
Public Const FOO As Integer = 1
10-
' <------ keyword.other.vba
10+
' ^^^^^ keyword.other.vba
1111
' ^^ keyword.control.vba
1212

1313
Dim obj As Variant

syntaxes/tests/procedure.bas

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
' SYNTAX TEST "source.vba" "Sub, Function and anything related"
22

3-
Private Sub doStuff(ByRef x As String)
4-
' ^^^^^^^^^^^ keyword.other.vba
5-
' ^^^^^^^ entity.name.function.vba
6-
' ^^^^^ keyword.control.vba
3+
Private Sub doStuff(ByRef x As String)
4+
' <------- keyword.other.visibility.vba
5+
' ^^^ keyword.other.vba
6+
' ^^^^^^^ entity.name.function.vba
7+
' ^^^^^ keyword.control.vba
78

89
End Sub
910
' <------- keyword.other.vba
1011

11-
Public Function foo() As Boolean
12-
' ^^^^^^^^^^^^^^^ keyword.other.vba
13-
' ^^^ entity.name.function.vba
14-
' ^^ keyword.control.vba
12+
Public Function foo() As Boolean
13+
' <------ keyword.other.visibility.vba
14+
' ^^^^^^^^ keyword.other.vba
15+
' ^^^ entity.name.function.vba
16+
' ^^ keyword.control.vba
1517

1618
Function foo() As MyType
1719
' ^^^^^^^^ keyword.other.vba
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
' SYNTAX TEST "source.vba" "module level variable declaration"
2+
3+
Public strName As String
4+
' <------ keyword.other.visibility.vba
5+
6+
Private strMsg As String
7+
' <------- keyword.other.visibility.vba

syntaxes/vba.tmGrammar.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ repository:
3333
- name: keyword.control.vba
3434
match: (?i:\b((?<= )E(nd|xit)|As|And|By(Ref|Val)|Goto|Is|Like|Mod|Not|On Error|Optional|Or|Resume Next|Stop|Xor)\b)
3535
- name: keyword.other.vba
36-
match: (?i:\b(Attribute|Call|End (Function|Property|Sub)|((Private|Public|Static) )?(Const|Function|Property|Sub))\b)
36+
match: (?i:\b(Attribute|Call|End (Function|Property|Sub)|(Static )?(Const|Function|Property|Sub))\b)
37+
- name: keyword.other.visibility.vba
38+
match: (?i:\b(Private|Public)\b)
3739
- name: constant.language.vba
3840
match: (?i)\b(Empty|False|Nothing|Null|True)\b
3941

0 commit comments

Comments
 (0)