Skip to content

Commit cd11c1b

Browse files
committed
✨ improvements for AC 23
- no longer valid for gsm files, only gdl - featuring the new dictionaries - small 🐛 fixes
1 parent 14391f5 commit cd11c1b

File tree

1 file changed

+47
-24
lines changed

1 file changed

+47
-24
lines changed

GDL.sublime-syntax

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
---
33
# See the DOCS: http://www.sublimetext.com/docs/3/syntax.html
44
# See the REPO: https://github.com/runxel/GDL-sublime
5+
author: Lucas Becker mail@wilu.be
56
name: GDL
6-
file_extensions: [gsm, gdl]
7+
file_extensions: gdl
78
scope: source.gdl
89

910
variables:
@@ -13,7 +14,8 @@ variables:
1314
function_names: |-
1415
(NOT|ABS|CEIL|INT|FRA|ROUND_INT|SGN|ACS|ASN|ATN|COS|SIN|TAN|EXP|LGT|LOG|SQR|MAX|MIN|RND
1516
|STR\{2\}|STR|SPLIT|STW|STRLEN|STRSTR|STRSUB|STRTOUPPER|STRTOLOWER|VARDIM[12]|BITTEST|BITSET
16-
|REQ((UEST)(\{[2-4]\})?)?|IND|NTR|VARTYPE)
17+
|REQ((UEST)(\{[2-4]\})?)?|IND|NTR|VARTYPE|(HAS|REMOVE)KEY)
18+
addon_function_names: ((INIT|CLOSE)ADDONSCOPE|(CALL|PREPARE)FUNCTION)
1719
identifier_continue: '[[:alnum:]_]'
1820
identifier: '\b[[:alpha:]_]{{identifier_continue}}*\b'
1921

@@ -28,11 +30,11 @@ contexts:
2830
- include: attributes
2931
- include: buffer
3032
- include: buffer-in
31-
- include: functions
32-
- include: functions-special
33+
- include: func
3334
- include: gdl-globals
3435
- include: optional
3536
- include: expression-common # needs to be last bc of brackets
37+
- include: dotted-names
3638
- include: generic-names
3739

3840
# Included in all contexts by default:
@@ -226,6 +228,16 @@ contexts:
226228
- match: \}
227229
scope: invalid.illegal.stray.brace.curly.gdl
228230

231+
dotted-names:
232+
- match: '(\.)(?={{identifier}})'
233+
captures:
234+
1: punctuation.accessor.dot.gdl
235+
push:
236+
- include: arrays
237+
- include: generic-names
238+
- match: ''
239+
pop: true
240+
229241
generic-names:
230242
- match: '{{identifier}}'
231243
scope: meta.generic-name.gdl
@@ -273,7 +285,7 @@ contexts:
273285
- match: (?i)(?<=^|\s)(PRISM_?|[BFH]PRISM_|[CS]PRISM_(\{[234]\})?)(?=$|\s)
274286
scope: keyword.shape.3D.prisms.gdl
275287

276-
- match: (?i)(?<=^|\s)(PYRAMID|RULED(\{2\}|SEGMENTED)?|EXTRUDE|SWEEP|TUBE([A]|\{2\})?|MASS(\{2\})?|COONS|REVOLVE(\{[2-5]\})?|(EXTRUDED|REVOLVED|RULED)SHELL(\{[23]\})?|REVOLVEDSHELLANGULAR(\{[23]\})?)(?=$|\s)
288+
- match: (?i)(?<=^|\s)(PYRAMID|RULED(\{2\}|SEGMENTED)?|EXTRUDE|SWEEP|TUBE([A]|\{2\})?|MASS(\{2\})?|COONS(\{2\})?|REVOLVE(\{[2-5]\})?|(EXTRUDED|REVOLVED|RULED)SHELL(\{[23]\})?|REVOLVEDSHELLANGULAR(\{[23]\})?)(?=$|\s)
277289
scope: keyword.shape.3D.poly.gdl
278290

279291
- match: (?i)(?<=^|\s)(CUT(PLANE(\{[2-4]\})?|POLY[A]?|FORM(\{2\})?|SHAPE|END)|WALL(HOLE|NICHE))(?=$|\s)
@@ -370,7 +382,7 @@ contexts:
370382
- match: (?i)\b(PRINT|OUTPUT|CLOSE|CALL|FILE_DEPENDENCE)\b
371383
scope: keyword.extern.gdl
372384

