commit
ce0cacbbf6
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "spade_higlighting",
|
||||
"version": "0.1.0",
|
||||
"publisher": "elfein",
|
||||
"displayName": "Spade Syntax Highlighting",
|
||||
"description": "Highlighting for the Spade hardware descriptor language.",
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
],
|
||||
"engines": {
|
||||
"vscode": "^1.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"spade",
|
||||
"hdl",
|
||||
"hardware",
|
||||
"rust"
|
||||
],
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "Spade",
|
||||
"extensions": [
|
||||
".spade"
|
||||
]
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "Spade",
|
||||
"scopeName": "source.spade",
|
||||
"path": "./syntaxes/spade.tmGrammar.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,337 @@
|
|||
{
|
||||
"name": "Spade",
|
||||
"scopeName": "source.spade",
|
||||
"fileTypes": [
|
||||
"spade"
|
||||
],
|
||||
"repository": {
|
||||
"block_comment": {
|
||||
"comment": "Block comment",
|
||||
"name": "comment.block.spade",
|
||||
"begin": "/\\*",
|
||||
"end": "\\*/",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block_doc_comment"
|
||||
},
|
||||
{
|
||||
"include": "#block_comment"
|
||||
}
|
||||
]
|
||||
},
|
||||
"line_comment": {
|
||||
"comment": "Single-line comment",
|
||||
"name": "comment.line.double-slash.spade",
|
||||
"begin": "//",
|
||||
"end": "$"
|
||||
},
|
||||
"escaped_character": {
|
||||
"name": "constant.character.escape.spade",
|
||||
"match": "\\\\(x\\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)"
|
||||
},
|
||||
"string_literal": {
|
||||
"comment": "Double-quote string literal",
|
||||
"name": "string.quoted.double.spade",
|
||||
"begin": "b?\"",
|
||||
"end": "\"",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#escaped_character"
|
||||
}
|
||||
]
|
||||
},
|
||||
"raw_string_literal": {
|
||||
"comment": "Raw double-quote string literal",
|
||||
"name": "string.quoted.double.raw.spade",
|
||||
"begin": "b?r(#*)\"",
|
||||
"end": "\"\\1"
|
||||
},
|
||||
"sigils": {
|
||||
"comment": "Sigil",
|
||||
"name": "keyword.operator.sigil.rust",
|
||||
"match": "[&*](?=[a-zA-Z0-9_\\(\\[\\|\\\"]+)"
|
||||
},
|
||||
"label": {
|
||||
"comment": "Label",
|
||||
"name": "storage.modifier.lifetime.spade",
|
||||
"match": "'([a-zA-Z_][a-zA-Z0-9_]*)\\b",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.name.label.spade"
|
||||
}
|
||||
}
|
||||
},
|
||||
"core_types": {
|
||||
"comment": "Built-in/core type",
|
||||
"name": "storage.type.core.spade",
|
||||
"match": "\\b(bool|int|bitvector|bit|Option)\\b"
|
||||
},
|
||||
"core_vars": {
|
||||
"comment": "Core type variant",
|
||||
"name": "support.constant.core.spade",
|
||||
"match": "\\b(Some|None)\\b"
|
||||
},
|
||||
"reset": {
|
||||
"comment": "Reset declaration",
|
||||
"name": "keyword.other.spade",
|
||||
"match": "\\breset\\b"
|
||||
},
|
||||
"stage": {
|
||||
"comment": "Stage declaration",
|
||||
"name": "keyword.other.spade",
|
||||
"match": "\\bstage\\b"
|
||||
},
|
||||
"piepline": {
|
||||
"comment": "Pipeline declaration",
|
||||
"name": "keyword.other.spade",
|
||||
"match": "\\bpipeline\\b"
|
||||
},
|
||||
"type_params": {
|
||||
"comment": "Type parameters",
|
||||
"name": "meta.type_params.spade",
|
||||
"begin": "<(?![=<])",
|
||||
"end": ">",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block_comment"
|
||||
},
|
||||
{
|
||||
"include": "#line_comment"
|
||||
},
|
||||
{
|
||||
"include": "#sigils"
|
||||
},
|
||||
{
|
||||
"include": "#label"
|
||||
},
|
||||
{
|
||||
"include": "#core_types"
|
||||
},
|
||||
{
|
||||
"include": "#reset"
|
||||
},
|
||||
{
|
||||
"include": "#stage"
|
||||
},
|
||||
{
|
||||
"include": "#pipeline"
|
||||
},
|
||||
{
|
||||
"include": "#type_params"
|
||||
},
|
||||
{
|
||||
"include": "#number"
|
||||
}
|
||||
]
|
||||
},
|
||||
"decimal_literal": {
|
||||
"comment": "Integer literal (decimal)",
|
||||
"name": "constant.numeric.integer.decimal.spade",
|
||||
"match": "\\b[0-9][0-9_]*\\b"
|
||||
},
|
||||
"hexadecimal_literal": {
|
||||
"comment": "Integer literal (hexadecimal)",
|
||||
"name": "constant.numeric.integer.hexadecimal.spade",
|
||||
"match": "\\b0x[a-fA-F0-9_]+\\b"
|
||||
},
|
||||
"octal_literal": {
|
||||
"comment": "Integer literal (octal)",
|
||||
"name": "constant.numeric.integer.octal.spade",
|
||||
"match": "\\b0o[0-7_]+\\b"
|
||||
},
|
||||
"binary_literal": {
|
||||
"comment": "Integer literal (binary)",
|
||||
"name": "constant.numeric.integer.binary.spade",
|
||||
"match": "\\b0b[01_]+\\b"
|
||||
},
|
||||
"number": {
|
||||
"comment": "Any integer literal",
|
||||
"name": "constant.numeric.integer.spade",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#decimal_literal"
|
||||
},
|
||||
{
|
||||
"include": "#hexadecimal_literal"
|
||||
},
|
||||
{
|
||||
"include": "#octal_literal"
|
||||
},
|
||||
{
|
||||
"include": "#binary_literal"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block_comment"
|
||||
},
|
||||
{
|
||||
"include": "#line_comment"
|
||||
},
|
||||
{
|
||||
"include": "#number"
|
||||
},
|
||||
{
|
||||
"comment": "Attribute",
|
||||
"name": "meta.attribute.spade",
|
||||
"begin": "#\\!?\\[",
|
||||
"end": "\\]",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string_literal"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "Single-quote string literal (character)",
|
||||
"name": "string.quoted.single.spade",
|
||||
"match": "b?'([^'\\\\]|\\\\(x\\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.))'"
|
||||
},
|
||||
{
|
||||
"include": "#string_literal"
|
||||
},
|
||||
{
|
||||
"include": "#raw_string_literal"
|
||||
},
|
||||
{
|
||||
"comment": "Boolean constant",
|
||||
"name": "constant.language.boolean.spade",
|
||||
"match": "\\b(true|false)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "Control keyword",
|
||||
"name": "keyword.control.spade",
|
||||
"match": "\\b(reset|inst|match|if|else)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "Keyword",
|
||||
"name": "keyword.other.spade",
|
||||
"match": "\\b(reg|mod|let|assert|use|super|as)\\b"
|
||||
},
|
||||
{
|
||||
"comment": "Unsafe code keyword",
|
||||
"name": "keyword.other.unsafe.spade",
|
||||
"match": "\\bunsafe\\b"
|
||||
},
|
||||
{
|
||||
"include": "#sigils"
|
||||
},
|
||||
{
|
||||
"include": "#label"
|
||||
},
|
||||
{
|
||||
"comment": "Miscellaneous operator",
|
||||
"name": "keyword.operator.misc.spade",
|
||||
"match": "(=>|::|\\bas\\b)"
|
||||
},
|
||||
{
|
||||
"comment": "Comparison operator",
|
||||
"name": "keyword.operator.comparison.spade",
|
||||
"match": "(&&|\\|\\||==|!=)"
|
||||
},
|
||||
{
|
||||
"comment": "Assignment operator",
|
||||
"name": "keyword.operator.assignment.spade",
|
||||
"match": "(\\+=|-=|/=|\\*=|%=|\\^=|&=|\\|=|<<=|>>=|=)"
|
||||
},
|
||||
{
|
||||
"comment": "Arithmetic operator",
|
||||
"name": "keyword.operator.arithmetic.spade",
|
||||
"match": "(!|\\+|-|/|\\*|%|\\^|&|\\||<<|>>)"
|
||||
},
|
||||
{
|
||||
"comment": "Comparison operator (second group because of regex precedence)",
|
||||
"name": "keyword.operator.comparison.spade",
|
||||
"match": "(<=|>=|<|>)"
|
||||
},
|
||||
{
|
||||
"include": "#core_types"
|
||||
},
|
||||
{
|
||||
"include": "#core_vars"
|
||||
},
|
||||
{
|
||||
"include": "#reset"
|
||||
},
|
||||
{
|
||||
"include": "#stage"
|
||||
},
|
||||
{
|
||||
"include": "#pipeline"
|
||||
},
|
||||
{
|
||||
"comment": "Function call",
|
||||
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.name.function.spade"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"comment": "Function/entity definition",
|
||||
"begin": "\\b(fn|entity)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
|
||||
"end": "[\\{;]",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.other.fn.spade"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.function.spade"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block_comment"
|
||||
},
|
||||
{
|
||||
"include": "#line_comment"
|
||||
},
|
||||
{
|
||||
"include": "#sigils"
|
||||
},
|
||||
{
|
||||
"include": "#label"
|
||||
},
|
||||
{
|
||||
"include": "#core_types"
|
||||
},
|
||||
{
|
||||
"include": "#reset"
|
||||
},
|
||||
{
|
||||
"include": "#stage"
|
||||
},
|
||||
{
|
||||
"include": "#pipeline"
|
||||
},
|
||||
{
|
||||
"include": "#type_params"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"comment": "Type declaration",
|
||||
"begin": "\\b(enum|struct)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
|
||||
"end": "[\\{\\(;]",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.type.spade"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.type.spade"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block_comment"
|
||||
},
|
||||
{
|
||||
"include": "#line_comment"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue