Files
Fig-TreeWalker/fig-vscode/syntaxes/fig.tmLanguage.json
PuqiAR ca4ae143b4
All checks were successful
Release Build / build-windows-x64 (push) Successful in 43s
Release Build / build-linux-x64 (push) Successful in 50s
v0.4.2-alpha
[Fix][Impl] 为了消除类构造带来的语法歧义,同时保持实现简洁和括号省略的语法,自此版本,引入了 `new` 操作符
            造成歧义的原方法:
                if a == A{}
            条件是 a == A,还是 a == A{} ?

            因此,现在使用 new a_struct{}来构造类
[Opti] 相较于 Fig v0.4.1-alpha版本,release O3同编译条件下
       Fib普通递归法性能提升 ~50%
       具体方式:
            增加了小整数优化,-128~127的整数现在会直接从IntPool获取而不是新构造
            ...忘了
[Fix] 类构造 shorthand模式忘写了,现在补上了
[Feat][Impl] 类型声明现在接受一个表达式,原为Identifier。实现 var start: time.Time = time.now() 的效果
             这是符合语法和语言特性的支持,类型为一等公民。类似Python的 <class 'type'>

[Impl] 修改了部分错误输出的细节
2026-01-22 08:24:14 +08:00

115 lines
3.0 KiB
JSON

{
"name": "Fig",
"scopeName": "source.fig",
"patterns": [
{ "include": "#comments" },
{ "include": "#strings" },
{ "include": "#numbers" },
{ "include": "#keywords" },
{ "include": "#operators" },
{ "include": "#functions" },
{ "include": "#identifiers" }
],
"repository": {
"comments": {
"patterns": [
{ "name": "comment.line.double-slash.fig", "match": "//.*$" },
{ "name": "comment.block.fig", "begin": "/\\*", "end": "\\*/" }
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.fig",
"begin": "\"\"\"",
"end": "\"\"\"",
"patterns": [{ "match": ".", "name": "string.content.fig" }]
},
{
"name": "string.quoted.double.fig",
"begin": "\"",
"end": "\"",
"patterns": [
{ "match": "\\\\.", "name": "constant.character.escape.fig" }
]
},
{
"name": "string.quoted.raw.fig",
"begin": "r\"",
"end": "\"",
"patterns": [{ "match": ".", "name": "string.content.fig" }]
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.float.fig",
"match": "\\d*\\.\\d+([eE][+-]?\\d+)?"
},
{
"name": "constant.numeric.integer.fig",
"match": "\\d+([eE][+-]?\\d+)?"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.fig",
"match": "\\b(and|or|not|import|func|var|const|final|while|for|if|else|new|struct|interface|impl|public|return|break|continue|try|catch|throw)\\b"
},
{ "name": "constant.language.fig", "match": "\\b(true|false|null)\\b" }
]
},
"operators": {
"patterns": [
{
"name": "keyword.operator.arithmetic.fig",
"match": "(\\+|\\-|\\*|/|%|\\*\\*)"
},
{
"name": "keyword.operator.assignment.fig",
"match": "(=|\\+=|\\-=|\\*=|/=|%=|\\^=|:=)"
},
{
"name": "keyword.operator.logical.fig",
"match": "(&&|\\|\\||\\b(and|or|not)\\b)"
},
{
"name": "keyword.operator.comparison.fig",
"match": "(==|!=|<=|>=|<|>|is)"
},
{
"name": "punctuation.separator.fig",
"match": "[\\(\\)\\[\\]\\{\\},;:.]"
},
{
"name": "keyword.operator.other.fig",
"match": "(\\+\\+|--|->|=>|<<|>>|\\^|&|\\||~)"
}
]
},
"functions": {
"patterns": [
{
"name": "entity.name.function.fig",
"begin": "\\bfunc\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
"beginCaptures": {
"1": { "name": "entity.name.function.fig" }
},
"end": "(?=;)"
}
]
},
"identifiers": {
"patterns": [
{
"name": "variable.other.fig",
"match": "(?!\\bfunc\\b)[a-zA-Z_][a-zA-Z0-9_]*"
}
]
}
}
}