Skip to content

Commit 4a8894d

Browse files
committed
Merge branch 'dev' into NewParser to update textMate grammar
2 parents 4a9fc91 + 803306d commit 4a8894d

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

client/src/syntaxes/vba.tmLanguage.yaml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ repository:
6969
- include: "#operators"
7070
- include: "#keywords"
7171
- include: "#functionCall"
72-
- include: "#subCall"
7372
- include: "#objectModel"
73+
- include: "#subCall"
7474

7575

7676
literals:
@@ -83,7 +83,7 @@ repository:
8383
repository:
8484
string:
8585
name: string.quoted.double.vba
86-
match: '"[^\r\n]*"'
86+
match: '"("")*([^"\n]*)((?:"")[^"\n]+)?"("")*'
8787
boolean:
8888
name: constant.language.boolean.vba
8989
match: "(?i)(true|false)"
@@ -152,7 +152,7 @@ repository:
152152
repository:
153153
flowDecision:
154154
name: keyword.control.flow.decision.vba
155-
match: (?i)(^|\s+)(#if|then|#elseif|[#]?else|#end if|select case|case|switch|end select)\b
155+
match: (?i)(^|\s+)(#if|then|#elseif|[#]?else|[#]?end if|select case|case|switch|end select)\b
156156

157157
flowLoop:
158158
name: keyword.control.flow.loop.vba
@@ -353,10 +353,10 @@ repository:
353353
repository:
354354
primativeType:
355355
name: support.type.primitive.vba
356-
match: (?i)(?<=\bAs)\s+(boolean|byte|currency|date|decimal|double|integer|long(long|ptr)?|single|string|variant)\b
356+
match: (?i)(?<=\bAs)(?:\s+|\s+_\s*\n)+(boolean|byte|currency|date|decimal|double|integer|long(long|ptr)?|single|string|variant)\b
357357
objectType:
358358
name: support.type.object.vba
359-
match: (?i)(?<=\bAs)(\s+New)?\s+([A-Z][A-Z0-9_]*)\b
359+
match: (?i)(?<=\bAs)((?:\s+(?:\s*_\s*\n)*)New)?(?:\s+(?:\s*_\s*\n)*)([A-Z][A-Z0-9_]*)\b
360360
captures:
361361
1:
362362
name: keyword.storage.new.vba
@@ -376,7 +376,11 @@ repository:
376376
- include: "#argsLiteral"
377377
repository:
378378
argsVariable:
379-
match: (?i),?\s*((?:Optional\s+)?(?:ByVal|ByRef)\s+)?([a-z][a-z0-9_]*)(?:\s+(as\s+[a-z][a-z0-9_]*))?(\s*=\s*[^,)]+)?
379+
name: meta.arguments.argsVariable.vba
380+
match: (?i),?\s*((?:Optional\s+)?(?:(?:ByVal|ByRef)\s+)?)?([a-z][a-z0-9_]*)(?:\s+(as\s+[a-z][a-z0-9_]*))?(\s*=\s*[^,)]+)?
381+
# Attempted replacing \s with (?:\s+|\s*_\s*\n) to consume a space or a line ending but it refuses to play the game.
382+
# match: ~~ doesn't work (?i),?(?:\s+|\s*_\s*\n)*((?:Optional(?:\s+|\s*_\s*\n)+)?(?:(?:ByVal|ByRef)(?:\s+|\s*_\s*\n)+)?)?([a-z][a-z0-9_]*)(?:(?:\s+|\s*_\s*\n)+(as(?:\s+|\s*_\s*\n)+[a-z][a-z0-9_]*))?((?:\s+|\s*_\s*\n)*=(?:\s+|\s*_\s*\n)*[^,\n)]+)?
383+
# match: ~~ all broken (?i),?(?:\s*_\s*\n)*((?:Optional(?:\s+(?:\s*_\s*\n)*))?(?:(?:ByVal|ByRef)(?:\s+(?:\s*_\s*\n)*))?)?([a-z][a-z0-9_]*)(?:(?:\s+(?:\s*_\s*\n)*)(as\(?:\s+(?:\s*_\s*\n)*)[a-z][a-z0-9_]*))?((?:\s*_\s*\n)*=(?:\s*_\s*\n)*[^,)]+)?
380384
captures:
381385
1: # Optional? ByVal|ByRef?
382386
name: storage.type.modifier.vba
@@ -398,6 +402,7 @@ repository:
398402
- include: "#literals"
399403

