Commit 79faf99b authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[torque] Improve syntax highlighting

This CL fixes an issue where a comment was not highlighted correctly
after a class definition.

Bug: v8:7793
Notry: true
Change-Id: I378a1373c8f4a6c8d48c4bb2ee4a4c3b39b2341f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1585733Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Auto-Submit: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61067}
parent 9ffacb58
......@@ -41,13 +41,13 @@
"torque.trace.server": {
"type": "string",
"enum": [
"off",
"messages",
"verbose"
"off",
"messages",
"verbose"
],
"default": "off",
"description": "Trace the communication with the Torque language server from VSCode."
}
}
}
},
"languages": [
......
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Torque",
"patterns": [
{
"name": "comment.line.double-slash.torque",
"begin": "//",
"end": "$"
},
{
"name": "comment.block.torque",
"begin": "/\\*",
"end": "\\*/"
},
{
"name": "support.function.torque",
"match": "\\b(assert|check|debug|unreachable|Cast|Convert|FromConstexpr|UnsafeCast)\\b"
},
{
"name": "constant.other.torque",
"match": "\\b(true|True|false|False|Undefined|Hole|Null|k[A-Z][A-Za-z0-9]+)\\b"
},
{
"begin": "\\b<(?=[A-Za-z][0-9A-Za-z_|, ]*>)",
"end": ">",
"patterns": [
{
"include": "#common"
},
{
"name": "support.type.torque",
"match": "([A-Za-z][0-9A-Za-z_]*)"
}
]
},
{
"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"
}
]
},
{
"begin": "\\b(type)\\b",
"end": ";",
"captures": {
"1": {
"name": "keyword.other.torque"
}
},
"patterns": [
{
"include": "#common"
},
{
"name": "support.type.torque",
"match": "\\b([A-Za-z][0-9A-Za-z_]*)\\b"
}
]
},
{
"name": "keyword.control.torque",
"match": "#include"
},
{
"include": "#common"
}
],
"repository": {
"common": {
"patterns": [
{
"match": "\\b(extends)\\s+([A-Za-z0-9]+)",
"captures": {
"1": {
"name": "keyword.other.torque"
},
"2": {
"name": "support.type.torque"
}
}
},
{
"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.torque"
}
}
},
{
"match": "\\b(struct)\\s+([A-Za-z0-9]+)",
"captures": {
"1": {
"name": "keyword.other.torque"
},
"2": {
"name": "support.type.torque"
}
}
},
{
"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_]+>)?\\()"
}
]
}
},
"scopeName": "source.torque"
}
\ No newline at end of file
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Torque",
"patterns": [
{
"name": "comment.line.double-slash.torque",
"begin": "//",
"end": "$"
},
{
"name": "comment.block.torque",
"begin": "/\\*",
"end": "\\*/"
},
{
"name": "support.function.torque",
"match": "\\b(assert|check|debug|unreachable|Cast|Convert|FromConstexpr|UnsafeCast)\\b"
},
{
"name": "constant.other.torque",
"match": "\\b(true|True|false|False|Undefined|Hole|Null|k[A-Z][A-Za-z0-9]+)\\b"
},
{
"begin": "\\b<(?=[A-Za-z][0-9A-Za-z_|, ]*>)",
"end": ">",
"patterns": [
{
"include": "#common"
},
{
"name": "support.type.torque",
"match": "([A-Za-z][0-9A-Za-z_]*)"
}
]
},
{
"begin": "\\b(?=(macro|runtime|builtin)\\b)",
"end": ";|\\{",
"patterns": [
{
"begin": "\\(",
"end": "\\)",
"patterns": [
{
"include": "#common"
},
{
"match": "(([A-Za-z][0-9A-Za-z_]*):\\s*)?([A-Za-z][0-9A-Za-z_]*)",
"captures":{
"3": {"name": "support.type.torque"}
}
}
]
},
{
"include": "#common"
}
]
},
{
"begin": "\\b(type)\\b",
"end": ";",
"captures": {
"1": {
"name": "keyword.other.torque"
}
},
"patterns": [
{
"include": "#common"
},
{
"name": "support.type.torque",
"match": "\\b([A-Za-z][0-9A-Za-z_]*)\\b"
}
]
},
{
"name": "keyword.control.torque",
"match": "#include"
},
{
"include": "#common"
}
],
"repository": {
"common": {
"patterns": [
{
"match": "\\b(extends)\\s+([A-Za-z0-9]+)",
"captures": {
"1": {
"name": "keyword.other.torque"
},
"2": {
"name": "support.type.torque"
}
}
},
{
"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.torque"
}
}
},
{
"match": "\\b(struct)\\s+([A-Za-z0-9]+)",
"captures": {
"1": {
"name": "keyword.other.torque"
},
"2": {
"name": "support.type.torque"
}
}
},
{
"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_]+>)?\\()"
}
]
}
},
"scopeName": "source.torque"
}
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