Skip to content

Commit 7b3bda9

Browse files
committed
feat: update grammar syntax to group blocks and handle module indexes
Preset definitions are now captured in blocks, which contain assignments (tab-indented lines) Similarly, `index.ini` and `"DataModule"` definitions are now marked as keywords and subsequent includes logged. Extended listable PresetDeclaration keywords, and removed `DataModule` from class names.
1 parent 3ca589c commit 7b3bda9

File tree

2 files changed

+41
-162
lines changed

2 files changed

+41
-162
lines changed

packages/syntaxes/src/ccini.tmLanguage.json

Lines changed: 0 additions & 156 deletions
This file was deleted.

packages/syntaxes/src/ccini.tmLanguage.yaml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,52 @@
1-
# yaml-language-server: $schema=../../.vscode/tmLanguage.json
1+
# yaml-language-server: $schema=../../../.vscode/tmLanguage.json
22

33
name: 'INI (Cortex Command)'
44
scopeName: source.ccini
55
patterns:
66
- { include: '#comments' }
7-
- { include: '#assignments' }
7+
- { include: '#moduleDeclarations' }
8+
- { include: '#definitions' }
9+
# - { include: '#assignments' }
810
# - { include: "#presetDefinition" }
911
# - { include: "#numbers" }
1012
# - { include: "#strings" }
1113

1214
repository:
15+
moduleDeclarations:
16+
name: meta.definition.module
17+
begin: ^(DataModule)$
18+
beginCaptures:
19+
'1':
20+
name: keyword
21+
end: ^(?!\t+)
22+
patterns:
23+
- include: '#comments'
24+
- include: '#assignments'
25+
26+
definitions:
27+
name: meta.definition.block
28+
begin: ^((\w+)\s+(=)\s+(?:(.+?)(?:\s*?))(?=(?:\/\*(?!.*\*\/))|\/\/|\n))
29+
end: ^(?!\t+)
30+
beginCaptures:
31+
'0':
32+
name: meta.expression.assignment
33+
'2':
34+
name: support.type.property-name
35+
patterns:
36+
- include: '#presetDeclarations'
37+
'3':
38+
name: keyword.operator.assignment
39+
'4':
40+
patterns:
41+
- { include: '#comments' }
42+
- { include: '#classNames' }
43+
44+
patterns:
45+
- { include: '#comments' }
46+
- { include: '#assignments' }
47+
1348
assignments:
14-
match: (?:\t*)((\w+)\s+(=)\s+(?:(.+?)(?:\s*?))(?=(?:\/\*(?!.*\*\/))|\/\/|\n))
49+
match: (?:\t+)((\w+)\s+(=)\s+(?:(.+?)(?:\s*?))(?=(?:\/\*(?!.*\*\/))|\/\/|\n))
1550
# match: |
1651
# (?:\t*) # leading tabs for the line
1752
# ( # 1: capture whole line not including leading tabs
@@ -71,15 +106,15 @@ repository:
71106

72107
classNames:
73108
name: entity.name.class
74-
match: (Vector|Matrix|InputScheme|InputMapping|GenericSavedData|Entity|DataModule|ContentFile|Color|Box|Atom|Turret|ThrownDevice|TerrainObject|TerrainFrosting|TerrainDebris|TDExplosive|SoundSet|SoundContainer|SLTerrain|SLBackground|SOPlacer|SceneObject|SceneLayer|Area|Scene|Round|PieSlice|PEmitter|MovableObject|MOSRotating|MOSprite|MOSParticle|MOPixel|MetaSave|MetaPlayer|Material|Magazine|Loadout|LimbPath|Leg|Icon|HeldDevice|HDFirearm|GlobalScript|Gib|Emission|Deployment|BunkerAssemblyScheme|BunkerAssembly|Attachable|AtomGroup|Arm|AHuman|AEmitter|ADSensor|ADoor|Actor|Activity|ACRocket|Exit|ACraft|ACrab|ACDropShip|MultiplayerServerLobby|MultiplayerGame|GATutorial|GAScripted|GameActivity)(\s*?\/\*.*?\*\/\s*?)?$
109+
match: (Vector|Matrix|InputScheme|InputMapping|GenericSavedData|Entity|ContentFile|Color|Box|Atom|Turret|ThrownDevice|TerrainObject|TerrainFrosting|TerrainDebris|TDExplosive|SoundSet|SoundContainer|SLTerrain|SLBackground|SOPlacer|SceneObject|SceneLayer|Area|Scene|Round|PieSlice|PEmitter|MovableObject|MOSRotating|MOSprite|MOSParticle|MOPixel|MetaSave|MetaPlayer|Material|Magazine|Loadout|LimbPath|Leg|Icon|HeldDevice|HDFirearm|GlobalScript|Gib|Emission|Deployment|BunkerAssemblyScheme|BunkerAssembly|Attachable|AtomGroup|Arm|AHuman|AEmitter|ADSensor|ADoor|Actor|Activity|ACRocket|Exit|ACraft|ACrab|ACDropShip|MultiplayerServerLobby|MultiplayerGame|GATutorial|GAScripted|GameActivity)(\s*?\/\*.*?\*\/\s*?)?$
75110
captures:
76111
'0':
77112
patterns:
78113
- include: '#comments'
79114

80115
presetDeclarations:
81116
name: keyword
82-
match: (AddEntity|AddEffect)
117+
match: Add(Activity|Actor|Deployment|Device|Effect|Loadout|Material|Scene|SoundContainer|TerrainDebris)
83118

84119
strings:
85120
name: string.unquoted
@@ -90,7 +125,7 @@ repository:
90125
- include: '#modulePath'
91126

92127
modulePath:
93-
match: (([A-Z][A-z0-9]*\.rte)(\/[A-z0-9]*)*(\/[A-z0-9]+\.(wav|flac|png|bmp)))(\s*?\/\*.*?\*\/\s*?)?$
128+
match: (([A-Z][A-z0-9 ]*\.rte)(\/[A-z0-9 ]*)*(\/[A-z0-9 ]+\.(wav|flac|png|bmp|ini)))(\s*?\/\*.*?\*\/\s*?)?$
94129
captures:
95130
'1':
96131
name: markup.underline.link

0 commit comments

Comments
 (0)