Skip to content

Commit afa3a66

Browse files
authored
Merge pull request #30 from DecimalTurn/rem
Improve Rem support + tests for comments
2 parents 10bb03a + 395f213 commit afa3a66

File tree

2 files changed

+66
-3
lines changed

2 files changed

+66
-3
lines changed

client/src/syntaxes/vba.tmLanguage.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,15 +415,15 @@ repository:
415415

416416
comments:
417417
patterns:
418-
- include: "#remarkComments"
419418
- include: "#blockComments"
420419
- include: "#apostropheComments"
420+
- include: "#remarkComments"
421421
repository:
422422
blockComments:
423423
# The sub-pattern consumes the \n if preceded by line continuation.
424424
# Capturing it there prevents the end pattern being matched.
425425
name: comment.block.vba
426-
begin: (?i)\s*'.*\s_\s*
426+
begin: (?i)(\s*'|(?<=^\d*?|:)\s*Rem\b).*\s_\s*
427427
end: \n
428428
patterns:
429429
- include: "#lineContinuation"
@@ -432,7 +432,7 @@ repository:
432432
match: (?i)\s*'.*
433433
remarkComments:
434434
name: comment.line.remark.vba
435-
match: (?i)(?<=^|:)\s*Rem\b.*
435+
match: (?i)(?<=^\d*?|:)\s*Rem\b.*
436436

437437
attribute:
438438
name: meta.attribute.vba
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
' SYNTAX TEST "source.vba" "comments"
2+
3+
' This is a comment with without indentation
4+
' <-------------------------------------------- comment.line.apostrophe.vba
5+
6+
' This is a comment with indentation
7+
' ^^^^^^^^^^^^^^^^^^^ comment.line.apostrophe.vba
8+
9+
10 ' Comment with line number
10+
' <-- constant.numeric.vba
11+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.apostrophe.vba
12+
13+
Label1: ' Comment with label
14+
' ^^^^^^^^^^^^^^^^^^^^ comment.line.apostrophe.vba
15+
16+
Dim x as Long 'Comment at the end of a line
17+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.apostrophe.vba
18+
19+
Dim x As Long: 'Comment with colon
20+
' ^^^^^^^^^^^^^^^^^^^ comment.line.apostrophe.vba
21+
22+
' This is the start of a comment block _
23+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.vba
24+
25+
' This is a comment _
26+
continued on the next line
27+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.vba
28+
29+
' This is a comment _
30+
continued on the next line _
31+
and another line
32+
' ^^^^^^^^^^^^^^^^ comment.block.vba
33+
34+
Rem This is a remark without indentation
35+
' <-------------------------------------- comment.line.remark.vba
36+
37+
Rem This is a remark with indentation
38+
' ^^^^^^^^^^^^^^^^^^^^ comment.line.remark.vba
39+
40+
10 Rem Comment with line number
41+
' <-- constant.numeric.vba
42+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.remark.vba
43+
44+
Label1: Rem Comment with label
45+
' ^^^^^^^^^^^^^^^^^^^^^^ comment.line.remark.vba
46+
47+
Dim x as Long Rem Comment at the end of a line
48+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - comment.line.remark.vba
49+
50+
Dim x As Long: Rem Comment with colon
51+
' ^^^^^^^^^^^^^^^^^^^^^^ comment.line.remark.vba
52+
53+
Rem This is the start of a comment block _
54+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.vba
55+
56+
Rem This is a comment _
57+
continued on the next line
58+
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.vba
59+
60+
Rem This is a comment _
61+
continued on the next line _
62+
and another line
63+
' ^^^^^^^^^^^^^^^^ comment.block.vba

0 commit comments

Comments
 (0)