Skip to content

Commit 09fa3b0

Browse files
committed
throw an error for {} array / dict syntax
1 parent c7d0069 commit 09fa3b0

File tree

1 file changed

+3
-39
lines changed

1 file changed

+3
-39
lines changed

src/julia-parser.scm

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@
14081408
(loop lst nxt)
14091409
(let ((params (parse-arglist s closer)))
14101410
`(vcat ,@params ,@lst ,nxt))))
1411-
((#\] #\})
1411+
((#\])
14121412
(error (string "unexpected \"" t "\"")))
14131413
(else
14141414
(error "missing separator in array expression")))))))
@@ -1758,45 +1758,9 @@
17581758
(else
17591759
(error "missing separator in tuple")))))))))
17601760

1761-
;; cell expression
1761+
;; TODO this awaits a decision on {} syntax in 0.4
17621762
((eqv? t #\{ )
1763-
(take-token s)
1764-
(if (eqv? (require-token s) #\})
1765-
(begin (take-token s) '(cell1d))
1766-
(let ((vex (parse-cat s #\})))
1767-
(if (null? vex)
1768-
'(cell1d)
1769-
(case (car vex)
1770-
((comprehension)
1771-
`(typed_comprehension (top Any) ,@(cdr vex)))
1772-
((dict_comprehension)
1773-
`(typed_dict_comprehension (=> (top Any) (top Any)) ,@(cdr vex)))
1774-
((dict)
1775-
`(typed_dict (=> (top Any) (top Any)) ,@(cdr vex)))
1776-
((hcat)
1777-
`(cell2d 1 ,(length (cdr vex)) ,@(cdr vex)))
1778-
(else ; (vcat ...)
1779-
(if (and (pair? (cadr vex)) (eq? (caadr vex) 'row))
1780-
(let ((nr (length (cdr vex)))
1781-
(nc (length (cdadr vex))))
1782-
;; make sure all rows are the same length
1783-
(if (not (every
1784-
(lambda (x)
1785-
(and (pair? x)
1786-
(eq? (car x) 'row)
1787-
(length= (cdr x) nc)))
1788-
(cddr vex)))
1789-
(error "inconsistent shape in cell expression"))
1790-
`(cell2d ,nr ,nc
1791-
,@(apply append
1792-
;; transpose to storage order
1793-
(apply map list
1794-
(map cdr (cdr vex))))))
1795-
(if (any (lambda (x) (and (pair? x)
1796-
(eq? (car x) 'row)))
1797-
(cddr vex))
1798-
(error "inconsistent shape in cell expression")
1799-
`(cell1d ,@(cdr vex))))))))))
1763+
(error "{} syntax for Any arrays / dicts has been removed in 0.4dev"))
18001764

18011765
;; cat expression
18021766
((eqv? t #\[ )

0 commit comments

Comments
 (0)