{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Calyx",
"patterns": [
{
"include": "#toplevel-keywords"
},
{
"include": "#component-keywords"
},
{
"include": "#control"
},
{
"include": "#strings"
},
{
"include": "#numeric-literals"
},
{
"include": "#comments"
}
],
"repository": {
"toplevel-keywords": {
"patterns": [
{
"match": "\\b(component|primitive|group)\\b\\s+\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b",
"captures": {
"1": {
"name": "keyword.other"
},
"2": {
"name": "support.class"
}
}
},
{
"name": "keyword.control.import",
"match": "import"
},
{
"name": "keyword.control.import",
"match": "extern"
}
]
},
"component-keywords": {
"patterns": [
{
"name": "support.function.calyx",
"match": "\\b(cells|wires|control)\\b"
}
]
},
"control": {
"patterns": [
{
"name": "keyword.control.calyx",
"match": "\\b(seq|par|if|while|else|with|group|invoke|repeat)\\b"
},
{
"name": "keyword.operator",
"match": "\\b(ref|comb|static)\\b"
}
]
},
"strings": {
"name": "string.quoted.double.calyx",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.calyx",
"match": "\\\\."
}
]
},
"numeric-literals": {
"patterns": [
{
"name": "constant.numeric.calyx",
"match": "\\b(\\d+'b[01]+)\\b"
},
{
"name": "constant.numeric.calyx",
"match": "\\b(\\d+'o[0-7]+)\\b"
},
{
"name": "constant.numeric.calyx",
"match": "\\b(\\d+'d\\d+)\\b"
},
{
"name": "constant.numeric.calyx",
"match": "\\b(\\d+'x\\h+)\\b"
},
{
"name": "variable.parameter.calyx",
"match": "\\b(\\d+)\\b"
}
]
},
"comments": {
"patterns": [
{
"name": "comment.line.double-slash.calyx",
"match": "//.*\n"
},
{
"name": "comment.block",
"begin": "/\\*",
"end": "\\*/"
},
{
"name": "entity.other.attribute-name",
"match": "@[a-zA-Z_][a-zA-Z0-9_]*\\b"
}
]
}
},
"scopeName": "source.calyx"
}