summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-19 06:57:20 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-19 06:57:20 -0700
commitfb444e43852b08ff6d1fb74339f7bce780931c4f (patch)
tree53f8033f79abfd4b21a5c5ff20065b96595976ff
parentb2a8b3be8e11cff3fcdf9c2336b26c828b0627fb (diff)
downloadtxr-fb444e43852b08ff6d1fb74339f7bce780931c4f.tar.gz
txr-fb444e43852b08ff6d1fb74339f7bce780931c4f.tar.bz2
txr-fb444e43852b08ff6d1fb74339f7bce780931c4f.zip
Quasiquote regression from 110.
The problem is that one-argument function calls like @(whatever arg) in a quasiliteral being turned into sys:var items. * parser.y (quasi_meta_helper): Remove bogus check on length. The default case is now var, so the var_s check actually matters. The integerp check for the argument of a var form didn't do anything because the entire if statment conditionally selected a useless goto. Removing it for consistent treatment of var items. * tests/012/quasi.tl: Some new test cases involving @rest. These new tests pass whether or not we have that integerp(second(obj)) test in the quasi_meta_helper function. Either way @rest and @@rest produce the same thing.
-rw-r--r--parser.y10
-rw-r--r--tests/012/quasi.tl8
2 files changed, 13 insertions, 5 deletions
diff --git a/parser.y b/parser.y
index bfa88a78..04be6aa7 100644
--- a/parser.y
+++ b/parser.y
@@ -1369,17 +1369,17 @@ static val quasi_meta_helper(val obj)
if (integerp(obj) || symbolp(obj))
goto var;
- if (atom(obj) || length(obj) != two)
+ if (atom(obj))
goto expr;
- if (first(obj) == var_s && integerp(second(obj)))
+ if (first(obj) == var_s)
goto var;
-var:
- return rlcp_tree(cons(var_s, cons(obj, nil)), obj);
-
expr:
return rlcp(cons(expr_s, obj), obj);
+
+var:
+ return rlcp_tree(cons(var_s, cons(obj, nil)), obj);
}
static void misplaced_consing_dot_check(scanner_t *scanner, val term_atom_cons)
diff --git a/tests/012/quasi.tl b/tests/012/quasi.tl
index 4c017b62..7511d4bd 100644
--- a/tests/012/quasi.tl
+++ b/tests/012/quasi.tl
@@ -13,3 +13,11 @@
(let ((a "abc") (b 123))
[(ret `@1-@2-@@1-@@2-@{@1 -4}-@{@2 -4}`) a b])
"abc-123-abc-123- abc- 123")
+
+(test
+ [(ret `@1-@rest`) 1 2 3 4]
+ "1-2 3 4")
+
+(test
+ [(ret `@1-@@rest`) 1 2 3 4]
+ "1-2 3 4")