summaryrefslogtreecommitdiffstats
path: root/parser.l
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-03 00:28:01 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-03 00:28:01 -0800
commit442c9efa4b176ff2c4c89a43beac3ea3fad247d4 (patch)
tree20f0d8545174ed466d2825ea0315a0a7fdb57c50 /parser.l
parenta7d3edcff56ee0faa8355ceaea7bc23c2f2e2aa7 (diff)
downloadtxr-442c9efa4b176ff2c4c89a43beac3ea3fad247d4.tar.gz
txr-442c9efa4b176ff2c4c89a43beac3ea3fad247d4.tar.bz2
txr-442c9efa4b176ff2c4c89a43beac3ea3fad247d4.zip
* eval.c (rest_s, op_s): New variables.
(do_eval_args): Allow calls specified by improper lists like (x y . z) where the z expression must evaluate to a list that turns into addition arguments to be applied. (transform_op, expand_op): New static functions. (expand): Call expand_op. (eval_init): Initialize rest_s and op_s. Use rest_s to register rest function. * lib.c (gensym): New function based on gensymv. (gensymv): Now calls gensym. * lib.h (gensym): Declared. * parser.l: Parse @ followed by digits as a new kind of token, METANUM. * parser.y (METANUM): New token. (meta_expr, exprs): Missing rlcp's added. (expr): METANUM variant introduced. (yybadtoken): Handle METANUM. * txr.1: Documented one-symbol argument list of lambda. Documented op. Closed some unbalanced parentheses. * txr.vim: Highlight op.
Diffstat (limited to 'parser.l')
-rw-r--r--parser.l11
1 files changed, 11 insertions, 0 deletions
diff --git a/parser.l b/parser.l
index 5ef544e1..63f6291c 100644
--- a/parser.l
+++ b/parser.l
@@ -150,6 +150,7 @@ NUM [+\-]?[0-9]+
NSCHR [a-zA-Z0-9!$%&*+\-<=>?\\^_~]
NSYM {NSCHR}({NSCHR}|#)*
TOK :?{SYM}
+ATNUM @{NUM}
NTOK [:@]?{NSYM}
ID_END [^a-zA-Z0-9_]
WS [\t ]*
@@ -182,6 +183,16 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
return NUMBER;
}
+<NESTED>{ATNUM} {
+ val str = string_own(utf8_dup_from(yytext + 1));
+
+ if (yy_top_state() == INITIAL
+ || yy_top_state() == QSILIT)
+ yy_pop_state();
+ yylval.num = int_str(str, num(10));
+ return METANUM;
+ }
+
<SPECIAL>{TOK} |
<NESTED>{NTOK} {
if (yy_top_state() == INITIAL