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

Fixes locations for long string literals. #37

Closed
wants to merge 1 commit into from

Conversation

paulcuth
Copy link

@paulcuth paulcuth commented Oct 3, 2016

I don't fully understand the code around locations, but this does fix the issue in my use case.

Fixes #36

@oxyc
Copy link
Collaborator

oxyc commented Oct 6, 2016

Thanks for your research and PR! Unfortunately I dont have access to a dev environment where I can test this at the moment. Unless @fstirlitz gets to it first, I'll be back to my laptop in a week or so

@fstirlitz
Copy link
Owner

The start position is good, but the end position is now wrong. Your own example from #36:

/* ... */
        {
          "type": "StringLiteral",
          "value": "hello\nworld",
          "raw": "[[hello\nworld]]",
          "loc": {
            "start": {
              "line": 1,
              "column": 10
            },
            "end": {
              "line": 1,
              "column": 25
            }
          }
        }
/* ... */

Also, please add some testcases. Something like

x = [[hello@n@world]]
x = { 1, 2, [[hello@n@@n@world]], @n@ 3 }

into test/scaffolding/literals and then run make scaffold-tests. To run tests, make test.

@fstirlitz
Copy link
Owner

Cherry-picked in 4b56017.

@fstirlitz fstirlitz closed this Feb 10, 2017
@fstirlitz fstirlitz added the incorrect parsing Valid Lua code fails to parse, is parsed incorrectly, or invalid Lua code is accepted label Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incorrect parsing Valid Lua code fails to parse, is parsed incorrectly, or invalid Lua code is accepted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Locations of long string literals
3 participants