233 lines
5.2 KiB
JSON
233 lines
5.2 KiB
JSON
{
|
|
"name": "Bob",
|
|
"scopeName": "source.bob",
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#strings"
|
|
},
|
|
{
|
|
"include": "#numbers"
|
|
},
|
|
{
|
|
"include": "#arrays"
|
|
},
|
|
{
|
|
"include": "#keywords"
|
|
},
|
|
{
|
|
"include": "#functions"
|
|
},
|
|
{
|
|
"include": "#variables"
|
|
},
|
|
{
|
|
"include": "#operators"
|
|
}
|
|
],
|
|
"repository": {
|
|
"comments": {
|
|
"patterns": [
|
|
{
|
|
"name": "comment.line.double-slash.bob",
|
|
"match": "//.*$"
|
|
},
|
|
{
|
|
"name": "comment.block.bob",
|
|
"begin": "/\\*",
|
|
"end": "\\*/"
|
|
}
|
|
]
|
|
},
|
|
"strings": {
|
|
"patterns": [
|
|
{
|
|
"name": "string.quoted.double.bob",
|
|
"begin": "\"",
|
|
"end": "\"",
|
|
"patterns": [
|
|
{
|
|
"name": "constant.character.escape.bob",
|
|
"match": "\\\\[nt\"\\\\e]"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "string.quoted.single.bob",
|
|
"begin": "'",
|
|
"end": "'",
|
|
"patterns": [
|
|
{
|
|
"name": "constant.character.escape.bob",
|
|
"match": "\\\\[nt'\\\\e]"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"numbers": {
|
|
"patterns": [
|
|
{
|
|
"name": "constant.numeric.integer.bob",
|
|
"match": "\\b\\d+\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.float.bob",
|
|
"match": "\\b\\d+\\.\\d+\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.binary.bob",
|
|
"match": "\\b0b[01]+\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.hex.bob",
|
|
"match": "\\b0x[0-9a-fA-F]+\\b"
|
|
}
|
|
]
|
|
},
|
|
"arrays": {
|
|
"patterns": [
|
|
{
|
|
"name": "meta.array.bob",
|
|
"begin": "\\[",
|
|
"end": "\\]",
|
|
"patterns": [
|
|
{
|
|
"include": "#expressions"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "variable.other.array-index.bob",
|
|
"match": "([a-zA-Z_][a-zA-Z0-9_]*)\\[([^\\]]+)\\]",
|
|
"captures": {
|
|
"1": { "name": "variable.other.bob" },
|
|
"2": { "name": "constant.numeric.integer.bob" }
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"keywords": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.control.bob",
|
|
"match": "\\b(if|else|while|do|for|break|continue|return|var|func)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.operator.bob",
|
|
"match": "\\b(and|or|not)\\b"
|
|
},
|
|
{
|
|
"name": "constant.language.bob",
|
|
"match": "\\b(true|false|none)\\b"
|
|
}
|
|
]
|
|
},
|
|
"functions": {
|
|
"patterns": [
|
|
{
|
|
"name": "entity.name.function.bob",
|
|
"match": "\\b(func)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
|
|
"captures": {
|
|
"1": { "name": "keyword.control.bob" },
|
|
"2": { "name": "entity.name.function.bob" }
|
|
}
|
|
},
|
|
{
|
|
"name": "support.function.builtin.bob",
|
|
"match": "\\b(print|assert|input|type|toString|toNumber|toInt|time|sleep|printRaw|len|push|pop|random|eval)\\b"
|
|
}
|
|
]
|
|
},
|
|
"variables": {
|
|
"patterns": [
|
|
{
|
|
"name": "variable.other.bob",
|
|
"match": "\\bvar\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
|
|
"captures": {
|
|
"1": { "name": "keyword.control.bob" },
|
|
"2": { "name": "variable.other.bob" }
|
|
}
|
|
},
|
|
{
|
|
"name": "variable.other.bob",
|
|
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(?=\\s*=)",
|
|
"captures": {
|
|
"1": { "name": "variable.other.bob" }
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"operators": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.operator.increment.bob",
|
|
"match": "\\+\\+|--"
|
|
},
|
|
{
|
|
"name": "keyword.operator.compound.bob",
|
|
"match": "\\+=|-=|\\*=|/=|%=|&=|\\|=|\\^=|<<=|>>="
|
|
},
|
|
{
|
|
"name": "keyword.operator.comparison.bob",
|
|
"match": "==|!=|<=|>="
|
|
},
|
|
{
|
|
"name": "keyword.operator.logical.bob",
|
|
"match": "&&|\\|\\||!"
|
|
},
|
|
{
|
|
"name": "keyword.operator.bitwise.bob",
|
|
"match": "<<|>>|&|\\||\\^|~"
|
|
},
|
|
{
|
|
"name": "keyword.operator.arithmetic.bob",
|
|
"match": "\\+|-|\\*|/|%"
|
|
},
|
|
{
|
|
"name": "keyword.operator.comparison.bob",
|
|
"match": "<|>"
|
|
},
|
|
{
|
|
"name": "keyword.operator.assignment.bob",
|
|
"match": "="
|
|
},
|
|
{
|
|
"name": "keyword.operator.punctuation.bob",
|
|
"match": "\\(|\\)|\\{|\\}|\\[|\\]|,|;|\\."
|
|
},
|
|
{
|
|
"name": "keyword.operator.conditional.bob",
|
|
"match": "\\?|:"
|
|
}
|
|
]
|
|
},
|
|
"expressions": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#strings"
|
|
},
|
|
{
|
|
"include": "#numbers"
|
|
},
|
|
{
|
|
"include": "#keywords"
|
|
},
|
|
{
|
|
"include": "#functions"
|
|
},
|
|
{
|
|
"include": "#variables"
|
|
},
|
|
{
|
|
"include": "#operators"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
} |