Skip to content

Commit dbeef4e

Browse files
committed
Move the LLOC at the beginning
1 parent 60d8cca commit dbeef4e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/lpython/parser/parser.yy

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

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

322321
sep_statements
323-
: sep statements { $$ = $2; }
324-
| type_ignore_sep statements { $$ = $2; }
322+
: sep statements { @$.first = @2.first; $$ = $2; }
323+
| type_ignore_sep statements { @$.first = @2.first; $$ = $2; }
325324
;
326325

327326
body_stmts
@@ -335,9 +334,9 @@ statements1
335334
;
336335

337336
single_line_statements
338-
: single_line_multi_statements TK_NEWLINE { $$ = $1; LLOC(@$,@1); }
337+
: single_line_multi_statements TK_NEWLINE { LLOC(@$,@1); $$ = $1; }
339338
| single_line_multi_statements TK_EOLCOMMENT { $$ = $1; }
340-
| single_line_statement TK_NEWLINE { $$ = A2LIST(p.m_a, $1); LLOC(@$,@1); }
339+
| single_line_statement TK_NEWLINE { LLOC(@$,@1); $$ = A2LIST(p.m_a, $1); }
341340
| single_line_statement TK_SEMICOLON TK_NEWLINE { $$ = A2LIST(p.m_a, $1); }
342341
| single_line_statement TK_SEMICOLON TK_EOLCOMMENT { $$ = A2LIST(p.m_a, $1); }
343342
| single_line_statement TK_EOLCOMMENT { $$ = A2LIST(p.m_a, $1); }
@@ -359,10 +358,10 @@ type_ignore_sep
359358
;
360359

361360
statement
362-
: single_line_statement sep { $$ = $1; LLOC(@$,@1); }
361+
: single_line_statement sep { LLOC(@$,@1); $$ = $1; }
363362
| single_line_statement type_ignore_sep { $$ = $1; }
364363
| multi_line_statement
365-
| multi_line_statement sep { $$ = $1; LLOC(@$,@1); }
364+
| multi_line_statement sep { LLOC(@$,@1); $$ = $1; }
366365
| multi_line_statement type_ignore_sep { $$ = $1; }
367366
;
368367

0 commit comments

Comments
 (0)