diff --git a/src/ast.scm b/src/ast.scm index b7380bfe3bb33..a372fdd295e61 100644 --- a/src/ast.scm +++ b/src/ast.scm @@ -195,7 +195,9 @@ (cadr (caddr e)) e)) -(define (dotop? o) (and (symbol? o) (eqv? (string.char (string o) 0) #\.))) +(define (dotop? o) (and (symbol? o) (eqv? (string.char (string o) 0) #\.) + (not (eq? o '|.|)) + (not (eqv? (string.char (string o) 1) #\.)))) ; convert '.xx to 'xx (define (undotop op) @@ -207,7 +209,9 @@ (define (maybe-undotop e) (if (symbol? e) (let ((str (string e))) - (if (eqv? (string.char str 0) #\.) + (if (and (eqv? (string.char str 0) #\.) + (not (eq? e '|.|)) + (not (eqv? (string.char str 1) #\.))) (symbol (string.sub str 1 (length str))) #f)) (if (pair? e) diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 44692bb8dff6f..2825d07d69f40 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -108,8 +108,7 @@ (define dot-opchar? (Set (delete-duplicates (map (lambda (op) (string.char (string op) 1)) - (filter (lambda (op) (and (dotop? op) (not (eq? op '|.|)))) - operators))))) + (cons `|..| (filter dotop? operators)))))) (define operator? (Set operators)) (define initial-reserved-words '(begin while if for try return break continue diff --git a/test/parse.jl b/test/parse.jl index 88d1ebbb259d4..6ccb86cf7a052 100644 --- a/test/parse.jl +++ b/test/parse.jl @@ -863,3 +863,7 @@ end @test QualifiedStringMacro.SubModule.x"" === 1 @test QualifiedStringMacro.SubModule.y`` === 2 + +let ..(x,y) = x + y + @test 3 .. 4 === 7 +end