Skip to content

Commit aaf93e1

Browse files
authored
Limit highlighting of strings to a single line (#107)
* cleanup yaml
1 parent ae89fb3 commit aaf93e1

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
## 0.9.6
33
_unreleased_
44

5+
- Limit string highlighting to a single line
56
- Associate `.doccls` file extension
67
- Engineering: Switch from npm to pnpm
78

syntaxes/vba.yaml-tmlanguage

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,44 +11,49 @@ fileTypes:
1111
- .vba
1212

1313
patterns:
14-
- include: "#comments"
15-
- include: "#keywords"
16-
- include: "#metadata"
17-
- include: "#numbers"
18-
- include: "#storage"
19-
- include: "#strings"
20-
- include: "#types"
21-
- include: "#functions"
14+
- include: '#comments'
15+
- include: '#functions'
16+
- include: '#keywords'
17+
- include: '#metadata'
18+
- include: '#numbers'
19+
- include: '#storage'
20+
- include: '#strings'
21+
- include: '#types'
2222
- name: constant.other.vba
2323
match: _(?=\s*\n)
24+
comment: Break and Combine Statements in Code
2425

2526
repository:
2627
comments:
27-
begin: "(?=')|(?:^(?:|(\\d*)\\s*|[a-zA-Z][a-zA-Z0-9]{0,254}:\\s*)|:\\s*)(?=(?i:Rem ))"
28+
begin: (?=')|(?:^(?:(\d*)\s*|[a-zA-Z][a-zA-Z0-9]{0,254}:\s*)|:\s*)(?=(?i:Rem ))
2829
beginCaptures:
2930
'1':
3031
name: constant.numeric.decimal
31-
end: "(?<!\\s_)$\n"
32+
end: (?<!\s_)$\n
3233
patterns:
3334
- name: comment.line.quote
34-
match: "'.*"
35+
match: \'.*
3536
- name: comment.line.rem
3637
match: Rem .*
3738
- name: comment.line.continuation
38-
match: "^.*"
39+
match: ^.*
40+
41+
functions:
42+
name: entity.name.function.vba
43+
match: (?i:\b(?:(?<=(Call|Function|Sub) ))([a-zA-Z][a-zA-Z0-9_]*)\b)(?=\(\)?)
3944

4045
keywords:
4146
patterns:
4247
- name: keyword.conditional.vba
43-
match: (?i:\b(Do(( While)|( Until))?|While|Case( Else)?|Else(If)?|For( Each)?|(I)?If|In|New|(Select )?Case|Then|To|Step|With)\b)
48+
match: (?i:\b(Do( While| Until)?|While|Case( Else)?|Else(If)?|For( Each)?|(I)?If|In|New|(Select )?Case|Then|To|Step|With)\b)
4449
- name: keyword.conditional.end.vba
45-
match: (?i:\b(End( )?If|End (Select|With)|Next|Wend|Loop(( While)|( Until))?|Exit (For|Do|While))\b)
50+
match: (?i:\b(End( )?If|End (Select|With)|Next|Wend|Loop( While| Until)?|Exit (For|Do|While))\b)
4651
- name: keyword.control.vba
47-
match: (?i:(\b(Exit (Function|Property|Sub)|As|And|By(Ref|Val)|Goto|Is|Like|Mod|Not|On Error|Optional|Or|Resume Next|Stop|Xor|Eqv|Imp|TypeOf|AddressOf)\b)|(\b(End)\b(?=\n)))
52+
match: (?i:\b(Exit (Function|Property|Sub)|As|And|By(Ref|Val)|Goto|Is|Like|Mod|Not|On Error|Optional|Or|Resume Next|Stop|Xor|Eqv|Imp|TypeOf|AddressOf)\b|(\b(End)\b(?=\n)))
4853
- name: keyword.io.vba
4954
match: (?i:\b(Open|Close|Line Input|Lock|Unlock|Print|Seek|Get|Put|Write)\b)
5055
- name: keyword.io.vba
51-
match: "(?i:\\b(Input)(?= #))"
56+
match: (?i:\b(Input)(?= \#))
5257
- name: keyword.other.vba
5358
match: (?i:\b(Attribute|Call|End (Function|Property|Sub|Type|Enum)|(Const|Function|Property|Sub|Type|Enum)|Declare|PtrSafe|WithEvents|Event|RaiseEvent|Implements)\b)
5459
- name: keyword.other.option.vba
@@ -58,27 +63,23 @@ repository:
5863
- name: constant.language.vba
5964
match: (?i)\b(Empty|False|Nothing|Null|True)\b
6065

61-
functions:
62-
name: entity.name.function.vba
63-
match: (?i:\b(?:(?<=Call )|(?<=Function )|(?<=Sub ))[a-zA-Z][a-zA-Z0-9_]*\b)(?=\(\)?)
64-
6566
metadata:
6667
name: metadata.vba
67-
begin: "(?i)^\\s*(BEGIN)\\b"
68+
begin: (?i)^\s*(BEGIN)\b
6869
beginCaptures:
6970
'1':
70-
name: "keyword.metadata.vba"
71-
end: "(?i)^\\s*(END)\\b"
71+
name: keyword.metadata.vba
72+
end: (?i)^\s*(END)\b
7273
endCaptures:
7374
'0':
74-
name: "keyword.metadata.vba"
75+
name: keyword.metadata.vba
7576
patterns:
76-
- include: "source.vba"
77+
- include: 'source.vba'
7778

7879
numbers:
7980
patterns:
8081
- name: constant.numeric.date
81-
match: '(?i)#((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)|[0-9]{1,2})(-|\/)[0-9]{1,2}((-|\/)[0-9]{1,4})?#'
82+
match: (?i)\#((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)|[0-9]{1,2})(-|\/)[0-9]{1,2}((-|\/)[0-9]{1,4})?\#
8283
- name: constant.numeric.decimal
8384
match: (?<!\w)-?\d+(\.\d+)?
8485
- name: constant.numeric.octal
@@ -92,9 +93,9 @@ repository:
9293
match: (?i)\b(Class|Const|Dim|(G|L|S)et|ReDim( Preserve)?|Erase|Static)\b
9394

9495
strings:
95-
name: string.quoted.double
96-
begin: '"'
97-
end: '"'
96+
patterns:
97+
- name: string.quoted.double
98+
match: \"[^\n\r\"]*"
9899

99100
types:
100101
patterns:

0 commit comments

Comments
 (0)