Skip to content

Commit

Permalink
lower precedence of postfix ... fixes JuliaLang#3456
Browse files Browse the repository at this point in the history
it's very unlikely that any code depends on the old parsing.
  • Loading branch information
JeffBezanson committed Jun 30, 2013
1 parent 99eaff6 commit 91b975c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@
(loop (list* (down s) loc ex) #f))
(loop (cons (down s) ex) #f)))))))))

; parse ranges and postfix ...
; colon is strange; 3 arguments with 2 colons yields one call:
; 1:2 => (: 1 2)
; 1:2:3 => (: 1 2 3)
Expand Down Expand Up @@ -542,6 +543,9 @@
(if first?
(loop (list t ex argument) #f)
(loop (append ex (list argument)) #t)))))
((eq? t '...)
(take-token s)
(list '... ex))
(else ex)))))

; the principal non-terminals follow, in increasing precedence order
Expand Down Expand Up @@ -704,14 +708,11 @@
(else
(parse-juxtapose (parse-factor s) s)))))

; handle ^, .^, and postfix ...
; handle ^ and .^
(define (parse-factor-h s down ops)
(let ((ex (down s)))
(let ((t (peek-token s)))
(cond ((eq? t '...)
(take-token s)
(list '... ex))
((not (memq t ops))
(cond ((not (memq t ops))
ex)
(else
(list 'call
Expand Down

0 comments on commit 91b975c

Please sign in to comment.