update syntax highlighter definitions
This commit is contained in:
parent
53b62f568b
commit
4b5bc19a0f
5 changed files with 76 additions and 44 deletions
|
@ -37,7 +37,7 @@ ace.define("ace/mode/zokrates_highlight_rules",["require","exports","module","ac
|
|||
var ZoKratesHighlightRules = function () {
|
||||
|
||||
var keywords = (
|
||||
"assert|as|bool|byte|const|def|do|else|endfor|export|false|field|for|if|then|fi|import|from|in|private|public|return|struct|true|type|u8|u16|u32|u64"
|
||||
"assert|as|bool|const|def|else|false|field|for|if|then|import|from|in|log|private|public|return|struct|true|type|u8|u16|u32|u64"
|
||||
);
|
||||
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
{
|
||||
"name": "zokrates",
|
||||
"displayName": "zokrates",
|
||||
"description": "Syntax highlighting for the ZoKrates language",
|
||||
"publisher": "zokrates",
|
||||
"repository": "https://github.com/ZoKrates/ZoKrates",
|
||||
"version": "0.0.2",
|
||||
"engines": {
|
||||
"vscode": "^1.53.0"
|
||||
},
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
],
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "zokrates",
|
||||
"aliases": [
|
||||
"ZoKrates",
|
||||
"zokrates"
|
||||
],
|
||||
"extensions": [
|
||||
".zok"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "zokrates",
|
||||
"scopeName": "source.zok",
|
||||
"path": "./syntaxes/zokrates.tmLanguage.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"name": "zokrates",
|
||||
"displayName": "zokrates",
|
||||
"description": "Syntax highlighting for the ZoKrates language",
|
||||
"publisher": "zokrates",
|
||||
"repository": "https://github.com/ZoKrates/ZoKrates",
|
||||
"version": "0.0.4",
|
||||
"engines": {
|
||||
"vscode": "^1.53.0"
|
||||
},
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
],
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "zokrates",
|
||||
"aliases": [
|
||||
"ZoKrates",
|
||||
"zokrates"
|
||||
],
|
||||
"extensions": [
|
||||
".zok"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "zokrates",
|
||||
"scopeName": "source.zok",
|
||||
"path": "./syntaxes/zokrates.tmLanguage.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -188,7 +188,7 @@
|
|||
"patterns": [
|
||||
{
|
||||
"comment": "constant definition",
|
||||
"name": "constant.definition.zokrates",
|
||||
"name": "meta.constant.definition.zokrates",
|
||||
"match": "\\b(const)\\s+([A-Za-z0-9_]+)\\s+([A-Za-z0-9_]+)\\s+=\\s+(?:.+)\\b",
|
||||
"captures": {
|
||||
"1": {
|
||||
|
@ -388,7 +388,7 @@
|
|||
{
|
||||
"comment": "control flow keywords",
|
||||
"name": "keyword.control.zokrates",
|
||||
"match": "\\b(do|else|for|do|endfor|if|then|fi|return|assert)\\b"
|
||||
"match": "\\b(for|in|if|then|else|fi|return|assert|log)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "storage keywords",
|
||||
|
@ -396,14 +396,19 @@
|
|||
"match": "\\b(struct)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "const",
|
||||
"comment": "const keyword",
|
||||
"name": "keyword.other.const.zokrates",
|
||||
"match": "\\bconst\\b"
|
||||
"match": "\\b(const)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "def",
|
||||
"comment": "type keyword",
|
||||
"name": "keyword.other.type.zokrates",
|
||||
"match": "\\b(type)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "def keyword",
|
||||
"name": "keyword.other.def.zokrates",
|
||||
"match": "\\bdef\\b"
|
||||
"match": "\\b(def)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "import keywords",
|
||||
|
@ -415,6 +420,11 @@
|
|||
"name": "keyword.operator.logical.zokrates",
|
||||
"match": "(\\^|\\||\\|\\||&|&&|<<|>>|!)(?!=)"
|
||||
},
|
||||
{
|
||||
"comment": "mut",
|
||||
"name": "storage.modifier.mut.zokrates",
|
||||
"match": "\\b(mut)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "single equal",
|
||||
"name": "keyword.operator.assignment.equal.zokrates",
|
||||
|
@ -559,11 +569,21 @@
|
|||
"name": "punctuation.comma.zokrates",
|
||||
"match": ","
|
||||
},
|
||||
{
|
||||
"comment": "curly braces",
|
||||
"name": "punctuation.brackets.curly.zokrates",
|
||||
"match": "[{}]"
|
||||
},
|
||||
{
|
||||
"comment": "parentheses, round brackets",
|
||||
"name": "punctuation.brackets.round.zokrates",
|
||||
"match": "[()]"
|
||||
},
|
||||
{
|
||||
"comment": "semicolon",
|
||||
"name": "punctuation.semi.zokrates",
|
||||
"match": ";"
|
||||
},
|
||||
{
|
||||
"comment": "square brackets",
|
||||
"name": "punctuation.brackets.square.zokrates",
|
||||
|
|
|
@ -202,7 +202,7 @@ repository:
|
|||
-
|
||||
comment: 'control flow keywords'
|
||||
name: keyword.control.zokrates
|
||||
match: \b(for|in|do|endfor|if|then|else|fi|return|assert)\b
|
||||
match: \b(for|in|if|then|else|fi|return|assert|log)\b
|
||||
-
|
||||
comment: 'storage keywords'
|
||||
name: storage.type.zokrates
|
||||
|
@ -227,6 +227,10 @@ repository:
|
|||
comment: 'logical operators'
|
||||
name: keyword.operator.logical.zokrates
|
||||
match: '(\^|\||\|\||&|&&|<<|>>|!)(?!=)'
|
||||
-
|
||||
comment: 'mut'
|
||||
name: "storage.modifier.mut.zokrates"
|
||||
match: \b(mut)\b
|
||||
-
|
||||
comment: 'single equal'
|
||||
name: keyword.operator.assignment.equal.zokrates
|
||||
|
@ -309,10 +313,18 @@ repository:
|
|||
comment: comma
|
||||
name: punctuation.comma.zokrates
|
||||
match: ','
|
||||
-
|
||||
comment: 'curly braces'
|
||||
name: punctuation.brackets.curly.zokrates
|
||||
match: '[{}]'
|
||||
-
|
||||
comment: 'parentheses, round brackets'
|
||||
name: punctuation.brackets.round.zokrates
|
||||
match: '[()]'
|
||||
-
|
||||
comment: 'semicolon'
|
||||
name: punctuation.semi.zokrates
|
||||
match: ';'
|
||||
-
|
||||
comment: 'square brackets'
|
||||
name: punctuation.brackets.square.zokrates
|
||||
|
|
|
@ -180,6 +180,6 @@ COMMENT = _{ ("/*" ~ (!"*/" ~ ANY)* ~ "*/") | ("//" ~ (!NEWLINE ~ ANY)*) }
|
|||
// the ordering of reserved keywords matters: if "as" is before "assert", then "assert" gets parsed as (as)(sert) and incorrectly
|
||||
// accepted
|
||||
keyword = @{
|
||||
"log"|"assert"|"as"|"bool"|"const"|"def"|"else"|"false"|"field"|"for"|"if"|"then"|"fi"|"import"|"from"|
|
||||
"log"|"assert"|"as"|"bool"|"const"|"def"|"else"|"false"|"field"|"for"|"if"|"then"|"import"|"from"|
|
||||
"in"|"mut"|"private"|"public"|"return"|"struct"|"true"|"u8"|"u16"|"u32"|"u64"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue