File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
crates/emmylua_parser/src/grammar/lua Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ fn parse_table_expr(p: &mut LuaParser) -> ParseResult {
182
182
let mut lookahead_count = 0 ;
183
183
const MAX_LOOKAHEAD : usize = 50 ; // 限制令牌数避免无休止的解析
184
184
185
+ let error_range = p. current_token_range ( ) ;
185
186
while p. current_token ( ) != LuaTokenKind :: TkEof && lookahead_count < MAX_LOOKAHEAD {
186
187
match p. current_token ( ) {
187
188
LuaTokenKind :: TkRightBrace => {
@@ -217,7 +218,12 @@ fn parse_table_expr(p: &mut LuaParser) -> ParseResult {
217
218
// 没有找到闭合括号, 报告错误
218
219
p. push_error ( LuaParseError :: syntax_error_from (
219
220
& t ! ( "expected '}' to close table" ) ,
220
- p. current_token_range ( ) ,
221
+ error_range,
222
+ ) ) ;
223
+ } else {
224
+ p. push_error ( LuaParseError :: syntax_error_from (
225
+ & t ! ( "missing ',' or ';' after table field" ) ,
226
+ error_range,
221
227
) ) ;
222
228
}
223
229
}
You can’t perform that action at this time.
0 commit comments