fix: NumberTokenScanner 移除数字字面量后直接跟 / 的规则

This commit is contained in:
Luke 2025-07-01 09:55:21 +08:00
parent 6ae6d6e893
commit 4507e3589f
2 changed files with 1 additions and 6 deletions

View File

@ -136,7 +136,7 @@ public class LexerEngine {
}
}
if (!handled) {
// 万一没有任何扫描器能处理跳过一个字符防止死循环
// 没有任何扫描器能处理跳过一个字符防止死循环
context.advance();
}
}

View File

@ -40,7 +40,6 @@ import org.jcnc.snow.compiler.lexer.token.TokenType;
* <ol>
* <li>数字后跟未知字母 42X 抛出 LexicalException</li>
* <li>数字与合法后缀间有空白 3 L 抛出 LexicalException</li>
* <li>数字后直接出现 '/' 3/ 3/* 抛出 LexicalException避免死循环</li>
* <li>小数点后缺失数字 1. 抛出 LexicalException</li>
* </ol>
* 支持的单字符类型后缀包括b, s, l, f, d 及其大写形式若需支持多字符后缀可将该集合扩展为 Set<String>
@ -154,10 +153,6 @@ public class NumberTokenScanner extends AbstractTokenScanner {
throw new LexicalException("数字字面量与类型后缀之间不允许有空白符", line, col);
}
}
// 2D. 紧跟 '/' 3/ 3/*
else if (next == '/') {
throw new LexicalException("数字字面量后不允许直接出现 '/'", line, col);
}
// 其他字符分号运算符括号等留给外层扫描流程处理
}