forked from PuqiAR/Fig-TreeWalker
[Fix] 函数调用时参数类型求值使用错误作用域的问题
[Fix] 结构体定义中不可以使用自身类型的bug
[Fix] import导致的重定义bug
[Impl] Parser的precedence调整
[Feat] 支持运算符重载, impl Operator for xxx {} 具体见 lang.fig中解释
[Feat] 新增标准库 std.test
[Feat] 新增内置函数 type,接收一个参数,返回该参数的类型(value.type改名value._type)
推荐使用该函数替换 value._type
[Feat] 新增转换运算符 as,转换失败时抛出TypeError,支持任意类型到String、部分类型到Int, Double等等转换
TypeError实现了Error interface,可被用户catch
推荐使用该feat或与std.value标准库结合
[Feat] 抛出实现Error interface的错误现在会有不一样的log
[Feat] import增加cache(ast + source lines),但import一个module每次会得到不同对象而不是复用,请注意
20 lines
258 B
Plaintext
20 lines
258 B
Plaintext
/*
|
|
Example code: FigFig
|
|
|
|
Tokenizer.fig
|
|
Copyright (C) 2020-2026 PuqiAR
|
|
|
|
*/
|
|
|
|
import token {Token, TokenType};
|
|
|
|
public struct Tokenizer
|
|
{
|
|
src: String = "";
|
|
|
|
public func TokenizeAll() -> List
|
|
{
|
|
var output := [];
|
|
return output;
|
|
}
|
|
} |