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

Unable to parse heredoc inside a block properly #16

Open
bpradeep20 opened this issue Jul 23, 2018 · 7 comments
Open

Unable to parse heredoc inside a block properly #16

bpradeep20 opened this issue Jul 23, 2018 · 7 comments
Labels
bug Something isn't working question Further information is requested

Comments

@bpradeep20
Copy link

Config:

<main>
    PYTHON <<MYPYTHON
        def a():
            x = y
            return
    MYPYTHON
</main>

With python version of config parser I am getting parse error

But with perl version:

$VAR1 = {
          'main' => {
                      'PYTHON' => 'def a():
        x = y
        return'
                    }
        };

Can you please check?

@etingof
Copy link
Owner

etingof commented Jul 24, 2018

The issue here is that closing MYPYTHON anchor is indented. I've modified the lexer to allow that (see commit 8a9f5b3).

But now I am curious how would you include MYPYTHON content into the heredoc block? There should be some sort of escaping, right?

@etingof
Copy link
Owner

etingof commented Jul 30, 2018

Hmm, is it a good idea to allow whitespaces around the anchor? At least with bash, this is not allowed.

@bpradeep20
Copy link
Author

This is working with current version of code.

@etingof
Copy link
Owner

etingof commented Dec 5, 2018

It does, but I feel like this may break things elsewhere. May be we should better make this behavior configurable.

@bpradeep20
Copy link
Author

I agree. It would be great of we have some option to enable PERL heredoc and keep default as BASH here doc.

@etingof etingof added bug Something isn't working question Further information is requested labels Nov 17, 2019
@etingof
Copy link
Owner

etingof commented Nov 17, 2019

Hey, @sydneyli! Do you think this has been fixed lately?

@sydneyli
Copy link
Contributor

sydneyli commented Nov 18, 2019

The behavior in the original issue fixed, but extra whitespaces after the closing heredoc anchor seems to still break things.
Edit: It might be good to change the title of this issue to reflect the above?

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

No branches or pull requests

3 participants