summaryrefslogtreecommitdiffstats
path: root/parser.l
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-10 22:31:01 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-10 22:31:01 -0700
commitf9c0def5b6049bc600051b928910f724e14af4f5 (patch)
tree03fd27d1f4392d2b04c651646d6d3bec80cbeabe /parser.l
parentd36002e99bd8c844a0f1abdc26e66be7f94409b4 (diff)
downloadtxr-f9c0def5b6049bc600051b928910f724e14af4f5.tar.gz
txr-f9c0def5b6049bc600051b928910f724e14af4f5.tar.bz2
txr-f9c0def5b6049bc600051b928910f724e14af4f5.zip
Dot with no whitespace generates qref syntax.
a.b.(expr ...).c -> (qref a b (expr ...) c) Consing dot requires whitespace. * eval.c (qref_s): New symbol global variable. (eval_init): Initialize qref_s. * eval.h (qref_s): Declared. * parser.l (REQWS): New pattern definition, required whitespace. (grammar): New rules to scan CONSDOT (space required on both sides) and LAMBDOT (space required after). * parser.y (CONSDOT, LAMBDOT): New token types. (list): (. n_expr) rule replaced with LAMBDOT and CONSDOT. (r_exprs): r_exprs . n_expr consing dot rule replaced with CONSDOT. (n_expr): New n_expr . n_expr rule introduced here for producing qref expressions. (yybadtoken): Handle CONSDOT and LAMBDOT. * txr.1: Documented qref dot.
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 ca7c893d..dc083867 100644
--- a/parser.l
+++ b/parser.l
@@ -197,6 +197,7 @@ NTREG ({NT0}|{NT1})?:{NT2}?|({NT0}|{NT1})(:{NT2})?
NTKEY @?:{NT2}?
NTOK {NTREG}|{NTKEY}
WS [\t ]*
+REQWS [\t ]+
HEX [0-9A-Fa-f]
OCT [0-7]
@@ -665,6 +666,16 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
return '/';
}
+<SPECIAL,QSPECIAL,NESTED>{REQWS}\.{REQWS} {
+ yylval->chr = '.';
+ return CONSDOT;
+}
+
+<SPECIAL,QSPECIAL,NESTED>\.{REQWS} {
+ yylval->chr = '.';
+ return LAMBDOT;
+}
+
<SPECIAL,QSPECIAL,NESTED>\. {
yylval->chr = '.';
return '.';