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

Support multilines javascript #39

Closed
Applelo opened this issue Nov 14, 2019 · 2 comments · Fixed by #42
Closed

Support multilines javascript #39

Applelo opened this issue Nov 14, 2019 · 2 comments · Fixed by #42
Assignees
Labels
type: bug Functionality that does not work as intended/expected

Comments

@Applelo
Copy link

Applelo commented Nov 14, 2019

I get an error when I use multiline javascript with pug.

Error: Unhandled token: {"type":"blockcode","loc":{"start":{"line":6,"column":3},"end":{"line":6,"column":4}}}
-
  const options = {
    fields: {},
    rules: {},
  }
@Shinigami92
Copy link
Member

Shinigami92 commented Nov 15, 2019

Things getting complicated 😂


The token stream for your example

{"type":"blockcode","loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}}
{"type":"start-pipeless-text","loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":2}}}
{"type":"text","loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":20}},"val":"const options = {"}
{"type":"newline","loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":3}}}
{"type":"text","loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":16}},"val":"  fields: {},"}
{"type":"newline","loc":{"start":{"line":4,"column":1},"end":{"line":4,"column":3}}}
{"type":"text","loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":15}},"val":"  rules: {},"}
{"type":"newline","loc":{"start":{"line":5,"column":1},"end":{"line":5,"column":3}}}
{"type":"text","loc":{"start":{"line":5,"column":3},"end":{"line":5,"column":4}},"val":"}"}
{"type":"end-pipeless-text","loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":4}}}
{"type":"eos","loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":4}}}

The value of token text (index 4) will currently be trimmed
I have to find a good way to prevent this

@Shinigami92
Copy link
Member

I hope I did not introduce more bugs than I fixed... 😅

@Shinigami92 Shinigami92 added the type: bug Functionality that does not work as intended/expected label May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants