Skip to content

Commit fc047c9

Browse files
committed
First test
1 parent 3b4366a commit fc047c9

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

grammars/gdscript.cson

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'fileTypes': [
44
'gd'
55
]
6-
'firstLineMatch': '^#!/.*\\bgdscript\\b'
6+
#'firstLineMatch': '^#!/.*\\bgdscript\\b'
77
'patterns': [
88
{
99
'begin': '(^[ \\t]+)?(?=#)'
@@ -82,6 +82,14 @@
8282
'name': 'keyword.control.import.from.gdscript'
8383
'match': '\\b(?:(import)|(from))\\b'
8484
}
85+
{
86+
'captures':
87+
'1':
88+
'name': 'keyword.control.import.gdscript'
89+
'2':
90+
'name': 'keyword.control.import.from.gdscript'
91+
'match': '\\b(?:(extends)|(from))\\b'
92+
}
8593
{
8694
'comment': 'keywords that delimit flow conditionals'
8795
'name': 'keyword.control.conditional.gdscript'
@@ -112,7 +120,7 @@
112120
'1':
113121
'name': 'keyword.other.gdscript'
114122
'comment': 'keywords that haven\'t fit into other groups (yet).'
115-
'match': '\\b(as|assert|del|exec|print)\\b'
123+
'match': '\\b(as|assert|del|exec|print|var)\\b'
116124
}
117125
{
118126
'match': '<>'
@@ -299,6 +307,31 @@
299307
}
300308
]
301309
}
310+
{
311+
'begin': '^\\s*(func)\\s+(?=[A-Za-z_][A-Za-z0-9_]*)'
312+
'beginCaptures':
313+
'1':
314+
'name': 'storage.type.function.gdscript'
315+
'end': '(\\()|\\s*($\\n?|#.*$\\n?)'
316+
'endCaptures':
317+
'1':
318+
'name': 'punctuation.definition.parameters.begin.gdscript'
319+
'2':
320+
'name': 'invalid.illegal.missing-parameters.gdscript'
321+
'name': 'meta.function.gdscript'
322+
'patterns': [
323+
{
324+
'begin': '(?=[A-Za-z_][A-Za-z0-9_]*)'
325+
'contentName': 'entity.name.function.gdscript'
326+
'end': '(?![A-Za-z0-9_])'
327+
'patterns': [
328+
{
329+
'include': '#entity_name_function'
330+
}
331+
]
332+
}
333+
]
334+
}
302335
{
303336
'begin': '(lambda)(?=\\s+)'
304337
'beginCaptures':
@@ -502,7 +535,7 @@
502535
'captures':
503536
'1':
504537
'name': 'storage.type.function.gdscript'
505-
'match': '\\b(def|lambda)\\b'
538+
'match': '\\b(def|lambda|func)\\b'
506539
}
507540
{
508541
'captures':
@@ -641,7 +674,7 @@
641674
'match': '(?x)\\b(\n\t\t\t\t(\n\t\t\t\t\tArithmetic|Assertion|Attribute|BlockingIO|BrokenPipe|Buffer|ChildProcess|\n\t\t\t\t\tConnection(Aborted|Refused|Reset)?|EOF|Environment|FileExists|\n\t\t\t\t\tFileNotFound|FloatingPoint|Interrupted|IO|IsADirectoryError|\n\t\t\t\t\tImport|Indentation|Index|Key|Lookup|Memory|Name|NotADirectory|\n\t\t\t\t\tNotImplemented|OS|Overflow|Permission|ProcessLookup|Reference|\n\t\t\t\t\tRuntime|Standard|Syntax|System|Tab|Timeout|Type|UnboundLocal|\n\t\t\t\t\tUnicode(Encode|Decode|Translate)?|Value|VMS|Windows|ZeroDivision\n\t\t\t\t)Error|\n\t\t\t\t((Pending)?Deprecation|Runtime|Syntax|User|Future|Import|Unicode|Bytes)?Warning|\n\t\t\t\t(Base)?Exception|\n\t\t\t\tSystemExit|StopIteration|NotImplemented|KeyboardInterrupt|GeneratorExit\n\t\t\t)\\b'
642675
'name': 'support.type.exception.gdscript'
643676
'builtin_functions':
644-
'match': '(?x)\\b(\n\t\t\t\t__import__|all|abs|any|apply|ascii|bin|callable|chr|classmethod|cmp|coerce|\n\t\t\t\tcompile|delattr|dir|divmod|enumerate|eval|execfile|filter|format|getattr|\n\t\t\t\tglobals|hasattr|hash|help|hex|id|input|intern|isinstance|issubclass|iter|\n\t\t\t\tlen|locals|map|max|min|next|oct|open|ord|pow|print|property|range|\n\t\t\t\traw_input|reduce|reload|repr|reversed|round|setattr|sorted|staticmethod|\n\t\t\t\tsum|super|type|unichr|vars|zip\n\t\t\t)\\b'
677+
'match': '(?x)\\b(\n\t\t\t\t__import__|extends|all|abs|any|apply|ascii|bin|callable|chr|classmethod|cmp|coerce|\n\t\t\t\tcompile|delattr|dir|divmod|enumerate|eval|execfile|filter|format|getattr|\n\t\t\t\tglobals|hasattr|hash|help|hex|id|input|intern|isinstance|issubclass|iter|\n\t\t\t\tlen|locals|map|max|min|next|oct|open|ord|pow|print|property|range|\n\t\t\t\traw_input|reduce|reload|repr|reversed|round|setattr|sorted|staticmethod|\n\t\t\t\tsum|super|type|unichr|vars|get_tree|get_node|get_root|get_child|get_child_count|queue_free|load|instance|add_child|play|get_item_rect|get_viewport_rect|is_action_pressed|get_joy_axis|get_pos|get_mouse_pos|set_pos|get_children|is_visible|get_texture|get_size|hide|show|Node|Node2D|Rect2|Input|Vector2|zip\n\t\t\t)\\b'
645678
'name': 'support.function.builtin.gdscript'
646679
'builtin_types':
647680
'match': '(?x)\\b(\n\t\t\t\tbasestring|bool|buffer|bytearray|bytes|complex|dict|float|frozenset|int|\n\t\t\t\tlist|long|memoryview|object|range|set|slice|str|tuple|unicode|xrange\n\t\t\t)\\b'
@@ -808,7 +841,7 @@
808841
'generic_names':
809842
'match': '[A-Za-z_][A-Za-z0-9_]*'
810843
'illegal_names':
811-
'match': '\\b(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\\b'
844+
'match': '\\b(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|extends|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\\b'
812845
'name': 'invalid.illegal.name.gdscript'
813846
'keyword_arguments':
814847
'begin': '\\b([a-zA-Z_][a-zA-Z_0-9]*)\\s*(=)(?!=)'

scoped-properties/language-gdscript.cson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
'tabLength': 4
55
'foldEndPattern': '^\\s*"""\\s*$'
66
'commentStart': '# '
7-
'increaseIndentPattern': '^\\s*(class|def|elif|else|except|finally|for|if|try|with|while)\\b.*:\\s*$'
7+
'increaseIndentPattern': '^\\s*(class|def|elif|else|except|finally|for|if|try|with|while|func)\\b.*:\\s*$'
88
'decreaseIndentPattern': '^\\s*(elif|else|except|finally)\\b.*:'

0 commit comments

Comments
 (0)