diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-01-30 17:06:03 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-01-30 17:06:03 +0000 |
commit | 619f20775dae99ad5cd04ff6e7f7cde693d912f0 (patch) | |
tree | e6d9084d9f7efa2b110ab160cb63cf4f69827f71 | |
parent | c6257185139bf5f298b19177867f3afa8e5472b7 (diff) |
* Parser numbers again.
* Include missing files in distributions.
-rw-r--r-- | src/libexpr/Makefile.am | 2 | ||||
-rw-r--r-- | src/libexpr/lexer.l | 5 | ||||
-rw-r--r-- | 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("<str>", yytext); return ID; /* !!! alloc */ } -{INT} { return INT; } +{INT} { int n = atoi(yytext); /* !!! overflow */ + yylval->t = ATmake("<int>", n); + return INT; + } {STR} { int len = strlen(yytext); yytext[len - 1] = 0; yylval->t = ATmake("<str>", 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(<term>)", $1); } + | INT { $$ = ATmake("Int(<term>)", $1); } | STR { $$ = ATmake("Str(<term>)", $1); } | PATH { $$ = ATmake("Path(<term>)", absParsedPath(data, $1)); } | URI { $$ = ATmake("Uri(<term>)", $1); } |