我需要打开看起来像这样的字符串表达式:
"SALARY('@JohnSmith') = {USER.workingHours} * {USER.hourlyRate}"
与AST类似。例如:
const result = [
{type: 'function', name: 'SALARY', params: ['@JohnSmith']},
{type: 'entity', name: 'USER', fields: ['workingHours']},
{type: 'mathOperation', operator: 'mutliply'},
{type: 'entity', name: 'USER', fields: ['hourlyRate']}
]
我需要一些有关图书馆的建议,可以:
类似:
tokenizer.register(someValiedRegexp, async callback(name, param) => ...)
提前感谢
mmoo.js可以完成这项工作。我所需要做的只是为令牌化设置规则