400404
paramArray:
405+
name: meta.args.paramarray.vba
401406
match: (?i),?\s*(ParamArray)\s+([a-z][a-z0-9_]*)(?:\(\))(\s+As\s+Variant)?
402407
captures:
403408
1:
@@ -430,10 +435,12 @@ repository:
430435
match: (?i)(?<=^|:)\s*Rem\b.*
431436

432437
attribute:
433-
name: entity.other.attribute-name.vba
434-
match: (?i)^Attribute(.*)
438+
name: meta.attribute.vba
439+
match: (?i)^\s*(Attribute VB_\w+)\s+(.*)$
435440
captures:
436-
0:
441+
1:
442+
name: entity.other.attribute-name.vba
443+
2:
437444
patterns:
438445
- include: "#language"
439446

@@ -590,7 +597,7 @@ repository:
590597
methodSignature:
591598
name: source.method.signature.vba
592599
begin: (?i)^\s*((?:Public|Private)?\b\s*(?:(?:Sub|Function)|Property\s+(?:Let|Get|Set)))\s+([a-z][a-z0-9_]*)\s*(\()
593-
end: (?i)(\))\s+(as\s+[a-z][a-z0-9_]*)?
600+
end: (?i)\s*(\))\s+(as\s+[a-z][a-z0-9_]*)?
594601
beginCaptures:
595602
1:
596603
name: storage.type.method.vba
@@ -612,17 +619,18 @@ repository:
612619
match: (?i)^\s*End\s+(Sub|Function|Property)
613620

614621
expression:
615-
# (?:[*&/\+-]|\bMod\b)|
622+
# (?:[*&\/\+-]|\bMod\b)|
616623
# (?:[<>=]|\b(is|like)\b)|
617624
# (?:[&+])|
618625
# (?:\b(and|eqv|imp|not|or|xor)\b)|
619626
# (?:\b(addressof|typeof)\b)
620627

621628
# This match just made up of the operators matchs. Don't look at it too hard.
622-
match: (?i)(.*?)\s+((?:[*&/\+-]|\bMod\b)|(?:[<>=]|\b(is|like)\b)|(?:[&+])|(?:\b(and|eqv|imp|not|or|xor)\b)|(?:\b(addressof|typeof)\b))\s+(.*)
629+
match: (?i)(.*?)\s+((?:[*&\/\+-]|\bMod\b)|(?:[<>=]|\b(is|like)\b)|(?:[&+])|(?:\b(and|eqv|imp|not|or|xor)\b)|(?:\b(addressof|typeof)\b))\s+(.*)
623630
captures:
624631
1: # Left sided of expression
625632
patterns:
633+
- include: "#functionCall"
626634
- include: "#literal"
627635
2: # Operator
628636
patterns:
@@ -730,7 +738,8 @@ repository:
730738
- include: "#lineContinuation"
731739

732740
subCall:
733-
begin: (?i)([a-z][a-z0-9._]*)\s+(.*,.*)
741+
name: meta.sub-call.vba
742+
begin: (?i)([a-z][a-z0-9._]*)\s+(.*)
734743
beginCaptures:
735744
1:
736745
name: entity.name.function.call.vba

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"icon": "images/vba-lsp-icon.png",
77
"author": "SSlinky",
88
"license": "MIT",
9-
"version": "1.3.5",
9+
"version": "1.3.6",
1010
"repository": {
1111
"type": "git",
1212
"url": "https://github.com/SSlinky/VBA-LanguageServer"

0 commit comments

Comments
 (0)