@@ -1449,33 +1449,42 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
1449
1449
end
1450
1450
elseif k == K " ["
1451
1451
if is_macrocall
1452
- # a().@x[1] ==> (macrocall (ref ( error (. (call a) (quote x))) 1))
1452
+ # a().@x[1] ==> (macrocall (error (. (call a) (quote x))) (vect 1))
1453
1453
finish_macroname (ps, mark, valid_macroname, macro_name_position)
1454
1454
end
1455
+ m = position (ps)
1455
1456
# a [i] ==> (ref a (error-t) i)
1456
1457
bump_disallowed_space (ps)
1457
1458
bump (ps, TRIVIA_FLAG)
1458
1459
ckind, cflags = parse_cat (ParseState (ps, end_symbol= true ),
1459
1460
K " ]" , ps. end_symbol)
1460
- # a[i] ==> (ref a i)
1461
- # a[i,j] ==> (ref a i j)
1462
- # (a=1)[] ==> (ref (= a 1))
1463
- # T[x y] ==> (typed_hcat T x y)
1464
- # T[x ; y] ==> (typed_vcat T x y)
1465
- # T[a b; c d] ==> (typed_vcat T (row a b) (row c d))
1466
- # T[x for x in xs] ==> (typed_comprehension T (generator x (= x xs)))
1467
- # v1.8: T[a ; b ;; c ; d] ==> (typed_ncat-2 T (nrow-1 a b) (nrow-1 c d))
1468
- outk = ckind == K " vect" ? K " ref" :
1469
- ckind == K " hcat" ? K " typed_hcat" :
1470
- ckind == K " vcat" ? K " typed_vcat" :
1471
- ckind == K " comprehension" ? K " typed_comprehension" :
1472
- ckind == K " ncat" ? K " typed_ncat" :
1473
- internal_error (" unrecognized kind in parse_cat " , ckind)
1474
- emit (ps, mark, outk, cflags)
1475
- check_ncat_compat (ps, mark, ckind)
1476
1461
if is_macrocall
1462
+ # @S[a,b] ==> (macrocall @S (vect a b))
1463
+ # @S[a b] ==> (macrocall @S (hcat a b))
1464
+ # @S[a; b] ==> (macrocall @S (vcat a b))
1465
+ # v1.7: @S[a ;; b] ==> (macrocall @S (ncat-2 a b))
1466
+ # v1.6: @S[a ;; b] ==> (macrocall @S (error (ncat-2 a b)))
1467
+ emit (ps, m, ckind, cflags)
1468
+ check_ncat_compat (ps, m, ckind)
1477
1469
emit (ps, mark, K " macrocall" )
1478
1470
break
1471
+ else
1472
+ # a[i] ==> (ref a i)
1473
+ # a[i,j] ==> (ref a i j)
1474
+ # (a=1)[] ==> (ref (= a 1))
1475
+ # T[x y] ==> (typed_hcat T x y)
1476
+ # T[x ; y] ==> (typed_vcat T x y)
1477
+ # T[a b; c d] ==> (typed_vcat T (row a b) (row c d))
1478
+ # T[x for x in xs] ==> (typed_comprehension T (generator x (= x xs)))
1479
+ # v1.8: T[a ; b ;; c ; d] ==> (typed_ncat-2 T (nrow-1 a b) (nrow-1 c d))
1480
+ outk = ckind == K " vect" ? K " ref" :
1481
+ ckind == K " hcat" ? K " typed_hcat" :
1482
+ ckind == K " vcat" ? K " typed_vcat" :
1483
+ ckind == K " comprehension" ? K " typed_comprehension" :
1484
+ ckind == K " ncat" ? K " typed_ncat" :
1485
+ internal_error (" unrecognized kind in parse_cat " , ckind)
1486
+ emit (ps, mark, outk, cflags)
1487
+ check_ncat_compat (ps, mark, ckind)
1479
1488
end
1480
1489
elseif k == K " ."
1481
1490
# x .y ==> (. x (error-t) (quote y))
0 commit comments