Skip to content

Commit

Permalink
fix #20575, syntax error for juxtaposing a string literal
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed May 10, 2017
1 parent d394a93 commit 89e9083
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/julia-parser.scm
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,11 @@
)
(not (ts:space? s))
(not (operator? t))
(not (initial-reserved-word? t))
(not (closing-token? t))
(not (newline? t))
(or (not (string? expr)) ;; issue #20575
(error "cannot juxtapose string literal"))
(not (initial-reserved-word? t))
(not (and (pair? expr) (syntactic-unary-op? (car expr))))
;; TODO: this would disallow juxtaposition with 0, which is ambiguous
;; with e.g. hex literals `0x...`. however this is used for `0im`, which
Expand Down
4 changes: 4 additions & 0 deletions test/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,10 @@ f21586(; @m21586(a), @m21586(b)) = a + b
end
@test Test21604.X(1.0) === Test21604.X(1.0)

# issue #20575
@test_throws ParseError parse("\"a\"x")
@test_throws ParseError parse("\"a\"begin end")

# comment 298107224 on pull #21607
module Test21607
using Base.Test
Expand Down

0 comments on commit 89e9083

Please sign in to comment.