Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Support for HEREDOC strings #78

Open
zharinov opened this issue Nov 3, 2021 · 1 comment
Open

Support for HEREDOC strings #78

zharinov opened this issue Nov 3, 2021 · 1 comment

Comments

@zharinov
Copy link
Collaborator

zharinov commented Nov 3, 2021

Perceived Problem

We can't define them at the lexer level because code may contain non-standard begin/end markers.

Ideas / Proposed Solution(s)

These two moo.Lexer methods should be used:

save(): LexerState;
reset(chunk?: string, state?: LexerState): this;

The idea:

  • Stop normal processing: call lexer.save() once HEREDOC start is encountered
  • Process HEREDOC fragment using custom code or sub-lexer and return single string token as result
  • Continue normal processing: call lexer.reset(input, state) with the the input and state values corresponding the position immediately after HEREDOC
@zharinov
Copy link
Collaborator Author

zharinov commented Nov 3, 2021

It will be essential for Ruby parser

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

No branches or pull requests

1 participant