From 5acbccf0b2aa90df38b39ee5dc6417479a3b435d Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Sun, 12 May 2019 18:58:13 +0900 Subject: [PATCH 1/4] Add `fn` keyword (arrow function) added in PHP 7.4 to coloring https://wiki.php.net/rfc/arrow_functions_v2 --- runtime/syntax/php.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/php.yaml b/runtime/syntax/php.yaml index 2a1c69e7..67f61127 100644 --- a/runtime/syntax/php.yaml +++ b/runtime/syntax/php.yaml @@ -19,7 +19,7 @@ rules: - default: "<\\?(php|=)\" end=\"\\?>" - identifier.class: "([a-zA-Z0-9_-]+)\\(" - preproc: "\\b(require|include)(_once)?\\b" - - type: "\\b(var|class|extends|function|echo|case|default|exit|switch|extends|as|define|do|declare|in|trait|interface|[E|e]xception|array|int|string|bool|iterable|void)\\b" + - type: "\\b(var|class|extends|fn|function|echo|case|default|exit|switch|extends|as|define|do|declare|in|trait|interface|[E|e]xception|array|int|string|bool|iterable|void)\\b" - identifier.class: "[a-zA-Z\\\\]+::" - identifier: "\\b([A-Z][a-zA-Z0-9_]+)\\b" - identifier: "([A-Z0-9_]+)[;|\\s|\\)|,]" From 51691ed7bfd9641342a3f45e9c181f8ec709fdb4 Mon Sep 17 00:00:00 2001 From: USAMI Kenta Date: Sun, 12 May 2019 20:12:28 +0900 Subject: [PATCH 2/4] Reclassified PHP keywords --- runtime/syntax/php.yaml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/runtime/syntax/php.yaml b/runtime/syntax/php.yaml index 67f61127..c6862788 100644 --- a/runtime/syntax/php.yaml +++ b/runtime/syntax/php.yaml @@ -1,6 +1,6 @@ filetype: php -detect: +detect: filename: "\\.php[2345s~]?$" rules: @@ -18,16 +18,15 @@ rules: - comment: "" - default: "<\\?(php|=)\" end=\"\\?>" - identifier.class: "([a-zA-Z0-9_-]+)\\(" - - preproc: "\\b(require|include)(_once)?\\b" - - type: "\\b(var|class|extends|fn|function|echo|case|default|exit|switch|extends|as|define|do|declare|in|trait|interface|[E|e]xception|array|int|string|bool|iterable|void)\\b" + - type: "\\b(array|bool(ean)?|callable|callback|float|int(eger)?|iterable|object|resource|mixed|string|void)\\b" - identifier.class: "[a-zA-Z\\\\]+::" - identifier: "\\b([A-Z][a-zA-Z0-9_]+)\\b" - identifier: "([A-Z0-9_]+)[;|\\s|\\)|,]" - - type.keyword: "(global|public|private|protected|static|const)" - - statement: "(implements|abstract|instanceof|if|else(if)?|endif|namespace|use|as|new|throw|catch|try|while|print|(end)?(foreach)?)\\b" - - identifier: "new\\s([a-zA-Z0-9\\\\]+)" - - special: "(break|continue|goto|return)" - - constant.bool: "(true|false|null|TRUE|FALSE|NULL)" + - type.keyword: "\\b(global|final|public|private|protected|static|const|var)\\b" + - statement: "\\b(abstract|catch|class|declare|do|else(if)?|end(declare|for(each)?|if|switch|while)|finally|for(each)|function|if|interface|namespace|switch|trait|try|while)\\b" + - identifier: "\\bnew\\s+([a-zA-Z0-9\\\\]+)" + - special: "\\b(as|and|break|case|clone|continue|default|die|fn|echo|empty|eval|exit|extends|goto|or|include(_once)?|implements|instanceof|insteadof|isset|list|new|print|return|require(_once)?|unset|use|throw|xor|yield(\\s+from))\\b" + - constant.bool: "\\b(true|false|null|TRUE|FALSE|NULL)\\b" - constant: "[\\s|=|\\s|\\(|/|+|-|\\*|\\[]" - constant.number: "[0-9]" - identifier: "(\\$this|parent|self|\\$this->)" From 26172b5101bb61e61002ce7a55ba0abd540e214f Mon Sep 17 00:00:00 2001 From: David Konsumer Date: Thu, 16 May 2019 16:25:51 -0700 Subject: [PATCH 3/4] add support for input and scalar defintiions (for graphql-tools schema) --- runtime/syntax/graphql.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/graphql.yaml b/runtime/syntax/graphql.yaml index ed0bae39..289269f2 100644 --- a/runtime/syntax/graphql.yaml +++ b/runtime/syntax/graphql.yaml @@ -4,7 +4,7 @@ detect: filename: "\\.(gql|graphql)$" rules: - - type: "\\b(?:(query|mutation|subscription|type|fragment|schema|union|on|extends?))\\b" + - type: "\\b(?:(query|mutation|subscription|type|input|scalar|fragment|schema|union|on|extends?))\\b" # scalar types - statement: "\\b(ID|Int|Float|Boolean|String|Datetime|Null)\\b" From 612ebb2e179e783e2a1e1a047e5d9361da2c261f Mon Sep 17 00:00:00 2001 From: Ender - Josh Pritsker Date: Sat, 25 May 2019 21:01:24 -0700 Subject: [PATCH 4/4] Add Forth highlighting --- runtime/syntax/forth.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 runtime/syntax/forth.yaml diff --git a/runtime/syntax/forth.yaml b/runtime/syntax/forth.yaml new file mode 100644 index 00000000..62931f1a --- /dev/null +++ b/runtime/syntax/forth.yaml @@ -0,0 +1,34 @@ +filetype: forth + +detect: + filename: "\\.(forth|4th|fs|fs8|ft|fth|frt)$" + +rules: + - identifier: "\\b[A-Za-z_0-9-]*\\b" + + - statement: "\\b(?i:(if|else|then|do|loop|case|endcase|of|endof|begin|while|repeat|until|again|unloop|leave|exit|done|next|\\?do|\\+do|\\-do|\\+loop|\\-loop|\\?leave))\\b" + + - statement: "(^:|;$)" + + - type: "\\b(?i:(variable|constant|cells))\\b" + + - special: "\\B[?.]\\B" #for some reason, \b and \B are inverted for symbols + + - constant.number: "\\b[0-9]+\\b" + + - constant.string: + start: "\\b([Ss.]\" )" + end: "\"" + rules: [] + + - comment: + start: "\\(" + end: "\\)" + rules: + - todo: "(TODO|NOTE|XXX|FIXME):?" + + - comment: + start: "\\\\" + end: "$" + rules: + - todo: "(TODO|NOTE|XXX|FIXME):?"