feat: 增强错误定位
This commit is contained in:
parent
d54a2c59b6
commit
3a2a1363e6
@ -50,6 +50,6 @@ public class LexicalError {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return file + ": 行 " + line + ", 列 " + column + ": " + message;
|
||||
return file + ":" + line + ":" + column + ": " + message;
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,6 @@ public class ParseError {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return file + ": 行 " + line + ", 列 " + column + ": " + message;
|
||||
return file + ":" + line + ":" + column + ": " + message;
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,8 +49,8 @@ public record SemanticError(Node node, String message) {
|
||||
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (file != null && !file.isBlank()) sb.append(file).append(": ");
|
||||
sb.append((line >= 0 && col >= 0) ? "行 " + line + ", 列 " + col : "未知位置");
|
||||
if (file != null && !file.isBlank()) sb.append(file).append(":");
|
||||
sb.append((line >= 0 && col >= 0) ? line + ":" + col : "未知位置");
|
||||
sb.append(": ").append(message);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user