Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

manage line number in yacc rules, not in lexer

  • Loading branch information...
commit e7661b978d77b1aa612bb1f833993616e8216a96 1 parent d1a453a
@matz matz authored
Showing with 11 additions and 5 deletions.
  1. +11 −5 src/parse.y
View
16 src/parse.y
@@ -2916,7 +2916,7 @@ opt_terms : /* none */
;
opt_nl : /* none */
- | '\n'
+ | nl
;
rparen : opt_nl ')'
@@ -2926,14 +2926,20 @@ rbracket : opt_nl ']'
;
trailer : /* none */
- | '\n'
+ | nl
| ','
;
term : ';' {yyerrok;}
- | '\n'
+ | nl
;
+nl : '\n'
+ {
+ p->lineno++;
+ p->column = 0;
+ }
+
terms : term
| terms ';' {yyerrok;}
;
@@ -3515,14 +3521,14 @@ parser_yylex(parser_state *p)
skip(p, '\n');
/* fall through */
case '\n':
- p->lineno++;
- p->column = 0;
switch (p->lstate) {
case EXPR_BEG:
case EXPR_FNAME:
case EXPR_DOT:
case EXPR_CLASS:
case EXPR_VALUE:
+ p->lineno++;
+ p->column = 0;
goto retry;
default:
break;
Please sign in to comment.
Something went wrong with that request. Please try again.