Skip to content

Commit 42495b1

Browse files
committed
Type declaration now supports comments and #If blocks
1 parent 32368aa commit 42495b1

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

client/src/syntaxes/vba.tmLanguage.yaml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -497,34 +497,42 @@ repository:
497497

498498
struct:
499499
name: meta.struct.declaration.vba
500-
begin: "(?i)^\\s*((?:(?:Public|Private) )?\\s*Type)\\s+([a-z][a-z0-9_]*)"
500+
begin: (?i)^\s*((?:(?:Public|Private)\s+)?Type)\s+([a-z][a-z0-9_]*)?(\s+(?:'|Rem).*)?
501501
beginCaptures:
502-
1:
502+
1: # Type declaration
503503
name: storage.type.struct.vba
504-
2:
504+
2: # Type name
505505
name: entity.name.type.struct.vba
506+
3: # Comments?
507+
patterns:
508+
- include: "#comments"
506509
patterns:
510+
- include: "#comment"
507511
- include: "#structProperty"
512+
- include: "#language"
508513

509-
end: "(?i)^\\s*End\\s+Type\\b"
514+
end: (?i)^\s*(End\s+Type)(\s+'.*)?
510515
endCaptures:
511-
0:
516+
1:
512517
name: storage.type.struct.vba
518+
2:
519+
patterns:
520+
- include: "#comments"
513521

514522
structProperty:
515-
match: "(?i)^\\s*([a-z][a-z0-9_]*)(\\(.*\\))?(\\s+As\\s+[a-z][a-z0-9_]*)?"
523+
match: (?i)^\s*([a-z][a-z0-9_]*)(\(.*\))?(\s+As\s+[a-z][a-z0-9_]*)?(\s+(?:'|Rem).*)?
516524
captures:
517-
1:
518-
# Property
525+
1: # Property
519526
name: variable.other.readwrite.vba
520-
2:
521-
# Array bounds?
527+
2: # Array bounds?
522528
patterns:
523529
- include: "#language"
524-
3:
525-
# As Type
530+
3: # As Type?
526531
patterns:
527532
- include: "#types"
533+
4: # Comments?
534+
patterns:
535+
- include: "#comments"
528536

529537
declareFunctionSignature:
530538
name: source.declare.signature.vba

0 commit comments

Comments
 (0)