Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string literal juxtaposition shouldnt be allowed #116

Open
vdayanand opened this issue Sep 11, 2023 · 1 comment
Open

string literal juxtaposition shouldnt be allowed #116

vdayanand opened this issue Sep 11, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@vdayanand
Copy link

vdayanand commented Sep 11, 2023

1"test" is not a valid syntax but is allowed

(source_file [0, 0] - [1, 0]
 (juxtaposition_expression [0, 0] - [0, 4]
   (integer_literal [0, 0] - [0, 1])
   (string_literal [0, 1] - [0, 4])))

in julia

julia> 1"test"
ERROR: syntax: cannot juxtapose string literal
Stacktrace:
 [1] top-level scope
   @ none:1

@savq savq added the bug Something isn't working label Sep 21, 2023
@fredrikekre
Copy link

I believe this bug messes with docstring parsing/detection too, e.g. I had something like

x = 1

"""
docs
"""
function f(x)
    # body
end

which parses as

(assignment) ; [1:1 - 5:3]
 (identifier) ; [1:1 - 1]
 (operator) ; [1:3 - 3]
 (juxtaposition_expression) ; [1:5 - 5:3]
  (integer_literal) ; [1:5 - 5]
  (string_literal) ; [3:1 - 5:3]
(function_definition) ; [6:1 - 8:3]
 (signature) ; [6:10 - 13]
  (call_expression) ; [6:10 - 13]
   (identifier) ; [6:10 - 10]
   (argument_list) ; [6:11 - 13]
    (identifier) ; [6:12 - 12]
 (line_comment) ; [7:5 - 10]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants