Skip to content

Commit

Permalink
Implement @__LOCATION__ magic macro
Browse files Browse the repository at this point in the history
Fixes #8066
  • Loading branch information
ihnorton committed Aug 21, 2015
1 parent e0b4510 commit df724cc
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2038,15 +2038,18 @@
(take-token s)
(with-space-sensitive
(let* ((head (parse-unary-prefix s))
(t (peek-token s)))
(if (ts:space? s)
`(macrocall ,(macroify-name head)
,@(parse-space-separated-exprs s))
(let ((call (parse-call-chain s head #t)))
(if (and (pair? call) (eq? (car call) 'call))
`(macrocall ,(macroify-name (cadr call)) ,@(cddr call))
`(macrocall ,(macroify-name call)
,@(parse-space-separated-exprs s))))))))
(t (peek-token s))
(rval
(if (ts:space? s)
`(macrocall ,(macroify-name head)
,@(parse-space-separated-exprs s))
(let ((call (parse-call-chain s head #t)))
(if (and (pair? call) (eq? (car call) 'call))
`(macrocall ,(macroify-name (cadr call)) ,@(cddr call))
`(macrocall ,(macroify-name call)
,@(parse-space-separated-exprs s)))))))
(if (eqv? head '__LOCATION__) `(let ,rval (= __LOCATION__ ,(line-number-node s)))
rval))))

;; command syntax
((eqv? t #\`)
Expand Down

0 comments on commit df724cc

Please sign in to comment.