about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-01-30T17·06+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-01-30T17·06+0000
commit619f20775dae99ad5cd04ff6e7f7cde693d912f0 (patch)
treee6d9084d9f7efa2b110ab160cb63cf4f69827f71 /src
parentc6257185139bf5f298b19177867f3afa8e5472b7 (diff)
* Parser numbers again.
* Include missing files in distributions.

Diffstat (limited to 'src')
-rw-r--r--src/libexpr/Makefile.am2
-rw-r--r--src/libexpr/lexer.l5
-rw-r--r--src/libexpr/parser.y1
3 files changed, 6 insertions, 2 deletions
diff --git a/src/libexpr/Makefile.am b/src/libexpr/Makefile.am
index 7a361771e690..a16cd0785f82 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 705b31b41a77..3b6e0bb657c2 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 45e6a98e843a..dc03117bb115 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); }