about summary refs log tree commit diff
path: root/src/libexpr
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr')
-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); }