Commit 142225ac authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] improve VSCode syntax highlighting

Change-Id: Iec5d7b2c73b45012d3bc457f0928c7f39afc8815
Reviewed-on: https://chromium-review.googlesource.com/c/1446454
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarSimon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59227}
parent d3425262
......@@ -2,12 +2,6 @@
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Torque",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#strings"
},
{
"name": "comment.line.double-slash.torque",
"begin": "//",
......@@ -19,67 +13,160 @@
"end": "\\*/"
},
{
"name": "string.quoted.single.torque",
"begin": "'",
"end": "'",
"name": "support.function.torque",
"match": "\\b(assert|check|debug|unreachable|Cast|Convert|FromConstexpr|UnsafeCast)\\b"
},
{
"match": "\\b(extends)\\s+([A-Za-z0-9]+)",
"captures": {
"1": {
"name": "keyword.other.torque"
},
"2": {
"name": "support.type"
}
}
},
{
"name": "support.variable.torque",
"match": "\\b(true|True|false|False|Undefined|Hole|Null)\\b"
},
{
"begin": "\\b<(?=[A-Za-z][0-9A-Za-z_|, ]*>)",
"end": ">",
"patterns": [
{
"name": "constant.character.escape.torque",
"match": "\\\\."
}]
"include": "#common"
},
{
"name": "support.type.torque",
"match": "([A-Za-z][0-9A-Za-z_]*)"
}
]
},
{
"name": "support.function.torque",
"match": "\\b(assert|check|debug|unreachable|Cast|Convert|FromConstexpr|UnsafeCast)\\b"
"begin": "\\b(?=extern\\b)",
"end": ";",
"patterns": [
{
"begin": "\\)\\(|(?=(\\b[a-zA-Z0-9_]+)\\((?!\\s*implicit))",
"end": "\\)",
"patterns": [
{
"include": "#common"
},
{
"name": "support.type.torque",
"match": "([A-Za-z][0-9A-Za-z_]*)"
}
]
},
{
"include": "#common"
}
]
},
{
"name": "support.variable.torque",
"match": "\\b(true|True|false|False|Undefined|Hole|Null)\\b"
},
{
"begin": "<(?=[A-Za-z][0-9A-Za-z_]*>)",
"end": ">",
"patterns": [
{
"name": "support.type.torque",
"match": "([A-Za-z][0-9A-Za-z_]*)"
}
]
},
{
"begin": ":(\\s*)?",
"end": "(?=[^0-9A-Za-z_])",
"patterns": [
{
"name": "support.type.torque",
"match": "([A-Za-z][0-9A-Za-z_]*)"
}
]
}
],
"repository": {
"keywords": {
"patterns": [{
"name": "keyword.control.torque",
"match": "\\b(if|else|while|for|return|continue|break|goto|otherwise|try|label|catch)\\b"
},
{
"name": "keyword.other.torque",
"match": "\\b(constexpr|module|macro|builtin|runtime|intrinsic|javascript|implicit|deferred|label|labels|tail|let|generates|type|struct|class|weak|extends|extern|const|typeswitch|case|transient|transitioning)\\b"
{
"begin": "\\b(type)\\b",
"end": ";",
"captures": {
"1": {
"name": "keyword.other.torque"
}
},
{
"name": "keyword.operator.torque",
"match": "\\b(=|\\*=)\\b"
}]
"patterns": [
{
"include": "#common"
},
{
"name": "support.type.torque",
"match": "\\b([A-Za-z][0-9A-Za-z_]*)\\b"
}
]
},
"strings": {
"name": "string.quoted.double.torque",
"begin": "\"",
"end": "\"",
{
"name": "keyword.control.torque",
"match": "#include"
},
{
"include": "#common"
}
],
"repository": {
"common": {
"patterns": [
{
"name": "constant.character.escape.torque",
"match": "\\\\."
"name": "keyword.control.torque",
"match": "\\b(if|else|while|for|return|continue|break|goto|otherwise|try|label|catch)\\b"
},
{
"name": "keyword.other.torque",
"match": "\\b(constexpr|macro|builtin|runtime|intrinsic|javascript|implicit|deferred|label|labels|tail|let|generates|weak|extern|const|typeswitch|case|transient|transitioning|operator|namespace)\\b"
},
{
"name": "keyword.operator.torque",
"match": "\\b(=|\\*=)\\b"
},
{
"match": "\\b(class)\\s+([A-Za-z0-9]+)",
"captures": {
"1": {
"name": "keyword.other.torque"
},
"2": {
"name": "support.type"
}
}
},
{
"match": "\\b(struct)\\s+([A-Za-z0-9]+)",
"captures": {
"1": {
"name": "keyword.other.torque"
},
"2": {
"name": "support.type"
}
}
},
{
"name": "string.quoted.double.torque",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.torque",
"match": "\\\\."
}
]
},
{
"name": "string.quoted.single.torque",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.torque",
"match": "\\\\."
}
]
},
{
"begin": ":(\\s*)?",
"end": "(?=(generates|[^0-9A-Za-z_| ]))",
"patterns": [
{
"include": "#common"
},
{
"name": "support.type.torque",
"match": "([A-Za-z][0-9A-Za-z_]*)"
}
]
},
{
"name": "support.function.torque",
"match": "\\b[A-Za-z0-9_]+\\b(?=(<[ ,:A-Za-z0-9_]+>)?\\()"
}
]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment