fix(est): parse marine quantity formulas

This commit is contained in:
2026-11-06 22:12:04 +09:00
parent 064bc6df4c
commit 8f9251d627
4 changed files with 103 additions and 7 deletions
+2 -1
View File
@@ -9,12 +9,13 @@ const EstExpression = (() => {
.replace(/%/g, "%")
.replace(/√\s*\(/g, "SQRT(")
.replace(/π/g, "PI")
.replace(/(?<=[\d\u0370-\u03ff])\s*(?=\()/g, "*")
.replace(/(?<=[\d.)])\s*[xX]\s*(?=[\d.(A-Za-z])/g, "*")
.replace(/(?<=[A-Z])x(?=[A-Z])/g, "*")
.replace(/(?<=\d),(?=\d{3}(?:\D|$))/g, "");
const tokens = [];
const pattern =
/\s+|(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?|\[[^\]]+\]|[A-Za-z_가-힣][A-Za-z_0-9가-힣.]*|[+*/^%(),:~=-]/y;
/\s+|(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?|\[[^\]]+\]|[A-Za-z_가-힣\u0370-\u03ff][A-Za-z_0-9가-힣\u0370-\u03ff.]*|[+*/^%(),:~=-]/y;
let at = 0;
while (at < text.length) {
pattern.lastIndex = at;