Add syntax highlighting for function calls

Closes #30.

Pattern: identifier optional_spaces open_parenthesis

The implementation uses `"("` instead `(syntax open-parenthesis)` as
`open-parenthesis` is defined from `(open-paren (or "{" "[" "("))`. As a result,
the regular expression would also highlight array and dictionary variables.

The regular expression does highlight signal definitions with parameters,
though, as they follow the same pattern of function calls. This could be avoided
by ignoring expressions started with "signal" (or by adding a custom rule to
highlight signal definitions).
This commit is contained in:
Franco Eusébio Garcia
2020-04-03 14:31:03 -03:00
parent 753f4e6be6
commit 6a3e4070bb
2 changed files with 7 additions and 1 deletions

View File

@@ -75,7 +75,12 @@
(or "var" "const")
(1+ space)
(group (1+ (or word ?_))))
(1 font-lock-variable-name-face))))
(1 font-lock-variable-name-face))
;; Function call
(,(rx (group (1+ (or word ?_)))
(0+ space)
"(")
(1 font-lock-function-name-face))))
(defvar gdscript-syntax-table (make-syntax-table))