Skip to content

Commit 9907be9

Browse files
authored
Highlight begin of metadata section (#94)
* Add metadata section * Add line at the end of file
1 parent 0f55459 commit 9907be9

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

syntaxes/tests/vba/metadata.bas

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
' SYNTAX TEST "source.vba" "metadata"
2+
3+
VERSION 1.0 CLASS
4+
BEGIN
5+
' <----- keyword.metadata.vba
6+
MultiUse = -1 'True
7+
'^^ constant.numeric.decimal
8+
'^^^^^ comment.line.quote
9+
END
10+
' <--- keyword.metadata.vba
11+
12+
End
13+
'^^^ keyword.control.vba
14+
15+
Sub test()
16+
17+
MsgBox "test"
18+
End
19+
'^^^ keyword.control.vba
20+
21+
End Sub

syntaxes/vba.tmGrammar.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fileTypes:
1313
patterns:
1414
- include: "#comments"
1515
- include: "#keywords"
16+
- include: "#metadata"
1617
- include: "#numbers"
1718
- include: "#storage"
1819
- include: "#strings"
@@ -57,6 +58,19 @@ repository:
5758
name: entity.name.function.vba
5859
match: (?i:\b(?:(?<=Call )|(?<=Function )|(?<=Sub ))[a-zA-Z][a-zA-Z0-9_]*\b)(?=\(\)?)
5960

61+
metadata:
62+
name: metadata.vba
63+
begin: "(?i)^\\s*(BEGIN)\\b"
64+
beginCaptures:
65+
'1':
66+
name: "keyword.metadata.vba"
67+
end: "(?i)^\\s*(END)\\b"
68+
endCaptures:
69+
'0':
70+
name: "keyword.metadata.vba"
71+
patterns:
72+
- include: "source.vba"
73+
6074
numbers:
6175
patterns:
6276
- name: constant.numeric.date

0 commit comments

Comments
 (0)