Skip to content

Commit

Permalink
allow x[i,j;k] syntax to be parsed #7225
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebolewski committed Sep 18, 2014
1 parent c4dc379 commit f8e66b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,10 @@
(cons 'vcat (reverse (cons nxt lst))))
(loop (cons nxt lst) (parse-eq* s))))
((#\;)
(error "unexpected semicolon in array expression"))
(if (eqv? (require-token s) closer)
(loop lst nxt)
(let ((params (parse-arglist s closer)))
`(vcat ,@params ,@lst ,nxt))))
((#\] #\})
(error (string "unexpected \"" t "\"")))
(else
Expand Down
21 changes: 14 additions & 7 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,10 @@

'ref
(lambda (e)
(expand-forms (partially-expand-ref e)))
(let ((args (cddr e)))
(if (has-parameters? args)
(error "unexpected semicolon in array expression")
(expand-forms (partially-expand-ref e)))))

'curly
(lambda (e)
Expand All @@ -1690,11 +1693,13 @@
(let ((f (cadr e)))
(cond ((and (pair? (caddr e))
(eq? (car (caddr e)) 'parameters))
;; (call f (parameters . kwargs) ...)
(expand-forms
(receive
(kws args) (separate kwarg? (cdddr e))
(lower-kw-call f (append kws (cdr (caddr e))) args))))
(if (eq? f 'vcat)
(error "unexpected semicolon in array expression")
;; (call f (parameters . kwargs) ...)
(expand-forms
(receive
(kws args) (separate kwarg? (cdddr e))
(lower-kw-call f (append kws (cdr (caddr e))) args)))))
((any kwarg? (cddr e))
;; (call f ... (kw a b) ...)
(expand-forms
Expand Down Expand Up @@ -1777,7 +1782,9 @@
'cell1d
(lambda (e)
(let ((args (cdr e)))
(cond ((any vararg? args)
(cond ((has-parameters? args)
(error "unexpected semicolon in array expression"))
((any vararg? args)
(expand-forms
`(call (top cell_1d) ,@args)))
(else
Expand Down

0 comments on commit f8e66b8

Please sign in to comment.