♻️ Replace the math expressions with own calculator

This commit is contained in:
2025-09-14 13:19:56 +08:00
parent 722ef9ca21
commit 2a56a83898
4 changed files with 90 additions and 13 deletions

View File

@@ -99,6 +99,13 @@ class Parser {
return TanExpr(inner);
}
// 解析变量 (单个字母)
if (RegExp(r'[a-zA-Z]').hasMatch(current)) {
var varName = current;
eat();
return VarExpr(varName);
}
// 解析整数
var buf = '';
while (!isEnd && RegExp(r'\d').hasMatch(current)) {