语法高亮修复
yjhmelody opened this issue · 0 comments
yjhmelody commented
之前数字字面量后缀没有正常匹配
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "DolphinDB",
"scopeName": "source.dolphindb",
"fileTypes": [
"dos",
"dp",
"txt"
],
"patterns": [
{
"match": "\\.\\.\\.",
"name": "invalid.ellipsis.dolphindb"
},
{
"include": "#keywords"
},
{
"include": "#literals"
},
{
"include": "#comment"
},
{
"include": "#variable"
},
{
"include": "#operators"
},
{
"include": "#method_calls"
},
{
"include": "#function_calls"
},
{
"include": "#properties"
},
{
"match": "(?<=^|\\s|\\s\\*\\s)@testing",
"name": "storage.type.annotation.dolphindb"
},
{
"match": ";",
"name": "punctuation.terminator.statement.dolphindb"
},
{
"match": ",",
"name": "punctuation.separator.commma.dolphindb"
}
],
"repository": {
"keywords": {
"patterns": [
{
"match": "\\b(?<![\\.\\$])(as|asc|assert|break|by|catch|context|const|continue|def|delete|desc|do|else|exec|for|form|from|group|having|if|in|insert|into|mapr|module|mutable|null|order|pivot|return|select|set|share|throw|timer|top|try|update|use|where|while|(?<=for)\\s+own)(?!\\s*:)\\b",
"name": "keyword.control.dolphindb"
}
]
},
"literals": {
"patterns": [
{
"include": "#constLiterals"
},
{
"include": "#DateLiterals"
},
{
"include": "#stringLiterals"
},
{
"include": "#numberLiterals"
}
]
},
"constLiterals": {
"patterns": [
{
"match": "\\b(true|false|NULL|VAR|GLOBAL|DEF|HEAD|CURRENT|TAIL|LINE|PIE|COLUMN|BAR|AREA|HISTOGRAM|SCATTER|SCALAR|PAIR|VECTOR|MATRIX|SET|DICT|TABLE|VOID|BOOL|CHAR|SHORT|OBJECT|DICTIONARY|INT|INDEX|LONG|DATE|MONTH|TIME|MINUTE|FUNCTIONDEF|STRING|SYMBOL|DOUBLE|FLOAT|TIMESTAMP|DATETIME|ANY|HANDLE|SHARED|NANOTIME|NANOTIMESTAMP|SECOND|TABLE_READ|TABLE_WRITE|DBOBJ_CREATE|DBOBJ_DELETE|DB_MANAGE|VIEW_EXEC|SCRIPT_EXEC|TEST_EXEC|HASH|HASH_PTN|COMPO)\\b",
"name": "constant.language.int.dolphindb"
}
]
},
"DateLiterals": {
"patterns": [
{
"match": "\\b[0-9]{4}[.][0-9]{2}([M]|[.][0-9]{2})\\b",
"name": "constant.language.month.dolphindb"
},
{
"match": "\\b[0-9]{4}[.][0-9]{2}[.][0-9]{2}[T ][0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{3,9})?\\b",
"name": "constant.language.dateTime.dolphindb"
},
{
"match": "\\b[0-9]{2}:[0-9]{2}:[0-9]{2}([.][0-9]{3,9})?\\b",
"name": "constant.language.time.dolphindb"
},
{
"match": "\\b[0-9]{2}:[0-9]{2}m\\b",
"name": "constant.language.minute.dolphindb"
}
]
},
"stringLiterals": {
"patterns": [
{
"include": "#single_quoted_string"
},
{
"include": "#double_quoted_string"
},
{
"begin": "'''",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.dolphindb"
}
},
"end": "'''",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.dolphindb"
}
},
"name": "string.quoted.single.heredoc.dolphindb",
"patterns": [
{
"captures": {
"1": {
"name": "punctuation.definition.escape.backslash.dolphindb"
}
},
"match": "(\\\\).",
"name": "constant.character.escape.backslash.dolphindb"
}
]
},
{
"begin": "\"\"\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.dolphindb"
}
},
"end": "\"\"\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.dolphindb"
}
},
"name": "string.quoted.double.heredoc.dolphindb",
"patterns": [
{
"captures": {
"1": {
"name": "punctuation.definition.escape.backslash.dolphindb"
}
},
"match": "(\\\\).",
"name": "constant.character.escape.backslash.dolphindb"
},
{
"include": "#interpolated_dolphindb"
}
]
},
{
"match": "`[\\w@]+",
"name": "string.quoted.other.dolphindb"
},
{
"match": "(`)(.*)(`)",
"name": "string.quoted.script.dolphindb",
"captures": {
"1": {
"name": "punctuation.definition.string.begin.dolphindb"
},
"2": {
"name": "source.js.embedded.dolphindb",
"patterns": [
{
"include": "source.js"
}
]
},
"3": {
"name": "punctuation.definition.string.end.dolphindb"
}
}
}
]
},
"single_quoted_string": {
"patterns": [
{
"begin": "'",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.dolphindb"
}
},
"end": "'",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.dolphindb"
}
},
"name": "string.quoted.single.dolphindb",
"patterns": [
{
"captures": {
"1": {
"name": "punctuation.definition.escape.backslash.dolphindb"
}
},
"match": "(\\\\)(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)",
"name": "constant.character.escape.backslash.dolphindb"
}
]
}
]
},
"double_quoted_string": {
"patterns": [
{
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.begin.dolphindb"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.end.dolphindb"
}
},
"name": "string.quoted.double.dolphindb",
"patterns": [
{
"captures": {
"1": {
"name": "punctuation.definition.escape.backslash.dolphindb"
}
},
"match": "(\\\\)(x[0-9A-Fa-f]{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)",
"name": "constant.character.escape.backslash.dolphindb"
},
{
"include": "#interpolated_dolphindb"
}
]
}
]
},
"numberLiterals": {
"patterns": [
{
"match": "\\b[0-9]+[.]?[0-9]*[eE][+-]?[0-9]+[f]?\\b",
"name": "constant.numeric.float.dolphindb"
},
{
"match": "\\b[0-9]+[.]?[0-9]*[f]?\\b",
"name": "constant.numeric.float.dolphindb"
},
{
"match": "\\b[01]b\\b",
"name": "constant.numeric.binary.dolphindb"
},
{
"match": "\\b[0-9]+[lhc]?\\b",
"name": "constant.numeric.decimal.dolphindb"
}
]
},
"function_calls": {
"patterns": [
{
"begin": "(@)?([\\w$]+)[!]?(?=\\()",
"beginCaptures": {
"1": {
"name": "variable.other.readwrite.instance.dolphindb"
},
"2": {
"patterns": [
{
"include": "#function_names"
}
]
}
},
"end": "(?<=\\))",
"name": "meta.function-call.dolphindb",
"patterns": [
{
"include": "#arguments"
}
]
}
]
},
"function_names": {
"patterns": [
{
"match": "[a-zA-Z_$][\\w$]*",
"name": "entity.name.function.dolphindb"
},
{
"match": "\\d[\\w$]*",
"name": "invalid.illegal.identifier.dolphindb"
}
]
},
"function_params": {
"patterns": [
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.parameters.begin.bracket.round.dolphindb"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.parameters.end.bracket.round.dolphindb"
}
},
"name": "meta.parameters.dolphindb",
"patterns": [
{
"include": "#variable"
},
{
"match": "(@(?:[a-zA-Z_$][\\w$]*)?)(\\.\\.\\.)?",
"captures": {
"1": {
"name": "variable.parameter.function.readwrite.instance.dolphindb"
},
"2": {
"name": "keyword.operator.splat.dolphindb"
}
}
},
{
"include": "$self"
}
]
}
]
},
"comment": {
"patterns": [
{
"begin": "/\\*",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.dolphindb"
}
},
"end": "\\*/",
"endCaptures": {
"0": {
"name": "punctuation.definition.comment.dolphindb"
}
},
"name": "comment.block.dolphindb",
"patterns": [
{
"match": "(?<=^|\\s|\\s\\*\\s)@\\w*(?=\\s)",
"name": "storage.type.annotation.dolphindb"
}
]
},
{
"begin": "//",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.dolphindb"
}
},
"end": "$",
"name": "comment.line.number-sign.dolphindb"
}
]
},
"arguments": {
"patterns": [
{
"begin": "\\(",
"beginCaptures": {
"0": {
"name": "punctuation.definition.arguments.begin.bracket.round.dolphindb"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "punctuation.definition.arguments.end.bracket.round.dolphindb"
}
},
"name": "meta.arguments.dolphindb",
"patterns": [
{
"include": "$self"
},
{
"include": "#literals"
},
{
"include": "#variable"
}
]
}
]
},
"variable": {
"patterns": [
{
"match": "(@)([a-zA-Z_\\$]\\w*)?",
"name": "variable.other.readwrite.instance.dolphindb"
}
]
},
"interpolated_dolphindb": {
"patterns": [
{
"begin": "\\#\\{",
"captures": {
"0": {
"name": "punctuation.section.embedded.dolphindb"
}
},
"end": "\\}",
"name": "source.dolphindb.embedded.source",
"patterns": [
{
"include": "$self"
}
]
}
]
},
"method_calls": {
"patterns": [
{
"begin": "(?:(\\.)|(::))\\s*([\\w$]+)\\s*(?=\\()",
"beginCaptures": {
"1": {
"name": "punctuation.separator.method.period.dolphindb"
},
"2": {
"name": "keyword.operator.prototype.dolphindb"
},
"3": {
"patterns": [
{
"include": "#method_names"
}
]
}
},
"end": "(?<=\\))",
"name": "meta.method-call.dolphindb",
"patterns": [
{
"include": "#arguments"
}
]
}
]
},
"method_names": {
"patterns": [
{
"match": "[a-zA-Z_$][\\w$]*",
"name": "entity.name.function.dolphindb"
},
{
"match": "\\d[\\w$]*",
"name": "invalid.illegal.identifier.dolphindb"
}
]
},
"operators": {
"patterns": [
{
"match": "<<|>>",
"name": "keyword.operator.bitwise.shift.dolphindb"
},
{
"match": "!=|<=|>=|==",
"name": "keyword.operator.comparison.dolphindb"
},
{
"match": "&&|!|\\|\\|",
"name": "keyword.operator.logical.dolphindb"
},
{
"match": "&|\\||\\^",
"name": "keyword.operator.bitwise.dolphindb"
},
{
"match": "\\.\\.",
"name": "keyword.operator.splat.dolphindb"
},
{
"match": "\\?",
"name": "keyword.operator.existential.dolphindb"
},
{
"match": "/|<-|%|\\*|/|-|\\$|\\+",
"name": "keyword.operator.dolphindb"
},
{
"match": "([a-zA-Z$_][\\w$]*)?\\s*(=|:(?!:))(?![>=])",
"captures": {
"1": {
"name": "variable.assignment.dolphindb"
},
"2": {
"name": "keyword.operator.assignment.dolphindb"
}
}
}
]
},
"properties": {
"patterns": [
{
"match": "(?:(\\.)|(::))\\s*([A-Z][A-Z0-9_$]*\\b\\$*)(?=\\s*\\??(\\.\\s*[a-zA-Z_$]\\w*|::))",
"captures": {
"1": {
"name": "punctuation.separator.property.period.dolphindb"
},
"2": {
"name": "keyword.operator.prototype.dolphindb"
},
"3": {
"name": "constant.other.object.property.dolphindb"
}
}
},
{
"match": "(?:(\\.)|(::))\\s*(\\$*[a-zA-Z_$][\\w$]*)(?=\\s*\\??(\\.\\s*[a-zA-Z_$]\\w*|::))",
"captures": {
"1": {
"name": "punctuation.separator.property.period.dolphindb"
},
"2": {
"name": "keyword.operator.prototype.dolphindb"
},
"3": {
"name": "variable.other.object.property.dolphindb"
}
}
},
{
"match": "(?:(\\.)|(::))\\s*([A-Z][A-Z0-9_$]*\\b\\$*)",
"captures": {
"1": {
"name": "punctuation.separator.property.period.dolphindb"
},
"2": {
"name": "keyword.operator.prototype.dolphindb"
},
"3": {
"name": "constant.other.property.dolphindb"
}
}
},
{
"match": "(?:(\\.)|(::))\\s*(\\$*[a-zA-Z_$][\\w$]*)",
"captures": {
"1": {
"name": "punctuation.separator.property.period.dolphindb"
},
"2": {
"name": "keyword.operator.prototype.dolphindb"
},
"3": {
"name": "variable.other.property.dolphindb"
}
}
},
{
"match": "(?:(\\.)|(::))\\s*([0-9][\\w$]*)",
"captures": {
"1": {
"name": "punctuation.separator.property.period.dolphindb"
},
"2": {
"name": "keyword.operator.prototype.dolphindb"
},
"3": {
"name": "invalid.illegal.identifier.dolphindb"
}
}
}
]
}
}
}