diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 36981c0ea0d50..5ee45a202ce46 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -70,6 +70,11 @@ (define syntactic-op? (Set syntactic-operators)) (define syntactic-unary-op? (Set syntactic-unary-operators)) +(define (symbol-or-interpolate? ex) + (or (symbol? ex) + (and (pair? ex) + (eq? '$ (car ex))))) + (define trans-op (string->symbol ".'")) (define ctrans-op (string->symbol "'")) (define vararg-op (string->symbol "...")) @@ -1240,8 +1245,8 @@ body)))) ((export) (let ((es (map macrocall-to-atsym - (parse-comma-separated s parse-atom)))) - (if (not (every symbol? es)) + (parse-comma-separated s parse-unary-prefix)))) + (if (not (every symbol-or-interpolate? es)) (error "invalid \"export\" statement")) `(export ,@es))) ((import using importall) @@ -1322,17 +1327,17 @@ (begin (take-token s) (loop (list* '|.| '|.| '|.| '|.| l) (peek-token s)))) (else - (cons (macrocall-to-atsym (parse-atom s)) l))))) + (cons (macrocall-to-atsym (parse-unary-prefix s)) l))))) (define (parse-import s word) (let loop ((path (parse-import-dots s))) - (if (not (symbol? (car path))) + (if (not (symbol-or-interpolate? (car path))) (error (string "invalid \"" word "\" statement: expected identifier"))) (let ((nxt (peek-token s))) (cond ((eq? nxt '|.|) (take-token s) - (loop (cons (macrocall-to-atsym (parse-atom s)) path))) + (loop (cons (macrocall-to-atsym (parse-unary-prefix s)) path))) ((or (memv nxt '(#\newline #\; #\, :)) (eof-object? nxt)) `(,word ,@(reverse path)))