From 6c0867e15e7e960db21a5aee89815171c65528be Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Thu, 24 Oct 2002 18:14:55 +0000 Subject: [PATCH] synced to 1.0 --- ginac/input_lexer.ll | 5 ++++- ginac/input_parser.yy | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ginac/input_lexer.ll b/ginac/input_lexer.ll index 4a5a6501..139d6907 100644 --- a/ginac/input_lexer.ll +++ b/ginac/input_lexer.ll @@ -87,7 +87,7 @@ AN [0-9a-zA-Z_] */ %% -[ \t]+ /* skip whitespace */ +[ \t\n]+ /* skip whitespace */ /* special values */ Pi ginac_yylval = Pi; return T_LITERAL; @@ -123,6 +123,9 @@ Digits ginac_yylval = (long)Digits; return T_DIGITS; return T_SYMBOL; } + /* end of input */ +<> return T_EOF; + /* everything else */ . return *yytext; diff --git a/ginac/input_parser.yy b/ginac/input_parser.yy index ecdc317e..9b8799dd 100644 --- a/ginac/input_parser.yy +++ b/ginac/input_parser.yy @@ -58,7 +58,7 @@ ex attach_index(const ex & base, ex i, bool covariant); /* Tokens (T_LITERAL means a literal value returned by the parser, but not of class numeric or symbol (e.g. a constant or the FAIL object)) */ -%token T_NUMBER T_SYMBOL T_LITERAL T_DIGITS T_EQUAL T_NOTEQ T_LESSEQ T_GREATEREQ +%token T_EOF T_NUMBER T_SYMBOL T_LITERAL T_DIGITS T_EQUAL T_NOTEQ T_LESSEQ T_GREATEREQ /* Operator precedence and associativity */ %right '=' @@ -79,7 +79,7 @@ ex attach_index(const ex & base, ex i, bool covariant); */ %% -input : exp { +input : exp T_EOF { try { parsed_ex = $1; YYACCEPT; @@ -88,7 +88,6 @@ input : exp { YYERROR; } } - | error {yyclearin; yyerrok;} ; exp : T_NUMBER {$$ = $1;} -- 2.47.0