Skip to content

Commit e7a44de

Browse files
committed
Fix location information
1 parent 6f03ce0 commit e7a44de

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/lpython/parser/parser.yy

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ script_unit
315315
;
316316

317317
statements
318-
: TK_INDENT statements1 TK_DEDENT { $$ = $2; LLOC(@$,$2); }
318+
: TK_INDENT statements1 TK_DEDENT { $$ = $2; LLOC(@$,@2);
319+
@$.first = @2.first; }
319320
;
320321

321322
sep_statements
@@ -334,9 +335,9 @@ statements1
334335
;
335336

336337
single_line_statements
337-
: single_line_multi_statements TK_NEWLINE { $$ = $1; }
338+
: single_line_multi_statements TK_NEWLINE { $$ = $1; LLOC(@$,@1); }
338339
| single_line_multi_statements TK_EOLCOMMENT { $$ = $1; }
339-
| single_line_statement TK_NEWLINE { $$ = A2LIST(p.m_a, $1); }
340+
| single_line_statement TK_NEWLINE { $$ = A2LIST(p.m_a, $1); LLOC(@$,@1); }
340341
| single_line_statement TK_SEMICOLON TK_NEWLINE { $$ = A2LIST(p.m_a, $1); }
341342
| single_line_statement TK_SEMICOLON TK_EOLCOMMENT { $$ = A2LIST(p.m_a, $1); }
342343
| single_line_statement TK_EOLCOMMENT { $$ = A2LIST(p.m_a, $1); }
@@ -358,10 +359,10 @@ type_ignore_sep
358359
;
359360

360361
statement
361-
: single_line_statement sep { $$ = $1; }
362+
: single_line_statement sep { $$ = $1; LLOC(@$,@1); }
362363
| single_line_statement type_ignore_sep { $$ = $1; }
363364
| multi_line_statement
364-
| multi_line_statement sep { $$ = $1; }
365+
| multi_line_statement sep { $$ = $1; LLOC(@$,@1); }
365366
| multi_line_statement type_ignore_sep { $$ = $1; }
366367
;
367368

0 commit comments

Comments
 (0)