diff --git a/README.md b/README.md index 478dca6..b0d63df 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,32 @@ gem5-slicc supportor ## Features -- syntax highlight support +### syntax highlight support + +- [x] variable define + +![feature syntax supportor](images/syntax1.png) + +- [x] state/event define + +![feature syntax supportor](images/syntax2.png) + +- [x] struct define + +![feature syntax supportor](images/syntax3.png) + +- [x] transition define + +![feature syntax supportor](images/syntax4.png) + +- [x] action define + +![feature syntax supportor](images/syntax5.png) + +- [x] function define +![feature syntax supportor](images/syntax6.png) + -![feature syntax supportor](images/syntax.png) ## Requirements diff --git a/images/syntax.png b/images/syntax.png deleted file mode 100644 index 11dfb50..0000000 Binary files a/images/syntax.png and /dev/null differ diff --git a/images/syntax1.png b/images/syntax1.png new file mode 100644 index 0000000..3b035a5 Binary files /dev/null and b/images/syntax1.png differ diff --git a/images/syntax2.png b/images/syntax2.png new file mode 100644 index 0000000..dfa80cd Binary files /dev/null and b/images/syntax2.png differ diff --git a/images/syntax3.png b/images/syntax3.png new file mode 100644 index 0000000..ead4c4b Binary files /dev/null and b/images/syntax3.png differ diff --git a/images/syntax4.png b/images/syntax4.png new file mode 100644 index 0000000..9e31b70 Binary files /dev/null and b/images/syntax4.png differ diff --git a/images/syntax5.png b/images/syntax5.png new file mode 100644 index 0000000..6250a4e Binary files /dev/null and b/images/syntax5.png differ diff --git a/images/syntax6.png b/images/syntax6.png new file mode 100644 index 0000000..a89641d Binary files /dev/null and b/images/syntax6.png differ diff --git a/package.json b/package.json index 23bad3f..8ea33c5 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "gem5-slicc" ], "extensions": [ - ".sm" + ".sm", + ".slicc" ], "configuration": "./language-configuration.json" } diff --git a/syntaxes/gem5-slicc.tmLanguage.json b/syntaxes/gem5-slicc.tmLanguage.json index a739fb1..f17a75e 100644 --- a/syntaxes/gem5-slicc.tmLanguage.json +++ b/syntaxes/gem5-slicc.tmLanguage.json @@ -1,7 +1,11 @@ { "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "name": "gem5-slicc", + "scopeName": "source.slicc", "patterns": [ + { + "include": "#states_enents.define" + }, { "include": "#keywords" }, @@ -9,69 +13,602 @@ "include": "#strings" }, { - "include": "#support" + "include": "#constants" }, { - "include": "#entity" + "include": "#comment" }, { - "include": "#comment" + "include": "#func.define" + }, + { + "include": "#func.use" + }, + { + "include": "#variables.define" + }, + { + "include": "#variables.use" } ], "repository": { + "states_enents.define": { + "patterns": [ + { + "name": "states_enents.define1", + "match": "^\\s*([a-zA-Z_]\\w*)\\s*\\,\\s*(AccessPermission)\\:\\s*(\\w+)\\s*\\,\\s*(desc)\\=\\\"(.*)\\\"", + "captures": { + "1": { + "name": "entity.name.function" + }, + "2": { + "name": "variable.parameter" + }, + "3": { + "name": "support.type" + }, + "4": { + "name": "variable.parameter" + }, + "5": { + "name": "string.quoted.double" + } + } + }, + { + "name": "states_enents.define2", + "match": "^\\s*([a-zA-Z_]\\w*)\\s*\\,\\s*(desc)\\=\\\"(.*)\\\"", + "captures": { + "1": { + "name": "entity.name.function" + }, + "2": { + "name": "variable.parameter" + }, + "3": { + "name": "string.quoted.double" + } + } + } + ] + }, "keywords": { "patterns": [ { "name": "keyword.control", - "match": "\\b(while|for|return)\\b" + "match": "\\s*\\b(while|for|return|include|protocol)\\b\\s*" }, { "name": "keyword.control", - "match": "\\b(if|else)\\b" + "match": "\\s*\\b(if|else)\\b\\s*" } ] }, - "strings": { - "name": "string.quoted.double", - "begin": "\"", - "end": "\"", + "constants": { "patterns": [ { - "name": "constant.character.escape", - "match": "\\\\." + "name": "constant.language", + "match": "\\s*\\b(true|True|TRUE|false|False|FALSE|null|NULL)\\b\\s*" } ] }, - "support": { + "strings": { + "begin": "\\s*\\\"", + "end": "\\\"", + "contentName": "string.quoted.double" + }, + "variables.define": { "patterns": [ { - "name": "support.class", - "match": "\\b(MachineType|CacheMemory|Sequencer|Cycles|MessageBuffer|TBE|Entry|State|NetDest|MachineID|DataBlock|Addr|Tick|TBETable|AccessPermission)\\b" - }, + "name": "variables.variables.define", + "begin": "^\\s*([a-zA-Z_]\\w*)\\s*\\*?\\&?\\s*\\b([a-zA-Z_]\\w*)\\s*", + "end": "\\;", + "beginCaptures": { + "1": { + "name": "support.type" + }, + "2": { + "name": "entity.name.tag" + } + }, + "endCaptures": { + "0": null + }, + "patterns": [ + { + "match": "\\s*:=\\s*\\\"(.*)\\\"", + "captures": { + "1": { + "name": "string.quoted.double" + } + } + }, + { + "name": "variables.define.func.use", + "begin": "\\s*(([a-zA-Z_]\\w*)\\.)?\\s*([a-zA-Z_]\\w*)\\s*\\(", + "end": "\\)\\s*", + "beginCaptures": { + "2": { + "name": "entity.name.tag" + }, + "3": { + "name": "entity.name.function" + } + }, + "endCaptures": { + "0": { + "name": "func.end" + } + }, + "patterns": [ + { + "include": "$self" + }, + { + "include": "#variables.use" + }, + { + "match": "\\s*\\\"([^\\\"]*)\\\"", + "captures": { + "1": { + "name": "string.quoted.double" + } + } + }, + { + "match": "\\s*(\\w+)\\s*", + "captures": { + "1": { + "name": "entity.name.tag" + } + } + } + ] + }, + { + "match": "\\s*(\\,)?\\s*([a-zA-Z_]\\w*)\\s*=\\s*\\\"([^\\\"]*)\\\"", + "captures": { + "2": { + "name": "variable.parameter" + }, + "3": { + "name": "string.quoted.double" + } + } + }, + { + "include": "#variables.use" + }, + { + "match": "\\s*([a-zA-Z_]\\w*)\\.(\\w+)", + "captures": { + "1": { + "name": "entity.name.tag" + }, + "2": { + "name": "entity.other.attribute-name" + } + } + }, + { + "match": "\\s*([a-zA-Z_]\\w*)\\:(\\w+)", + "captures": { + "1": { + "name": "entity.name.tag" + }, + "2": { + "name": "support.type" + } + } + }, + { + "match": "\\s*([a-zA-Z_]\\w*)\\-\\>", + "captures": { + "1": { + "name": "entity.name.tag" + } + } + } + ] + } + ] + }, + "variables.use": { + "patterns": [ { - "name": "support.function", - "match": "\\b(machine|state_declaration|enumeration|structure|action)\\b" + "name": "variables.use", + "patterns": [ + { + "name": "variables.use.attribute.func", + "begin": "\\s*([a-zA-Z_]\\w*)\\.\\s*([a-zA-Z_]\\w*)\\(", + "end": "\\)\\s*(\\;)?", + "beginCaptures": { + "1": { + "name": "entity.name.tag" + }, + "2": { + "name": "entity.name.function" + } + }, + "endCaptures": { + "0": { + "name": "func.end" + } + }, + "patterns": [ + { + "include": "$self" + }, + { + "match": "\\s*\\\"([^\\\"]*)\\\"", + "captures": { + "1": { + "name": "string.quoted.double" + } + } + }, + { + "match": "\\s*(\\w+)\\s*", + "captures": { + "1": { + "name": "entity.name.tag" + } + } + } + ] + }, + { + "match": "\\s*([a-zA-Z_]\\w*)\\.(\\w+)?", + "captures": { + "1": { + "name": "entity.name.tag" + }, + "2": { + "name": "entity.other.attribute-name" + } + } + }, + { + "match": "\\s*([a-zA-Z_]\\w*)\\:(\\w+)", + "captures": { + "1": { + "name": "entity.name.tag" + }, + "2": { + "name": "support.type" + } + } + }, + { + "match": "\\s*([a-zA-Z_]\\w*)\\-\\>", + "captures": { + "1": { + "name": "entity.name.tag" + } + } + }, + { + "match": "\\s*(\\w+)\\b", + "captures": { + "1": { + "name": "entity.name.tag" + } + } + } + ] } ] }, - "entity":{ + "func.define": { "patterns": [ { - "name": "entity.name.tag", - "match": "\\b(bool|int|double|void)\\b" + "name": "func.action.define", + "begin": "^\\s*(action)\\s*\\(", + "beginCaptures": { + "1": { + "name": "support.type" + } + }, + "end": "\\)(\\s*\\{)?", + "endCaptures": { + "0": { + "name": "func.transition.define.end" + } + }, + "patterns": [ + { + "match": "\\s*([a-zA-Z_]\\w+)\\:(\\w+)?", + "captures": { + "1": { + "name": "entity.name.tag" + }, + "2": { + "name": "support.type" + } + } + }, + { + "match": "\\s*\\:\\=\\s*\\\"(\\w+)\\\"\\b", + "captures": { + "1": { + "name": "string.quoted.double" + } + } + }, + { + "match": "\\s*([a-zA-Z_]\\w*)\\b\\s*\\*?\\&?\\s*\\b([a-zA-Z_]\\w*)", + "captures": { + "1": { + "name": "support.type" + }, + "2": { + "name": "entity.name.tag" + } + } + }, + { + "match": "\\s*\\\"([^\\\"]*)\\\"", + "captures": { + "1": { + "name": "string.quoted.double" + } + } + }, + { + "match": "\\s*(\\,)?\\s*([a-zA-Z_]\\w+)\\s*=\\s*\\\"([^\\\"]*)\\\"", + "captures": { + "1": null, + "2": { + "name": "variable.parameter" + }, + "3": { + "name": "string.quoted.double" + } + } + }, + { + "match": "\\s*([a-zA-Z_]\\w*)", + "captures": { + "1": { + "name": "entity.name.tag" + } + } + } + ] }, { - "name": "function-name", - "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(", - "captures": { + "name": "func.transition.define", + "begin": "^\\s*(transition)\\s*\\(", + "beginCaptures": { "1": { + "name": "support.type" + } + }, + "end": "\\)\\s*(\\{.*\\})?", + "endCaptures": { + "1": { + "patterns": [ + { + "match": "\\w+", + "name": "entity.name.function" + } + ] + } + }, + "patterns": [ + { + "match": "\\s*([a-zA-Z_]\\w*)", + "captures": { + "1": { + "name": "entity.name.function" + } + } + }, + { + "include": "#comment" + } + ] + }, + { + "name": "func.state.define", + "begin": "^\\s*(machine|state_declaration|enumeration|structure)\\s*\\(", + "beginCaptures": { + "1": { + "name": "support.function" + }, + "2": { + "patterns": [ + { + "include": "#strings" + }, + { + "match": "\\,?(\\w+)\\,?", + "captures": { + "1": { + "name": "variable.parameter" + } + } + } + ] + } + }, + "end": "\\)(\\s*\\{)?", + "endCaptures": { + "0": null + }, + "patterns": [ + { + "match": "\\s*([a-zA-Z_]\\w+)\\:(\\w+)?", + "captures": { + "1": { + "name": "entity.name.tag" + }, + "2": { + "name": "support.type" + } + } + }, + { + "match": "\\s*\\:\\=\\s*\\\"(\\w+)\\\"\\b", + "captures": { + "1": { + "name": "string.quoted.double" + } + } + }, + { + "match": "\\s*([a-zA-Z_]\\w*)\\b\\s*\\*?\\&?\\s*\\b([a-zA-Z_]\\w*)", + "captures": { + "1": { + "name": "support.type" + }, + "2": { + "name": "entity.name.tag" + } + } + }, + { + "match": "\\s*\\\"([^\\\"]*)\\\"", + "captures": { + "1": { + "name": "string.quoted.double" + } + } + }, + { + "match": "\\s*(\\,)?\\s*([a-zA-Z_]\\w+)\\s*=\\s*\\\"([^\\\"]*)\\\"", + "captures": { + "1": null, + "2": { + "name": "variable.parameter" + }, + "3": { + "name": "string.quoted.double" + } + } + }, + { + "match": "\\s*([a-zA-Z_]\\w*)", + "captures": { + "1": { + "name": "support.type" + } + } + } + ] + }, + { + "name": "func.func.define", + "begin": "^\\s*\\b([a-zA-Z_]\\w*)\\b\\s*\\*?\\&?\\s*\\b([a-zA-Z_]\\w*)\\s*\\(", + "end": "\\)(\\;)?", + "beginCaptures": { + "1": { + "name": "support.type" + }, + "2": { "name": "entity.name.function" } - } + }, + "endCaptures": { + "0": { + "name": "func.func.define.end" + } + }, + "patterns": [ + { + "match": "([a-zA-Z_]\\w*)\\b\\s*\\*?\\&?\\s*\\b([a-zA-Z_]\\w*)", + "captures": { + "1": { + "name": "support.type" + }, + "2": { + "name": "entity.name.tag" + } + } + }, + { + "match": "\\s*:=\\s*\"?(\\w+)\"?\\b", + "captures": { + "1": { + "name": "string.quoted.double" + } + } + }, + { + "match": "\\\"([^\\\"]*)\\\"", + "captures": { + "1": { + "name": "string.quoted.double" + } + } + }, + { + "match": "(\\,)?\\s*([a-zA-Z_][a-zA-Z0-9_]+)\\s*=\\s*\\\"([^\\\"]+)\\\"", + "captures": { + "2": { + "name": "variable.parameter" + }, + "3": { + "name": "string.quoted.double" + } + } + }, + { + "match": "([a-zA-Z_]\\w*)", + "captures": { + "1": { + "name": "support.type" + } + } + } + ] } ] }, - "comment":{ + "func.use": { + "patterns": [ + { + "name": "func.use", + "begin": "\\s*([a-zA-Z_]\\w*)\\s*\\(", + "end": "\\)\\s*(\\;)?", + "beginCaptures": { + "1": { + "name": "entity.name.function" + } + }, + "endCaptures": { + "0": { + "name": "func.end" + } + }, + "patterns": [ + { + "include": "$self" + }, + { + "include": "#variables.use" + }, + { + "match": "\\s*\\\"([^\\\"]*)\\\"", + "captures": { + "1": { + "name": "string.quoted.double" + } + } + }, + { + "match": "\\s*(\\w+)\\s*", + "captures": { + "1": { + "name": "entity.name.tag" + } + } + } + ] + } + ] + }, + "comment": { "patterns": [ { "name": "comment.line.double-dash", @@ -80,10 +617,15 @@ { "name": "comment.block.documentation", "begin": "/\\*", - "end": "\\*/" + "beginCaptures": { + "0": "comment.block.documentation" + }, + "end": "\\*/", + "endCaptures": { + "0": "comment.block.documentation" + } } ] } - }, - "scopeName": "source.slicc" + } } diff --git a/syntaxes/gem5-slicc.tmLanguage.yaml b/syntaxes/gem5-slicc.tmLanguage.yaml index 323f8e2..278a9dc 100644 --- a/syntaxes/gem5-slicc.tmLanguage.yaml +++ b/syntaxes/gem5-slicc.tmLanguage.yaml @@ -1,20 +1,386 @@ $schema: https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json name: gem5-slicc +scopeName: source.slicc + patterns: + - include: '#states_enents.define' - include: '#keywords' - include: '#strings' - - include: '#block' + - include: '#constants' + - include: '#comment' + - include: '#func.define' + - include: '#func.use' + - include: '#variables.define' + - include: '#variables.use' + repository: + states_enents.define: + patterns: + - name: states_enents.define1 + match: ^\s*([a-zA-Z_]\w*)\s*\,\s*(AccessPermission)\:\s*(\w+)\s*\,\s*(desc)\=\"(.*)\" + captures: + 1: + name: entity.name.function + 2: + name: variable.parameter + 3: + name: support.type + 4: + name: variable.parameter + 5: + name: string.quoted.double + - name: states_enents.define2 + match: ^\s*([a-zA-Z_]\w*)\s*\,\s*(desc)\=\"(.*)\" + captures: + 1: + name: entity.name.function + 2: + name: variable.parameter + 3: + name: string.quoted.double + keywords: patterns: - - name: keyword.control.gem5-slicc - match: \b(if|while|for|return)\b + - name: keyword.control + match: \s*\b(while|for|return|include|protocol)\b\s* + - name: keyword.control + match: \s*\b(if|else)\b\s* + + constants: + patterns: + - name: constant.language + match: \s*\b(true|True|TRUE|false|False|FALSE|null|NULL)\b\s* strings: - name: string.quoted.double.gem5-slicc - begin: '"' - end: '"' + begin: \s*\" + end: \" + contentName: string.quoted.double + + variables.define: patterns: - - name: constant.character.escape.gem5-slicc - match: \\. -scopeName: source.slicc + - name: variables.variables.define + begin: ^\s*([a-zA-Z_]\w*)\s*\*?\&?\s*\b([a-zA-Z_]\w*)\s* + end: \; + beginCaptures: + 1: + name: support.type + 2: + name: entity.name.tag + endCaptures: + 0: + # name: constant.character + patterns: + - match: \s*:=\s*\"(.*)\" + captures: + 1: + name: string.quoted.double + # - match: \s*:=\s*([a-zA-Z_]\w*\(.&&[^\(\)]*\)) + # captures: + # 1: + # patterns: + # - include: '#func.use' + # - name: entity.name.tag + # match: \w+ + - name: variables.define.func.use + begin: \s*(([a-zA-Z_]\w*)\.)?\s*([a-zA-Z_]\w*)\s*\( + end: \)\s* + beginCaptures: + 2: + name: entity.name.tag + 3: + name: entity.name.function + endCaptures: + 0: + name: func.end + patterns: + - include: '$self' + - include: '#variables.use' + # - match: (\,)?\s*([a-zA-Z_]\w+)\s*=\s*\"([^\"]+)\" + # captures: + # 1: + # # name: constant.character + # 2: + # name: variable.parameter + # 3: + # name: string.quoted.double + - match: \s*\"([^\"]*)\" + captures: + 1: + name: string.quoted.double + - match: \s*(\w+)\s* + captures: + 1: + name: entity.name.tag + - match: \s*(\,)?\s*([a-zA-Z_]\w*)\s*=\s*\"([^\"]*)\" + captures: + # 1: + # # name: constant.character + 2: + name: variable.parameter + 3: + name: string.quoted.double + - include: '#variables.use' + - match: \s*([a-zA-Z_]\w*)\.(\w+) + captures: + 1: + name: entity.name.tag + 2: + name: entity.other.attribute-name + - match: \s*([a-zA-Z_]\w*)\:(\w+) + captures: + 1: + name: entity.name.tag + 2: + name: support.type + - match: \s*([a-zA-Z_]\w*)\-\> + captures: + 1: + name: entity.name.tag + # - match: \s*:?=\s*([^;]+) + # captures: + # 1: + # patterns: + # - include: '#variables.use' + # - name: entity.name.tag + # match: \w+ + variables.use: + patterns: + - name: variables.use + patterns: + - name: variables.use.attribute.func + begin: \s*([a-zA-Z_]\w*)\.\s*([a-zA-Z_]\w*)\( + end: \)\s*(\;)? + beginCaptures: + 1: + name: entity.name.tag + 2: + name: entity.name.function + endCaptures: + 0: + name: func.end + patterns: + - include: '$self' + - match: \s*\"([^\"]*)\" + captures: + 1: + name: string.quoted.double + - match: \s*(\w+)\s* + captures: + 1: + name: entity.name.tag + + - match: \s*([a-zA-Z_]\w*)\.(\w+)? + captures: + 1: + name: entity.name.tag + 2: + name: entity.other.attribute-name + - match: \s*([a-zA-Z_]\w*)\:(\w+) + captures: + 1: + name: entity.name.tag + 2: + name: support.type + - match: \s*([a-zA-Z_]\w*)\-\> + captures: + 1: + name: entity.name.tag + - match: \s*(\w+)\b + captures: + 1: + name: entity.name.tag + + func.define: + patterns: + - name: func.action.define + begin: ^\s*(action)\s*\( + beginCaptures: + 1: + name: support.type + end: \)(\s*\{)? + endCaptures: + 0: + name: func.transition.define.end + patterns: + - match: \s*([a-zA-Z_]\w+)\:(\w+)? + captures: + 1: + name: entity.name.tag + 2: + name: support.type + - match: \s*\:\=\s*\"(\w+)\"\b + captures: + 1: + name: string.quoted.double + - match: \s*([a-zA-Z_]\w*)\b\s*\*?\&?\s*\b([a-zA-Z_]\w*) + captures: + 1: + name: support.type + 2: + name: entity.name.tag + - match: \s*\"([^\"]*)\" + captures: + 1: + name: string.quoted.double + - match: \s*(\,)?\s*([a-zA-Z_]\w+)\s*=\s*\"([^\"]*)\" + captures: + 1: + # name: constant.character + 2: + name: variable.parameter + 3: + name: string.quoted.double + - match: \s*([a-zA-Z_]\w*) + captures: + 1: + name: entity.name.tag + - name: func.transition.define + begin: ^\s*(transition)\s*\( + beginCaptures: + 1: + name: support.type + + end: \)\s*(\{.*\})? + endCaptures: + 1: + patterns: + - match: \w+ + name: entity.name.function + patterns: + - match: \s*([a-zA-Z_]\w*) + captures: + 1: + name: entity.name.function + - include: '#comment' + - name: func.state.define + begin: ^\s*(machine|state_declaration|enumeration|structure)\s*\( + beginCaptures: + 1: + name: support.function + 2: + patterns: + - include: '#strings' + - match: \,?(\w+)\,? + captures: + 1: + name: variable.parameter + end: \)(\s*\{)? + endCaptures: + 0: + # name: constant.character + patterns: + - match: \s*([a-zA-Z_]\w+)\:(\w+)? + captures: + 1: + name: entity.name.tag + 2: + name: support.type + - match: \s*\:\=\s*\"(\w+)\"\b + captures: + 1: + name: string.quoted.double + - match: \s*([a-zA-Z_]\w*)\b\s*\*?\&?\s*\b([a-zA-Z_]\w*) + captures: + 1: + name: support.type + 2: + name: entity.name.tag + - match: \s*\"([^\"]*)\" + captures: + 1: + name: string.quoted.double + - match: \s*(\,)?\s*([a-zA-Z_]\w+)\s*=\s*\"([^\"]*)\" + captures: + 1: + # name: constant.character + 2: + name: variable.parameter + 3: + name: string.quoted.double + - match: \s*([a-zA-Z_]\w*) + captures: + 1: + name: support.type + + - name: func.func.define + begin: ^\s*\b([a-zA-Z_]\w*)\b\s*\*?\&?\s*\b([a-zA-Z_]\w*)\s*\( + end: \)(\;)? + beginCaptures: + 1: + name: support.type + 2: + name: entity.name.function + endCaptures: + 0: + name: func.func.define.end + patterns: + - match: ([a-zA-Z_]\w*)\b\s*\*?\&?\s*\b([a-zA-Z_]\w*) + captures: + 1: + name: support.type + 2: + name: entity.name.tag + - match: \s*:=\s*"?(\w+)"?\b + captures: + 1: + name: string.quoted.double + - match: \"([^\"]*)\" + captures: + 1: + name: string.quoted.double + - match: (\,)?\s*([a-zA-Z_][a-zA-Z0-9_]+)\s*=\s*\"([^\"]+)\" + captures: + # 1: + # name: constant.character + 2: + name: variable.parameter + 3: + name: string.quoted.double + - match: ([a-zA-Z_]\w*) + captures: + 1: + name: support.type + + func.use: + patterns: + - name: func.use + begin: \s*([a-zA-Z_]\w*)\s*\( + end: \)\s*(\;)? + beginCaptures: + 1: + name: entity.name.function + endCaptures: + 0: + name: func.end + patterns: + - include: '$self' + - include: '#variables.use' + # - match: (\,)?\s*([a-zA-Z_]\w+)\s*=\s*\"([^\"]+)\" + # captures: + # 1: + # # name: constant.character + # 2: + # name: variable.parameter + # 3: + # name: string.quoted.double + - match: \s*\"([^\"]*)\" + captures: + 1: + name: string.quoted.double + - match: \s*(\w+)\s* + captures: + 1: + name: entity.name.tag + + + comment: + patterns: + - name: comment.line.double-dash + match: //.* + - name: comment.block.documentation + begin: /\* + beginCaptures: + 0: comment.block.documentation + end: \*/ + endCaptures: + 0: comment.block.documentation diff --git a/vsc-extension-quickstart.md b/vsc-extension-quickstart.md index b5c9948..ee464d8 100644 --- a/vsc-extension-quickstart.md +++ b/vsc-extension-quickstart.md @@ -7,6 +7,15 @@ * `syntaxes/gem5-slicc.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization. * `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets. +* json -> yaml +```bash +npx js-yaml syntaxes/gem5-slicc.tmLanguage.json > syntaxes/gem5-slicc.tmLanguage.yaml +``` +* yaml -> json +```bash +npx js-yaml syntaxes/gem5-slicc.tmLanguage.yaml > syntaxes/gem5-slicc.tmLanguage.json +``` + ## Get up and running straight away * Make sure the language configuration settings in `language-configuration.json` are accurate. @@ -14,6 +23,26 @@ * Create a new file with a file name suffix matching your language. * Verify that syntax highlighting works and that the language configuration settings are working. +## Generate Packge +- ref: https://code.visualstudio.com/api/working-with-extensions/publishing-extension + +Installation +Make sure you have Node.js installed. Then run: + +```bash +npm install -g @vscode/vsce +``` + +Usage +You can use vsce to easily package and publish your extensions: +```bash +vsce package + +# output -> myExtension.vsix generated +``` + + + ## Make changes * You can relaunch the extension from the debug toolbar after making changes to the files listed above.