fix: 数值字面量后紧挨着标识符时,报错信息输出完整标识符

This commit is contained in:
zhangxun 2025-07-18 11:03:21 +08:00
parent e2d4f97d75
commit 901d2f842a

View File

@ -177,8 +177,10 @@ public class NumberTokenScanner extends AbstractTokenScanner {
/* 2-B. **非法字母**(既不是后缀,也没有空白隔开) */
} else if (Character.isLetter(next)) {
var its = new IdentifierTokenScanner();
var token = its.scanToken(ctx, line, col);
throw new LexicalException(
"数字后不能紧跟未知标识符 '" + next + "'", line, col);
"数字后不能紧跟未知标识符 '" + token.getLexeme() + "'", line, col);
/* 2-C. **非法下划线** */
} else if (next == '_') {
throw new LexicalException(