373-
- match: (?i)\b((INIT|CLOSE)ADDONSCOPE|(CALL|PREPARE)FUNCTION)\b
385+
- match: (?i)\b({{addon_function_names}})\b
374386
scope: keyword.addon.gdl
375387

376388
- match: (?i)((OPEN|INPUT)\s?(?=\())
@@ -385,8 +397,7 @@ contexts:
385397
pop: true
386398
- match: ','
387399
scope: punctuation.separator.arguments.gdl
388-
- include: functions
389-
- include: functions-special
400+
- include: func
390401
- include: operators
391402
- include: expression-common
392403
- include: string
@@ -416,7 +427,7 @@ contexts:
416427
- match: (?i)\b(GLOB_([HC]STORY_(ELEV|HEIGHT)|CH_STORY_DIST))\b
417428
scope: keyword.globals.story.gdl
418429

419-
- match: (?i)\b(GLOB_(LAYER|ID|INTGUID|ELEVATION|ELEM_TYPE))\b
430+
- match: (?i)\b(GLOB_(LAYER|ID|INT(GU)?ID|ELEVATION|ELEM_TYPE))\b
420431
scope: keyword.globals.elementparameters.gdl
421432

422433
- match: (?i)\b(SYMB_((LINETYPE|FILL(_PEN)?)|(FBGD|SECT|VIEW)+_PEN|MAT|POS_[XYZ]|ROTANGLE|MIRRORED|[ABZ]+_SIZE))\b
@@ -429,8 +440,8 @@ contexts:
429440
scope: keyword.globals.window.gdl
430441
431442
- match: |-
432-
(?ix)\b(LABEL_(POSITION|CUSTOM_ARROW|ARROW((HEAD)?_PEN|LINETYPE)|FONT_(NAME|STYLE(2)?)|TEXT_(SIZE|(BG_)?PEN|ALIGN|LEADING|WIDTH_FACT|WRAP|CHARSPACE_FACT)
433-
|CHARSPACE_FACT|FRAME_(ON|OFFSET)|ANCHOR_POS|ROTANGLE|ALWAYS_READABLE|ASSOC_ELEM_ORIENTATION))
443+
(?ix)\b(LABEL_(POSITION|CUSTOM_ARROW|ARROW((HEAD)?_PEN|_LINETYPE)|FONT_(NAME|STYLE(2)?)|TEXT_(SIZE|(BG_)?PEN|ALIGN|LEADING|WIDTH_FACT|WRAP|CHARSPACE_FACT)
444+
|WRAP_TEXT|CHARSPACE_FACT|FRAME_(ON|OFFSET)|ANCHOR_POS|ROTANGLE|ALWAYS_READABLE|ASSOC_ELEM_ORIENTATION))
434445
\b
435446
scope: keyword.globals.label.gdl
436447
@@ -519,6 +530,9 @@ contexts:
519530
\b
520531
scope: keyword.globals.shell.gdl
521532
533+
- match: (?i)\b(OPENING_(SYMBOL_(DISPLAY|BOUNDINGBOX)|POLYGON|HEIGHT|WIDTH|(HEADER|CENTER|SILL)HEIGHT_VALUES))\b
534+
scope: keyword.globals.opening.gdl
535+
522536
- match: (?i)\b(MORPH_(LINETYPE|FILL(_PEN)?|BMAT(_NAME)?|FBGD_PEN|SECT_LINETYPE|(SECT|VIEW)_PEN|SOLID|MAT_DEFAULT|(CASTS|RECEIVES)_SHADOW|SURFACE|VOLUME|FLOOR_PERIMETER))\b
523537
scope: keyword.globals.morph.gdl
524538

@@ -542,11 +556,14 @@ contexts:
542556

543557
request-param:
544558
- match: |-
545-
(?ix)\b((BLUE|RED|GREEN)_OF_(PEN|MATERIAL)|GDL_VERSION|MODEL_SIZE|PEN_OF_RGB|PROGRAM|SERIAL_NUMBER|ANCESTRY_INFO|(ANGULAR_(LENGTH_)?|AREA_|RADIAL_|SILL_HEIGHT_)DIMENSION
546-
|(ASSOCEL|MATCHING)_PROPERTIES|ASSOCLP_(NAME|PARVALUE)|CALC_(ANGLE|AREA|LENGTH|VOLUME)_UNIT|CLEAN_INTERSECTIONS|CONSTR_FILLS_DISPLAY|CUSTOM_AUTO_LABEL|DATETIME|DOOR_SHOW_DIM
547-
|(ELEVATION|LEVEL|LINEAR)_DIMENSION|FONTNAMES_LIST|HEIGHT_OF_STYLE|HOME(_STORY|DB_INFO)|ID_OF_MAIN|INTERNAL_ID|Full_ID_of_parent|NAME_OF_(FILL|LINE_TYPE|LISTED|MACRO|MAIN|MATERIAL|PLAN|PROGRAM|STYLE)
559+
(?ix)\b((BLUE|RED|GREEN)_OF_(PEN|MATERIAL)|GDL_VERSION|MODEL_SIZE|PEN_OF_RGB|PROGRAM|SERIAL_NUMBER|ANCESTRY_INFO
560+
|(ANGULAR_(LENGTH_)?|AREA_|RADIAL_|SILL_HEIGHT_)DIMENSION|(ASSOCEL|MATCHING)_PROPERTIES|ASSOCLP_(NAME|PARVALUE(_WITH_DESCRIPTION)?)
561+
|CALC_(ANGLE|AREA|LENGTH|VOLUME)_UNIT|CLEAN_INTERSECTIONS|CONSTR_FILLS_DISPLAY|CUSTOM_AUTO_LABEL|DATETIME|DOOR_SHOW_DIM
562+
|(ELEVATION|LEVEL|LINEAR)_DIMENSION|FONTNAMES_LIST|HEIGHT_OF_STYLE|HOME(_STORY|DB_INFO)|ID_OF_MAIN|INTERNAL_ID
563+
|Full_ID_of_parent|NAME_OF_(FILL|LINE_TYPE|LISTED|MACRO|MAIN|MATERIAL|PLAN|PROGRAM|STYLE)
548564
|REFERENCE_DATA_LEVEL|RGB_OF_(MATERIAL|PEN)|STORY(_INFO)?|(STYLE|TEXTBLOCK)_INFO|WINDOW_(DOOR_(DIMENSION|SHOW_DIM|ZONE_RELEV)|SHOW_DIM)|WORKING_(ANGLE|LENGTH)_UNIT|ZONE_(CATEGORY|COLUS_AREA|RELATIONS)
549-
|MATERIAL_INFO|COMPONENT_(PROJECTED_AREA|VOLUME))
565+
|MATERIAL_INFO|COMPONENT_(PROJECTED_AREA|VOLUME)
566+
|(Component_Ids|((Component_)?(Property_Values|Properties)))_Of_Parent)
550567
\b
551568
scope: keyword.globals.request.gdl
552569
@@ -571,11 +588,15 @@ contexts:
571588
- include: main
572589

573590
buffer-in:
574-
# now buffer com without ()
591+
# now buffer coms without ()
575592
- match: (?i)(\b)(PUT|NSP)(\b)
576593
scope: keyword.buffer.gdl
577594

578595
############### FUNCTIONS #################
596+
func:
597+
- include: functions
598+
- include: functions-special
599+
579600
functions:
580601
- match: (?ix)(({{function_names}})\s?(?=\())
581602
captures:
@@ -595,10 +616,14 @@ contexts:
595616
- match: (?i)(\b)(PI)(\b)
596617
scope: keyword.other.special-method.functions.gdl
597618

598-
################### Arrays ######################
619+
################### Item Access ######################
620+
# originally this was labeld "Arrays"
621+
# but since we got dicts, not only arrays get the square brackets
599622
arrays:
600-
- match: (?i)([a-z_0-9]+)(?=\[)
601-
scope: entity.name.array.gdl
623+
- match: (?i)(?:(GLOB_(CUTPLANES_INFO|PROJECT_DATE)|WALL_POSITION|(ROOF|SHELLBASE)_SKINS_PARAMS|(LABEL|BEAM)_POSITION)|([a-z_0-9]+))(?=\[)
624+
captures:
625+
1: keyword.globals.general.gdl
626+
2: entity.name.array.gdl
602627
push:
603628
- match: \[
604629
scope: punctuation.section.array.begin.gdl
@@ -607,8 +632,7 @@ contexts:
607632
- match: \]
608633
scope: punctuation.section.array.end.gdl
609634
set: after-array
610-
- include: functions
611-
- include: functions-special
635+
- include: func
612636
- include: operators
613637
- include: expression-common
614638
- include: string
@@ -621,10 +645,9 @@ contexts:
621645
- match: \]
622646
scope: punctuation.section.array.end.gdl
623647
pop: true
624-
- include: functions
625-
- include: functions-special
648+
- include: func
626649
- include: operators
627650
- include: expression-common
628651
- include: string
629652
- match: '' # if no second bracket pop out
630-
pop: true
653+
pop: true

0 commit comments

Comments
 (0)