From 619f20775dae99ad5cd04ff6e7f7cde693d912f0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 30 Jan 2004 17:06:03 +0000 Subject: [PATCH] * Parser numbers again. * Include missing files in distributions. --- src/libexpr/Makefile.am | 2 +- src/libexpr/lexer.l | 5 ++++- src/libexpr/parser.y | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libexpr/Makefile.am b/src/libexpr/Makefile.am index 7a361771e..a16cd0785 100644 --- a/src/libexpr/Makefile.am +++ b/src/libexpr/Makefile.am @@ -2,7 +2,7 @@ noinst_LIBRARIES = libexpr.a libexpr_a_SOURCES = nixexpr.cc nixexpr.hh parser.cc parser.hh \ eval.cc eval.hh primops.cc primops.hh \ - lexer-tab.c lexer-tab.h parser-tab.c parser-tab.h + lexer.l lexer-tab.c lexer-tab.h parser.y parser-tab.c parser-tab.h AM_CXXFLAGS = \ -I.. -I../../externals/inst/include -I../libutil -I../libstore diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l index 705b31b41..3b6e0bb65 100644 --- a/src/libexpr/lexer.l +++ b/src/libexpr/lexer.l @@ -58,7 +58,10 @@ rec { return REC; } \-\> { return IMPL; } {ID} { yylval->t = ATmake("", yytext); return ID; /* !!! alloc */ } -{INT} { return INT; } +{INT} { int n = atoi(yytext); /* !!! overflow */ + yylval->t = ATmake("", n); + return INT; + } {STR} { int len = strlen(yytext); yytext[len - 1] = 0; yylval->t = ATmake("", yytext + 1); diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index 45e6a98e8..dc03117bb 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -85,6 +85,7 @@ expr_select expr_simple : ID { $$ = ATmake("Var()", $1); } + | INT { $$ = ATmake("Int()", $1); } | STR { $$ = ATmake("Str()", $1); } | PATH { $$ = ATmake("Path()", absParsedPath(data, $1)); } | URI { $$ = ATmake("Uri()", $1); }