about summary refs log tree commit diff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-04-12T10·38+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-04-12T10·38+0000
commited711f73bce8786b1a37bd718eb97276d0916484 (patch)
tree5a30b6dbc9f065e031ef7ffefc436cdc4b4642b8 /src/libexpr
parentdb90b88e655a0d8e501beddee966a124b2f097d8 (diff)
* Don't use ATerms to represent integers in the lexer.
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/lexer.l2
-rw-r--r--src/libexpr/parser.y6
2 files changed, 5 insertions, 3 deletions
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index 81aec99e15c8..82c3500202b0 100644
--- a/src/libexpr/lexer.l
+++ b/src/libexpr/lexer.l
@@ -107,7 +107,7 @@ inherit     { return INHERIT; }
 
 {ID}        { yylval->t = toATerm(yytext); return ID; /* !!! alloc */ }
 {INT}       { int n = atoi(yytext); /* !!! overflow */
-              yylval->t = ATmake("<int>", n);
+              yylval->n = n;
               return INT;
             }
 
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 3463a5c5d7f8..a28d56d24f67 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -317,6 +317,7 @@ static void freeAndUnprotect(void * p)
     ATermList formals;
     bool ellipsis;
   } formals;
+  int n;
 }
 
 %type <t> start expr expr_function expr_if expr_op
@@ -324,7 +325,8 @@ static void freeAndUnprotect(void * p)
 %type <t> pattern
 %type <ts> binds ids attrpath expr_list string_parts ind_string_parts
 %type <formals> formals
-%token <t> ID INT STR IND_STR PATH URI
+%token <t> ID STR IND_STR PATH URI
+%token <n> INT
 %token IF THEN ELSE ASSERT WITH LET IN REC INHERIT EQ NEQ AND OR IMPL
 %token DOLLAR_CURLY /* == ${ */
 %token IND_STRING_OPEN IND_STRING_CLOSE
@@ -393,7 +395,7 @@ expr_select
 
 expr_simple
   : ID { $$ = makeVar($1); }
-  | INT { $$ = makeInt(ATgetInt((ATermInt) $1)); }
+  | INT { $$ = makeInt($1); }
   | '"' string_parts '"' {
       /* For efficiency, and to simplify parse trees a bit. */
       if ($2 == ATempty) $$ = makeStr(toATerm(""), ATempty);