Start adding syntax highlighting
This commit is contained in:
parent
314f44304a
commit
0ba25db4c8
@ -1,12 +1,13 @@
|
|||||||
// Main
|
a
|
||||||
fn main() -> bool {
|
(
|
||||||
return 144 == fibonacci(0xc);
|
b
|
||||||
}
|
)
|
||||||
|
x
|
||||||
// Fibonacci
|
(
|
||||||
fn fibonacci(value: u16) -> u16 {
|
(
|
||||||
if value <= 2 {
|
c
|
||||||
return 1;
|
xyz
|
||||||
}
|
)
|
||||||
fibonacci(value - 1) + fibonacci(value - 2)
|
)
|
||||||
}
|
(
|
||||||
|
a
|
||||||
|
@ -43,11 +43,18 @@
|
|||||||
"description": "Traces the communication between VS Code and the language server."
|
"description": "Traces the communication between VS Code and the language server."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"grammars": [
|
||||||
|
{
|
||||||
|
"language": "reid",
|
||||||
|
"scopeName": "source.reid",
|
||||||
|
"path": "./syntaxes/grammar.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"vscode:prepublish": "pnpm run package",
|
"vscode:prepublish": "pnpm run package",
|
||||||
"compile": "webpack",
|
"compile": "npx js-yaml syntaxes/grammar.yaml > syntaxes/grammar.json && webpack",
|
||||||
"watch": "webpack --watch",
|
"watch": "webpack --watch",
|
||||||
"package": "webpack --mode production --devtool hidden-source-map",
|
"package": "webpack --mode production --devtool hidden-source-map",
|
||||||
"compile-tests": "tsc -p . --outDir out",
|
"compile-tests": "tsc -p . --outDir out",
|
||||||
@ -65,6 +72,7 @@
|
|||||||
"@vscode/test-cli": "^0.0.11",
|
"@vscode/test-cli": "^0.0.11",
|
||||||
"@vscode/test-electron": "^2.5.2",
|
"@vscode/test-electron": "^2.5.2",
|
||||||
"eslint": "^9.25.1",
|
"eslint": "^9.25.1",
|
||||||
|
"js-yaml": "^4.1.0",
|
||||||
"ts-loader": "^9.5.2",
|
"ts-loader": "^9.5.2",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"webpack": "^5.99.7",
|
"webpack": "^5.99.7",
|
||||||
|
44
reid-lsp/syntaxes/grammar.json
Normal file
44
reid-lsp/syntaxes/grammar.json
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"scopeName": "source.reid",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#expression"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"expression": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#letter"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"include": "#paren-expression"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"letter": {
|
||||||
|
"match": "a|b|c",
|
||||||
|
"name": "keyword.letter"
|
||||||
|
},
|
||||||
|
"paren-expression": {
|
||||||
|
"begin": "\\(",
|
||||||
|
"end": "\\)",
|
||||||
|
"beginCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.paren.open"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"endCaptures": {
|
||||||
|
"0": {
|
||||||
|
"name": "punctuation.paren.close"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "expression.group",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#expression"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
reid-lsp/syntaxes/grammar.yaml
Normal file
23
reid-lsp/syntaxes/grammar.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
scopeName: source.reid
|
||||||
|
patterns:
|
||||||
|
- include: "#expression"
|
||||||
|
repository:
|
||||||
|
expression:
|
||||||
|
patterns:
|
||||||
|
- include: "#letter"
|
||||||
|
- include: "#paren-expression"
|
||||||
|
letter:
|
||||||
|
match: "a|b|c"
|
||||||
|
name: "keyword.letter"
|
||||||
|
paren-expression:
|
||||||
|
begin: "\\("
|
||||||
|
end: "\\)"
|
||||||
|
beginCaptures:
|
||||||
|
0:
|
||||||
|
name: "punctuation.paren.open"
|
||||||
|
endCaptures:
|
||||||
|
0:
|
||||||
|
name: "punctuation.paren.close"
|
||||||
|
name: "expression.group"
|
||||||
|
patterns:
|
||||||
|
- include: "#expression"
|
Loading…
Reference in New Issue
Block a user