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

End location of if without semicolon #168

Closed
czosel opened this issue Aug 1, 2018 · 5 comments
Closed

End location of if without semicolon #168

czosel opened this issue Aug 1, 2018 · 5 comments
Assignees

Comments

@czosel
Copy link
Collaborator

czosel commented Aug 1, 2018

I was surprised that (mind the empty line 2)

<?php if ($foo) ?>

is parsed with loc.end.line == 2,

...
    {
      "kind": "if",
      "loc": {
        "source": "if ($foo) ?>\n",
        "start": {
          "line": 1,
          "column": 6,
          "offset": 6
        },
        "end": {
          "line": 2,
          "column": 0,
          "offset": 19
        }
      },
      ...

While

<?php if ($foo); ?>

is parsed with loc.end.line == 1:

...
    {
      "kind": "if",
      "loc": {
        "source": "if ($foo);",
        "start": {
          "line": 1,
          "column": 6,
          "offset": 6
        },
        "end": {
          "line": 1,
          "column": 16,
          "offset": 16
        }
      },
      ...

Is this a bug, or actually intended? Thanks in advance!

@ichiriac
Copy link
Member

ichiriac commented Aug 1, 2018

I need to investigate more deeper but seems to be a bug. I'll start my vacations in 2 weeks, I'll work on a serious release then.

@czosel
Copy link
Collaborator Author

czosel commented Aug 1, 2018

Perfect, thanks for looking into this! 👍

@ichiriac
Copy link
Member

that comes from the fact ?> eats the next line return and acts exactly as a ; so it was included into the if node - I'll fix the problem by ignoring this token - and handle it with the future Script node

@czosel
Copy link
Collaborator Author

czosel commented Aug 12, 2018

Awesome, thanks! 👍

@ichiriac
Copy link
Member

This fix is now relased under 3.0.0-alpha.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants