diff --git a/src/julia-parser.scm b/src/julia-parser.scm index febb3a269a46f..770d21d893c44 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -1272,11 +1272,13 @@ (parse-raw-literal s t))) (nxt (peek-token s)) (macname (macroify-name ex (macsuffix t)))) - (if (and (symbol? nxt) (not (operator? nxt)) + (if (and (or (symbol? nxt) (number? nxt) (large-number? nxt)) (not (operator? nxt)) (not (ts:space? s))) ;; string literal suffix, "s"x (loop `(macrocall ,macname ,startloc ,macstr - ,(string (take-token s)))) + ,(if (symbol? nxt) + (string (take-token s)) + (take-token s)))) (loop `(macrocall ,macname ,startloc ,macstr)))) ex)) (else ex)))))) diff --git a/test/syntax.jl b/test/syntax.jl index 75c70112044fd..e20037a6859c0 100644 --- a/test/syntax.jl +++ b/test/syntax.jl @@ -60,6 +60,9 @@ macro test999_str(args...); args; end a b""" == ("a\nb",) +# make sure a trailing integer, not just a symbol, is allowed also +@test test999"foo"123 == ("foo", 123) + # issue #5997 @test_throws ParseError Meta.parse(": x") @test_throws ParseError Meta.parse("""begin