mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 09:36:15 +02:00
* Don't use ATerms to represent integers in the lexer.
This commit is contained in:
parent
db90b88e65
commit
ed711f73bc
2 changed files with 5 additions and 3 deletions
|
@ -107,7 +107,7 @@ inherit { return INHERIT; }
|
||||||
|
|
||||||
{ID} { yylval->t = toATerm(yytext); return ID; /* !!! alloc */ }
|
{ID} { yylval->t = toATerm(yytext); return ID; /* !!! alloc */ }
|
||||||
{INT} { int n = atoi(yytext); /* !!! overflow */
|
{INT} { int n = atoi(yytext); /* !!! overflow */
|
||||||
yylval->t = ATmake("<int>", n);
|
yylval->n = n;
|
||||||
return INT;
|
return INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -317,6 +317,7 @@ static void freeAndUnprotect(void * p)
|
||||||
ATermList formals;
|
ATermList formals;
|
||||||
bool ellipsis;
|
bool ellipsis;
|
||||||
} formals;
|
} formals;
|
||||||
|
int n;
|
||||||
}
|
}
|
||||||
|
|
||||||
%type <t> start expr expr_function expr_if expr_op
|
%type <t> start expr expr_function expr_if expr_op
|
||||||
|
@ -324,7 +325,8 @@ static void freeAndUnprotect(void * p)
|
||||||
%type <t> pattern
|
%type <t> pattern
|
||||||
%type <ts> binds ids attrpath expr_list string_parts ind_string_parts
|
%type <ts> binds ids attrpath expr_list string_parts ind_string_parts
|
||||||
%type <formals> formals
|
%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 IF THEN ELSE ASSERT WITH LET IN REC INHERIT EQ NEQ AND OR IMPL
|
||||||
%token DOLLAR_CURLY /* == ${ */
|
%token DOLLAR_CURLY /* == ${ */
|
||||||
%token IND_STRING_OPEN IND_STRING_CLOSE
|
%token IND_STRING_OPEN IND_STRING_CLOSE
|
||||||
|
@ -393,7 +395,7 @@ expr_select
|
||||||
|
|
||||||
expr_simple
|
expr_simple
|
||||||
: ID { $$ = makeVar($1); }
|
: ID { $$ = makeVar($1); }
|
||||||
| INT { $$ = makeInt(ATgetInt((ATermInt) $1)); }
|
| INT { $$ = makeInt($1); }
|
||||||
| '"' string_parts '"' {
|
| '"' string_parts '"' {
|
||||||
/* For efficiency, and to simplify parse trees a bit. */
|
/* For efficiency, and to simplify parse trees a bit. */
|
||||||
if ($2 == ATempty) $$ = makeStr(toATerm(""), ATempty);
|
if ($2 == ATempty) $$ = makeStr(toATerm(""), ATempty);
|
||||||
|
|
Loading…
Reference in a new issue