summaryrefslogtreecommitdiffstats
path: root/parser.l
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-03-03 01:44:37 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-03-03 01:44:37 -0800
commit039e2ebdfa5670de7a35084fd480fe204afbdc8b (patch)
treeb9726ccd8d6b0d29bba921c8b96e433a4a4ed38e /parser.l
parent6cbd5aa63b23044c12817e0d442fe7678f6a0754 (diff)
downloadtxr-039e2ebdfa5670de7a35084fd480fe204afbdc8b.tar.gz
txr-039e2ebdfa5670de7a35084fd480fe204afbdc8b.tar.bz2
txr-039e2ebdfa5670de7a35084fd480fe204afbdc8b.zip
* parser.l: Allowing ^ to be a quote character, and adjusting definition
of identifiers to rule this out from being the first character of a symbol which has no prefix. Recognize the ^ character as a token in the NESTED state. * lib.c (obj_print, obj_pprint): Render sys:qquote as ^. * parser.y (choose_quote): Function removed. (n_expr): Recognize '^' as quasiquote. Removed all the "smart quote" hacks that try to make quote behave as quote or quasiquote, or try to cancel out unquotes and quotes. * tests/009/json.txr: Fixed to ^ quasiquote. * tests/010/reghash.txr: Likewise. * tests/011/macros-2.txr: Likewise. * tests/011/mandel.txr: Likewise. * tests/011/special-1.txr: Likewise. * txr.1: Updated docs. * genvim.txr: Revamped definitions for txr_ident and txl_ident so that unqualified identifiers cannot start with # or ^, but ones with @ or : in front can start with these characters. * txr.vim: Regenerated.
Diffstat (limited to 'parser.l')
-rw-r--r--parser.l21
1 files changed, 11 insertions, 10 deletions
diff --git a/parser.l b/parser.l
index ba907888..1d2d5525 100644
--- a/parser.l
+++ b/parser.l
@@ -158,19 +158,20 @@ FLODOT {SGN}?{DIG}+[.]
XNUM #x{SGN}?{XDIG}+
ONUM #o{SGN}?[0-7]+
BNUM #b{SGN}?[0-1]+
-BSCHR [a-zA-Z0-9!$%&*+\-<=>?\\^_~]
-NSCHR [a-zA-Z0-9!$%&*+\-<=>?\\^_~/]
-ID_END [^a-zA-Z0-9!$%&*+\-<=>?\\^_~/]
+BSCHR [a-zA-Z0-9!$%&*+\-<=>?\\_~]
+NSCHR [a-zA-Z0-9!$%&*+\-<=>?\\_~/]
+ID_END [^a-zA-Z0-9!$%&*+\-<=>?\\_~/]
+EXTRA [#^]
TOK {SYM}
-BT0 {BSCHR}({BSCHR}|#)*
-BT1 @({BSCHR}|#)+
-BT2 ({BSCHR}|#)+
+BT0 {BSCHR}({BSCHR}|{EXTRA})*
+BT1 @({BSCHR}|{EXTRA})+
+BT2 ({BSCHR}|{EXTRA})+
BTREG (({BT0}|{BT1})?:{BT2}|({BT0}|{BT1})(:{BT2})?|:)
BTKEY @?:{BT2}?
BTOK {BTREG}|{BTKEY}
-NT0 {NSCHR}({NSCHR}|#)*
-NT1 @({NSCHR}|#)+
-NT2 ({NSCHR}|#)+
+NT0 {NSCHR}({NSCHR}|{EXTRA})*
+NT1 @({NSCHR}|{EXTRA})+
+NT2 ({NSCHR}|{EXTRA})+
NTREG (({NT0}|{NT1})?:{NT2}|({NT0}|{NT1})(:{NT2})?|:)
NTKEY @?:{NT2}?
NTOK {NTREG}|{NTKEY}
@@ -510,7 +511,7 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
return SPLICE;
}
-<NESTED>[,'] {
+<NESTED>[,'^] {
yylval.chr = yytext[0];
return yytext[0];
}