mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 20:50:13 +01:00
Refactor the textmate grammar to use a different scope for testdata files. Move the existing handling for `CHECK:STDOUT:` there, and add handling for C++ file splits there too. Assisted-by: Gemini via Antigravity
57 lines
1.3 KiB
JSON
57 lines
1.3 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
"name": "carbon-testdata",
|
|
"scopeName": "source.carbon-testdata",
|
|
"fileTypes": [],
|
|
"patterns": [
|
|
{
|
|
"include": "#cpp-file-splits"
|
|
},
|
|
{
|
|
"include": "#check-stdout"
|
|
},
|
|
{
|
|
"include": "source.carbon"
|
|
}
|
|
],
|
|
"repository": {
|
|
"cpp-file-splits": {
|
|
"patterns": [
|
|
{
|
|
"comment": "C++ file split in test files",
|
|
"begin": "^//\\s*---\\s*([^\\s]+\\.(h|hh|hpp|hxx|h\\+\\+|cpp|cc|cxx|c\\+\\+|c|H|HH|HPP|HXX|H\\+\\+|CPP|CC|CXX|C\\+\\+|C))\\s*$",
|
|
"beginCaptures": {
|
|
"0": { "name": "comment.line.carbon" }
|
|
},
|
|
"end": "^(?=//\\s*---)",
|
|
"contentName": "meta.embedded.block.cpp",
|
|
"patterns": [
|
|
{
|
|
"include": "source.cpp"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"check-stdout": {
|
|
"patterns": [
|
|
{
|
|
"comment": "Highlight compile output / SemIR in CHECK:STDOUT lines",
|
|
"begin": "^(\\s*//\\s*CHECK:STDOUT:)",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "comment.line.carbon"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"patterns": [
|
|
{
|
|
"include": "source.carbon-semir"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|