@@ -28,7 +28,7 @@ def innerstring_rules(ttype):
2828 (r"%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?"
2929 "[hlL]?[E-GXc-giorsux%]" ,
3030 String .Interpol ),
31- # backslashes, quotes and formatting signs must be parsed one at a time
31+ # backslashes, quotes, and formatting signs must be parsed one at a time
3232 (r'[^\\\'"%\n]+' , ttype ),
3333 (r'[\'"\\]' , ttype ),
3434 # unhandled string formatting sign
@@ -47,7 +47,7 @@ def innerstring_rules(ttype):
4747 bygroups (Whitespace , String .Affix , String .Doc )),
4848 ],
4949 "punctuation" : [
50- (r"[]{}(),;[]" , Punctuation ),
50+ (r"[]{}(),: ;[]" , Punctuation ),
5151 (r":\n" , Punctuation ),
5252 (r"\\" , Punctuation ),
5353 ],
@@ -137,6 +137,7 @@ def innerstring_rules(ttype):
137137 include ("whitespace" ),
138138 include ("comment" ),
139139 include ("punctuation" ),
140+ include ("builtins" ),
140141
141142 # strings
142143 ('([rR]|[uUbB][rR]|[rR][uUbB])(""")' ,
@@ -167,12 +168,15 @@ def innerstring_rules(ttype):
167168 include ("operator" ),
168169 include ("keywords" ),
169170 (r"(func)(\s+)" , bygroups (Keyword , Whitespace ), "funcname" ),
170- # TODO: make the discernment if the type is Name.Builtin
171- (r"\b(\w+)\s*(:)( )" , bygroups (Name .Variable , Punctuation , Whitespace ), "typehint" ),
172- (r":" , Punctuation ), # HACK: fix missed colon captures
171+ (r'\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()' , Name .Function ),
172+
173+ # NOTE:
174+ # This matches all PascalCase as a class. If this raises issues
175+ # please report it.
176+ # see: https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html#naming-conventions
177+ (r'\s*([A-Z][a-zA-Z0-9_]*)' , Name .Class ),
173178
174- include ("builtins" ),
175179 include ("name" ),
176180 include ("numbers" ),
177181 ],
178- }
182+ }
0 commit comments