|
1650 | 1650 |
|
1651 | 1651 | ;; as above, but allows both "i=r" and "i in r"
|
1652 | 1652 | (define (parse-iteration-spec s)
|
1653 |
| - (let* ((outer? (if (eq? (peek-token s) 'outer) |
1654 |
| - (begin |
1655 |
| - (take-token s) |
1656 |
| - (let ((nxt (peek-token s))) |
1657 |
| - (if (or (memq nxt '(= in ∈)) |
1658 |
| - (not (symbol? nxt)) |
1659 |
| - (operator? nxt)) |
1660 |
| - (begin (ts:put-back! s 'outer #t) |
1661 |
| - #f) |
1662 |
| - #t))) |
1663 |
| - #f)) |
1664 |
| - (lhs (parse-pipe< s)) |
1665 |
| - (t (peek-token s))) |
1666 |
| - (cond ((memq t '(= in ∈)) |
1667 |
| - (take-token s) |
1668 |
| - (let* ((rhs (parse-pipe< s)) |
1669 |
| - (t (peek-token s))) |
1670 |
| - #;(if (not (or (closing-token? t) (newline? t))) |
1671 |
| - ;; should be: (error "invalid iteration specification") |
1672 |
| - (parser-depwarn s (string "for " (deparse `(= ,lhs ,rhs)) " " t) |
1673 |
| - (string "for " (deparse `(= ,lhs ,rhs)) "; " t))) |
1674 |
| - (if outer? |
1675 |
| - `(= (outer ,lhs) ,rhs) |
1676 |
| - `(= ,lhs ,rhs)))) |
1677 |
| - ((and (eq? lhs ':) (closing-token? t)) |
1678 |
| - ':) |
1679 |
| - (else (error "invalid iteration specification"))))) |
| 1653 | + ;; FIXME: this is just for backwards compatibility, allows newline before =/in/∈ in |
| 1654 | + ;; generator expressions |
| 1655 | + (define (peek-token- s) |
| 1656 | + (let ((t (peek-token s))) |
| 1657 | + (if (and for-generator (newline? t)) |
| 1658 | + (begin (take-token s) |
| 1659 | + (peek-token s)) |
| 1660 | + t))) |
| 1661 | + (let* ((lhs (let ((lhs- (with-space-sensitive (parse-pipe< s)))) |
| 1662 | + (if (eq? lhs- 'outer) |
| 1663 | + (let ((nxt (peek-token- s))) |
| 1664 | + (if (memq nxt '(= in ∈)) |
| 1665 | + lhs- |
| 1666 | + `(outer ,(parse-pipe< s)))) |
| 1667 | + lhs-))) |
| 1668 | + (t (peek-token- s))) |
| 1669 | + (if (memq t '(= in ∈)) |
| 1670 | + (begin |
| 1671 | + (take-token s) |
| 1672 | + `(= ,lhs ,(parse-pipe< s))) |
| 1673 | + (error "invalid iteration specification")))) |
1680 | 1674 |
|
1681 | 1675 | (define (parse-comma-separated-iters s)
|
1682 | 1676 | (let loop ((ranges '()))
|
|
0 commit comments