Add syntax highlighting
This commit is contained in:
@@ -451,3 +451,12 @@ The caller then needs to push the return value of the call on top of the stack u
|
||||
## Building
|
||||
|
||||
To build WL with your program, just drop the `wl.c` and `wl.h` files in your own source tree and compile them as any other file.
|
||||
|
||||
## Syntax Highlighting
|
||||
|
||||
We have a WL extension for vscode in `ide/vscode/` which offers basic syntax highlighting.
|
||||
|
||||
To install it, drop it in your extension folder and reload vscode. The specific folder depends on your platform:
|
||||
* Windows: `%USERPROFILE%\.vscode\extensions`
|
||||
* macOS: `~/.vscode/extensions`
|
||||
* Linux: `~/.vscode/extensions`
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"comments": {
|
||||
"blockComment": ["<!--", "-->"]
|
||||
},
|
||||
"brackets": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
{ "open": "{", "close": "}" },
|
||||
{ "open": "[", "close": "]" },
|
||||
{ "open": "(", "close": ")" },
|
||||
{ "open": "\"", "close": "\"" },
|
||||
{ "open": "'", "close": "'" }
|
||||
],
|
||||
"surroundingPairs": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""],
|
||||
["'", "'"]
|
||||
],
|
||||
"folding": {
|
||||
"markers": {
|
||||
"start": "^\\s*<!--\\s*#region\\b",
|
||||
"end": "^\\s*<!--\\s*#endregion\\b"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "wl-language",
|
||||
"displayName": "WL Language Support",
|
||||
"description": "Syntax highlighting for WL templating language",
|
||||
"version": "1.0.0",
|
||||
"engines": {
|
||||
"vscode": "^1.60.0"
|
||||
},
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
],
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "wl",
|
||||
"aliases": [
|
||||
"WL",
|
||||
"wl"
|
||||
],
|
||||
"extensions": [
|
||||
".wl"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "wl",
|
||||
"scopeName": "source.wl",
|
||||
"path": "./syntaxes/wl.tmLanguage.json"
|
||||
}
|
||||
],
|
||||
"themes": [
|
||||
{
|
||||
"label": "WL Enhanced",
|
||||
"uiTheme": "vs-dark",
|
||||
"path": "./themes/wl-theme.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
{
|
||||
"name": "WL",
|
||||
"scopeName": "source.wl",
|
||||
"fileTypes": ["wl"],
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#html-tags"
|
||||
},
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#operators"
|
||||
},
|
||||
{
|
||||
"include": "#system-variables"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"comments": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "comment.block.html.wl",
|
||||
"begin": "<!--",
|
||||
"end": "-->",
|
||||
"patterns": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"keywords": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "keyword.control.wl",
|
||||
"match": "\\b(if|else|while|for|in)\\b"
|
||||
},
|
||||
{
|
||||
"name": "keyword.other.wl",
|
||||
"match": "\\b(procedure|let|include)\\b"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.wl",
|
||||
"match": "\\b(len|escape)\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"constants": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.language.wl",
|
||||
"match": "\\b(none|true|false)\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"strings": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "string.quoted.double.wl",
|
||||
"begin": "\"",
|
||||
"end": "\"",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.wl",
|
||||
"match": "\\\\(n|t|r|\"|'|\\\\|x[0-9A-Fa-f]{2})"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "string.quoted.single.wl",
|
||||
"begin": "'",
|
||||
"end": "'",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.wl",
|
||||
"match": "\\\\(n|t|r|\"|'|\\\\|x[0-9A-Fa-f]{2})"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"numbers": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.numeric.float.wl",
|
||||
"match": "\\b[0-9]+\\.[0-9]+\\b"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.integer.wl",
|
||||
"match": "\\b[0-9]+\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
"operators": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "keyword.operator.append.wl",
|
||||
"match": "<<"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.comparison.wl",
|
||||
"match": "(==|!=|<=|>=)"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.relational.wl",
|
||||
"match": "(<|>)"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.assignment.wl",
|
||||
"match": "="
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.arithmetic.wl",
|
||||
"match": "(\\+|-|\\*|/|%)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"system-variables": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "variable.other.system.wl",
|
||||
"match": "\\$[a-zA-Z_][a-zA-Z0-9_]*"
|
||||
}
|
||||
]
|
||||
},
|
||||
"functions": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "entity.name.function.wl",
|
||||
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*(?=\\s*\\()"
|
||||
}
|
||||
]
|
||||
},
|
||||
"html-tags": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "meta.tag.html.wl",
|
||||
"begin": "(<)([a-zA-Z][a-zA-Z0-9]*)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.begin.wl"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.wl"
|
||||
}
|
||||
},
|
||||
"end": "(/>)|(>)",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.self-closing.wl"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.definition.tag.end.wl"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"name": "string.quoted.double.html.wl",
|
||||
"begin": "\"",
|
||||
"end": "\"",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#embedded-expression"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "string.quoted.single.html.wl",
|
||||
"begin": "'",
|
||||
"end": "'",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#embedded-expression"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"include": "#embedded-expression"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "meta.tag.closing.html.wl",
|
||||
"match": "(</)([a-zA-Z][a-zA-Z0-9]*)(>)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.begin.wl"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.wl"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.definition.tag.end.wl"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"embedded-expression": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "meta.embedded.block.wl",
|
||||
"begin": "\\\\\\{",
|
||||
"end": "\\}",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#expression-contents"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "meta.embedded.wl",
|
||||
"begin": "\\\\",
|
||||
"end": "(?=[\\s\"'/>])",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#expression-contents"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"expression-contents": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#operators"
|
||||
},
|
||||
{
|
||||
"include": "#system-variables"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
},
|
||||
{
|
||||
"include": "#brackets"
|
||||
}
|
||||
]
|
||||
},
|
||||
"brackets": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "\\[",
|
||||
"end": "\\]",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#operators"
|
||||
},
|
||||
{
|
||||
"include": "#system-variables"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
},
|
||||
{
|
||||
"include": "#brackets"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "\\{",
|
||||
"end": "\\}",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#operators"
|
||||
},
|
||||
{
|
||||
"include": "#system-variables"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
},
|
||||
{
|
||||
"include": "#brackets"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "\\(",
|
||||
"end": "\\)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#keywords"
|
||||
},
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#numbers"
|
||||
},
|
||||
{
|
||||
"include": "#operators"
|
||||
},
|
||||
{
|
||||
"include": "#system-variables"
|
||||
},
|
||||
{
|
||||
"include": "#functions"
|
||||
},
|
||||
{
|
||||
"include": "#constants"
|
||||
},
|
||||
{
|
||||
"include": "#brackets"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"name": "WL Enhanced",
|
||||
"type": "dark",
|
||||
"colors": {
|
||||
"editor.background": "#1e1e1e",
|
||||
"editor.foreground": "#d4d4d4"
|
||||
},
|
||||
"tokenColors": [
|
||||
{
|
||||
"name": "WL Control Keywords",
|
||||
"scope": "keyword.control.wl",
|
||||
"settings": {
|
||||
"foreground": "#C586C0",
|
||||
"fontStyle": "bold"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL Declaration Keywords (let, include, procedure)",
|
||||
"scope": "keyword.other.wl",
|
||||
"settings": {
|
||||
"foreground": "#569CD6",
|
||||
"fontStyle": "bold"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL Operator Keywords (len, escape)",
|
||||
"scope": "keyword.operator.wl",
|
||||
"settings": {
|
||||
"foreground": "#4EC9B0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL HTML Tags",
|
||||
"scope": "entity.name.tag.wl",
|
||||
"settings": {
|
||||
"foreground": "#4EC9B0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL HTML Tag Punctuation",
|
||||
"scope": "punctuation.definition.tag.wl",
|
||||
"settings": {
|
||||
"foreground": "#808080"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL Constants",
|
||||
"scope": "constant.language.wl",
|
||||
"settings": {
|
||||
"foreground": "#569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL Strings",
|
||||
"scope": "string.quoted.double.wl, string.quoted.single.wl, string.quoted.double.html.wl, string.quoted.single.html.wl",
|
||||
"settings": {
|
||||
"foreground": "#CE9178"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL Numbers",
|
||||
"scope": "constant.numeric.wl",
|
||||
"settings": {
|
||||
"foreground": "#B5CEA8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL System Variables",
|
||||
"scope": "variable.other.system.wl",
|
||||
"settings": {
|
||||
"foreground": "#9CDCFE",
|
||||
"fontStyle": "italic"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL Functions",
|
||||
"scope": "entity.name.function.wl",
|
||||
"settings": {
|
||||
"foreground": "#DCDCAA"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL Operators",
|
||||
"scope": "keyword.operator.wl",
|
||||
"settings": {
|
||||
"foreground": "#D4D4D4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL Append Operator",
|
||||
"scope": "keyword.operator.append.wl",
|
||||
"settings": {
|
||||
"foreground": "#C586C0",
|
||||
"fontStyle": "bold"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL Comments",
|
||||
"scope": "comment.block.html.wl",
|
||||
"settings": {
|
||||
"foreground": "#6A9955",
|
||||
"fontStyle": "italic"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "WL Embedded Expressions",
|
||||
"scope": "meta.embedded.wl",
|
||||
"settings": {
|
||||
"background": "#2d2d30"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user