summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-04-15 05:45:46 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-04-15 05:45:46 -0700
commitfff6c80a0f7dd2c90033a48444aad0db36ff9b80 (patch)
tree976646fd45fe2f7f9e48f7fad7599512952ef24b
parent4c97482494e6170733f4b2143199cff3abec5419 (diff)
downloadtxr-fff6c80a0f7dd2c90033a48444aad0db36ff9b80.tar.gz
txr-fff6c80a0f7dd2c90033a48444aad0db36ff9b80.tar.bz2
txr-fff6c80a0f7dd2c90033a48444aad0db36ff9b80.zip
Allow quasiquotes in braces and quasiliterals, and quotes in braces.
* parser.l: Consolidate rules for recognizing quote, unquote, and quasiquote. An effect of this is that quasiquotes can now occur in braces and in string quasiliterals. * parser.y (quasi_item): Support quotes and quasiquotes as quasi items: that is to say, i.e. objects denoted by @ in a quasiliteral.
-rw-r--r--ChangeLog11
-rw-r--r--parser.l7
-rw-r--r--parser.y2
3 files changed, 14 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 23b2704b..e2d223b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-04-15 Kaz Kylheku <kaz@kylheku.com>
+
+ Allow quasiquotes in braces and quasiliterals, and quotes in braces.
+
+ * parser.l: Consolidate rules for recognizing quote, unquote, and
+ quasiquote. An effect of this is that quasiquotes can now occur in
+ braces and in string quasiliterals.
+
+ * parser.y (quasi_item): Support quotes and quasiquotes as quasi items:
+ that is to say, i.e. objects denoted by @ in a quasiliteral.
+
2015-04-14 Kaz Kylheku <kaz@kylheku.com>
Diagnose trailing junk in numeric literals.
diff --git a/parser.l b/parser.l
index 9121de12..70c21d79 100644
--- a/parser.l
+++ b/parser.l
@@ -565,12 +565,7 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
return SPLICE;
}
-<NESTED>[,'^] {
- yylval->chr = yytext[0];
- return yytext[0];
-}
-
-<QSPECIAL,BRACED>[,'] {
+<QSPECIAL,NESTED,BRACED>[,'^] {
yylval->chr = yytext[0];
return yytext[0];
}
diff --git a/parser.y b/parser.y
index 8941df4c..6abd646d 100644
--- a/parser.y
+++ b/parser.y
@@ -949,6 +949,8 @@ quasi_item : litchars { $$ = lit_char_helper($1); }
| METANUM { $$ = cons(var_s, cons($1, nil));
rl($$, num(parser->lineno)); }
| list { $$ = rlcp(cons(expr_s, $1), $1); }
+ | '\'' n_expr { $$ = rlcp(cons(expr_s, list(quote_s, $2, nao)), $2); }
+ | '^' n_expr { $$ = rlcp(cons(expr_s, list(sys_qquote_s, $2, nao)), $2); }
| ',' n_expr { $$ = rlcp(cons(expr_s, list(sys_unquote_s, $2, nao)), $2); }
| SPLICE n_expr { $$ = rlcp(cons(expr_s, list(sys_splice_s, $2, nao)), $2); }
;