Skip to content

Commit

Permalink
Support "function" keyword, fix function call in return
Browse files Browse the repository at this point in the history
According to the VEX reference, it is possible to use word "function" before function definitions. "return foo();" no longer be highlighted as a function definition.
  • Loading branch information
teared committed Sep 27, 2017
1 parent 129be4c commit 09411ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions develop/test_syntax.vfl
Expand Up @@ -158,6 +158,11 @@ int some_function_def()
return 3;
}

int some_function_def(int blabla)
{
return some_fun(blabla);
}

float some_function_def(
vector pos;
float rough;
Expand Down
4 changes: 2 additions & 2 deletions syntax/VEX.sublime-syntax
Expand Up @@ -23,7 +23,7 @@ contexts:
- include: pragma

# Operators.
- match: \b(break|continue|do|else|foreach|forpoints|for|gather|if|illuminance|import(?!\s*\()|return|while)\b
- match: \b(break|continue|do|else|foreach|forpoints|for|function|gather|if|illuminance|import(?!\s*\()|return|while)\b
scope: keyword.control.vex
- match: (\-|\+|\*|\/|%|&|\||\^)?=
scope: keyword.operator.assignment.vex
Expand Down Expand Up @@ -174,7 +174,7 @@ contexts:
1: storage.type.vex
2: entity.name.function.definition.vex

- match: \b(\w+)\s*(?:\[\])?\s*\b(\w+)\b(?=\s*\((?:\s*\w+\s+\w+)?)
- match: \b(\w+)(?<!return)\s*(?:\[\])?\s*\b(\w+)\b(?=\s*\((?:\s*\w+\s+\w+)?)
captures:
1: storage.type.vex
2: entity.name.function.definition.vex
Expand Down

0 comments on commit 09411ca

Please sign in to comment.