Skip to content

Commit f62da03

Browse files
committed
distinguish {x y} and {x y;} in parser, as with [ ]
`{x y}` => (braceshcat x y) `{x y;}` => (bracescat (row x y))
1 parent 2042dcf commit f62da03

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

Diff for: src/ast.scm

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
((row) (deparse-arglist (cdr e) " "))
8686
((braces) (string #\{ (deparse-arglist (cdr e) ", ") #\}))
8787
((bracescat) (string #\{ (deparse-arglist (cdr e) "; ") #\}))
88+
((braceshcat) (string #\{ (deparse-arglist (cdr e) " ") #\}))
8889
((const) (string "const " (deparse (cadr e))))
8990
((global local)
9091
(string (car e) " " (string.join (map deparse (cdr e)) ", ")))

Diff for: src/julia-parser.scm

+1-1
Original file line numberDiff line numberDiff line change
@@ -2284,7 +2284,7 @@
22842284
'(braces)
22852285
(case (car vex)
22862286
((vect) `(braces ,@(cdr vex)))
2287-
((hcat) `(bracescat (row ,@(cdr vex))))
2287+
((hcat) `(braceshcat ,@(cdr vex)))
22882288
((comprehension) `(braces ,@(cdr vex)))
22892289
(else `(bracescat ,@(cdr vex))))))))
22902290

Diff for: test/syntax.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ end
444444
@test Meta.parse("A=>B") == Expr(:call, :(=>), :A, :B)
445445

446446
@test Meta.parse("{1,2,3}") == Expr(:braces, 1, 2, 3)
447-
@test Meta.parse("{1 2 3 4}") == Expr(:bracescat, Expr(:row, 1, 2, 3, 4))
447+
@test Meta.parse("{1 2 3 4}") == Expr(:braceshcat, 1, 2, 3, 4)
448448
@test Meta.parse("{1 2; 3 4}") == Expr(:bracescat, Expr(:row, 1, 2), Expr(:row, 3, 4))
449449
@test Meta.parse("{x for x in 1:10}") == Expr(:braces, :(x for x in 1:10))
450450
@test Meta.parse("{x=>y for (x,y) in zip([1,2,3],[4,5,6])}") == Expr(:braces, :(x=>y for (x,y) in zip([1,2,3],[4,5,6])))

0 commit comments

Comments
 (0)