Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of .ext syntax highlighting #27

Merged
merged 4 commits into from
Mar 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions configs/ext.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"comments": {
"lineComment": "//",
"blockComment": ["/*", "*/"]
},
"brackets": [
["{", "}"]
],
"autoClosingPairs": [
["[", "]"],
["\"", "\""],
["(", ")"]
],
"surroundingPairs": [
["'", "'"],
["\"", "\""]
]
}
26 changes: 25 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,15 @@
"editor.detectIndentation": true,
"editor.trimAutoWhitespace": true,
"editor.autoClosingBrackets": "always"
}
},
"[ext]": {
"editor.quickSuggestions": true,
"editor.tabSize": 4,
"editor.insertSpaces": false,
"editor.detectIndentation": true,
"editor.trimAutoWhitespace": true,
"editor.autoClosingBrackets": "always"
}
},
"debuggers": [
{
Expand All @@ -116,6 +124,11 @@
"language": "sqf",
"scopeName": "source.sqf",
"path": "./syntaxes/sqf.min.json"
},
{
"language": "ext",
"scopeName": "description.ext",
"path": "./syntaxes/ext.min.json"
}
],
"languages": [
Expand All @@ -131,6 +144,17 @@
".sqm"
],
"configuration": "./configs/sqf.configuration.json"
},
{
"id": "ext",
"aliases": [
"Arma header file"
],
"extensions": [
".ext",
".hpp"
],
"configuration": "./configs/ext.configuration.json"
}
],
"menus": {
Expand Down
243 changes: 243 additions & 0 deletions syntaxes/ext.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
{
"scopeName": "description.ext",
"fileTypes": ["ext"],
"name": "ext",
"patterns": [
{ "include": "#strings" },
{ "include": "#numbers" },
{ "include": "#comments" },
{
"name": "storage.type",
"match": "\\b(class)\\b"
},
{
"begin": "^\\s*((#)\\s*(include(?:_next)?|import))\\b\\s*",
"beginCaptures": {
"1": {
"name": "keyword.control.directive.$3.ext"
},
"2": {
"name": "punctuation.definition.directive.ext"
}
},
"end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
"name": "meta.preprocessor.include.ext",
"patterns": [
{
"include": "#line_continuation_character"
},
{
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.ext"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.ext"
}
},
"name": "string.quoted.double.include.ext"
},
{
"begin": "<",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.ext"
}
},
"end": ">",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.ext"
}
},
"name": "string.quoted.other.lt-gt.include.ext"
}
]
},
{
"begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+ # define\n((?<id>[a-zA-Z_$][\\w$]*)) # macro name\n(?:\n (\\()\n (\n \\s* \\g<id> \\s* # first argument\n ((,) \\s* \\g<id> \\s*)* # additional arguments\n (?:\\.\\.\\.)? # varargs ellipsis?\n )\n (\\))\n)?",
"beginCaptures": {
"1": {
"name": "keyword.control.directive.define.c"
},
"2": {
"name": "punctuation.definition.directive.c"
},
"3": {
"name": "entity.name.function.preprocessor.c"
},
"5": {
"name": "punctuation.definition.parameters.begin.c"
},
"6": {
"name": "variable.parameter.preprocessor.c"
},
"8": {
"name": "punctuation.separator.parameters.c"
},
"9": {
"name": "punctuation.definition.parameters.end.c"
}
},
"end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
"name": "meta.preprocessor.macro.ext"
}
],
"repository": {
"line_continuation_character": {
"patterns": [
{
"match": "(\\\\)\\n",
"captures": {
"1": {
"name": "constant.character.escape.line-continuation.c"
}
}
}
]
},
"numbers": {
"patterns": [
{
"match": "\\b((0(x|X)[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)|(0(b|B)[01]([01']*[01])?)|(([0-9]([0-9']*[0-9])?\\.?[0-9]*([0-9']*[0-9])?)|(\\.[0-9]([0-9']*[0-9])?))((e|E)(\\+|-)?[0-9]([0-9']*[0-9])?)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b",
"name": "constant.numeric.ext"
}
]
},
"comments": {
"patterns": [
{
"captures": {
"1": {
"name": "meta.toc-list.banner.block.c"
}
},
"match": "^/\\* =(\\s*.*?)\\s*= \\*/$\\n?",
"name": "comment.block.c"
},
{
"begin": "/\\*",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.begin.c"
}
},
"end": "\\*/",
"endCaptures": {
"0": {
"name": "punctuation.definition.comment.end.c"
}
},
"name": "comment.block.c"
},
{
"match": "\\*/.*\\n",
"name": "invalid.illegal.stray-comment-end.c"
},
{
"captures": {
"1": {
"name": "meta.toc-list.banner.line.c"
}
},
"match": "^// =(\\s*.*?)\\s*=\\s*$\\n?",
"name": "comment.line.banner.cpp"
},
{
"begin": "(^[ \\t]+)?(?=//)",
"beginCaptures": {
"1": {
"name": "punctuation.whitespace.comment.leading.cpp"
}
},
"end": "(?!\\G)",
"patterns": [
{
"begin": "//",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.cpp"
}
},
"end": "(?=\\n)",
"name": "comment.line.double-slash.cpp",
"patterns": [
{
"include": "#line_continuation_character"
}
]
}
]
}
]
},
"strings": {
"patterns": [
{
"begin": "(u|u8|U|L)?\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.ext"
},
"1": {
"name": "meta.encoding.ext"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.ext"
}
},
"name": "string.quoted.double.ext",
"patterns": [
{
"match": "\\\\u\\h{4}|\\\\U\\h{8}",
"name": "constant.character.escape.ext"
},
{
"match": "\\\\['\"?\\\\abfnrtv]",
"name": "constant.character.escape.ext"
},
{
"match": "\\\\[0-7]{1,3}",
"name": "constant.character.escape.ext"
},
{
"match": "\\\\x\\h+",
"name": "constant.character.escape.ext"
}
]
},
{
"begin": "(u|u8|U|L)?R\"(?:([^ ()\\\\\\t]{0,16})|([^ ()\\\\\\t]*))\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.ext"
},
"1": {
"name": "meta.encoding.ext"
},
"3": {
"name": "invalid.illegal.delimiter-too-long.ext"
}
},
"end": "\\)\\2(\\3)\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.ext"
},
"1": {
"name": "invalid.illegal.delimiter-too-long.ext"
}
},
"name": "string.quoted.double.raw.ext"
}
]
}
}
}