Skip to content

Commit 01c8c9c

Browse files
authored
Add Rem statement support + tests (#83)
1 parent 199b412 commit 01c8c9c

File tree

3 files changed

+54
-6
lines changed

3 files changed

+54
-6
lines changed

syntaxes/tests/vba/comments.bas

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
' SYNTAX TEST "source.vba" "test comment variations"
2+
3+
' Some comment
4+
' ^^^^^^^^^^^^^^ comment.line.quote
5+
6+
10 ' Some comment with line number
7+
' <-- constant.numeric.decimal
8+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.quote
9+
10+
Label1: ' Some comment with label
11+
' ^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.quote
12+
13+
Dim x as Long 'Some comment at the end of a line
14+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.quote
15+
16+
Dim x As Long: 'Test comment with colon
17+
' ^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.quote
18+
19+
Rem Some comment
20+
' ^^^^^^^^^^^^^^^^ comment.line.rem
21+
22+
10 Rem Some comment with line number
23+
' <-- constant.numeric.decimal
24+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.rem
25+
26+
Label1: Rem Some comment with label
27+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.rem
28+
29+
Dim x as Long Rem Some comment at the end of a line
30+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - comment.line.rem
31+
32+
Dim x As Long: Rem Test comment with colon
33+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.rem
34+
35+
' multi line _
36+
comment
37+
' ^^^^^^^ comment.line.continuation
38+
39+
Rem multi line _
40+
comment
41+
' ^^^^^^^ comment.line.continuation
42+

syntaxes/tests/vba/other.bas

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
Attribute VB_Name = "SyntaxTest"
44
' <--------- keyword.other.vba
55

6-
' Some comment
7-
' ^^^^^^^^^^^^^^ comment.line.quote
8-
96
Public Const FOO As Integer = 1
107
' ^^^^^ keyword.other.vba
118
' ^^ keyword.control.vba

syntaxes/vba.tmGrammar.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,18 @@ patterns:
2222

2323
repository:
2424
comments:
25-
name: comment.line.quote
26-
begin: "'"
27-
end: $
25+
begin: "(?=')|(?:^(?:|(\\d*)\\s*|[a-zA-Z][a-zA-Z0-9]{0,254}:\\s*)|:\\s*)(?=(?i:Rem ))"
26+
beginCaptures:
27+
'1':
28+
name: constant.numeric.decimal
29+
end: "(?<!\\s_)$\n"
30+
patterns:
31+
- name: comment.line.quote
32+
match: "'.*"
33+
- name: comment.line.rem
34+
match: Rem .*
35+
- name: comment.line.continuation
36+
match: "^.*"
2837

2938
keywords:
3039
patterns:

0 commit comments

Comments
 (0)