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

documentation bug #71

Closed
verhas opened this issue Jan 21, 2014 · 7 comments
Closed

documentation bug #71

verhas opened this issue Jan 21, 2014 · 7 comments

Comments

@verhas
Copy link

verhas commented Jan 21, 2014

Seems to be a copy/paste error in the documentation on page

https://github.com/sirthias/parboiled/wiki/Action-Variables

in the example. Seems

Rule Verbatim() {
    StringVar text = new StringVar("");
    StringVar temp = new StringVar("");
    return Sequence(
        StringVar text = new StringVar("");
        StringVar temp = new StringVar("");
        return Sequence(
            OneOrMore(
                ZeroOrMore(BlankLine(), temp.append("\n")),
                NonblankIndentedLine(), text.append(temp.getAndSet(""), pop().getText())
            ),
            push(new VerbatimNode(text.get()))
        );
    );
}

just has doubled copy of the first few lines.

@sirthias
Copy link
Owner

Ah, thanks for reporting!
I think you should be able to fix the problem yourself, since the docs are a wiki.
Would you like to give it a go?

@verhas
Copy link
Author

verhas commented Jan 23, 2014

I was not aware I had write access.

On Thu, Jan 23, 2014 at 3:51 PM, Mathias notifications@github.com wrote:

Ah, thanks for reporting!
I think you should be able to fix the problem yourself, since the docs are a wiki.

Would you like to give it a go?

Reply to this email directly or view it on GitHub:
#71 (comment)

@sirthias
Copy link
Owner

Can you check?

@verhas
Copy link
Author

verhas commented Jan 23, 2014

I edited, you check :-)

On Thu, Jan 23, 2014 at 4:54 PM, Mathias notifications@github.com wrote:

Can you check?

Reply to this email directly or view it on GitHub:
#71 (comment)

@sirthias
Copy link
Owner

Cool, thanks!

@verhas
Copy link
Author

verhas commented Jan 24, 2014

I was reading the documentation and API of parboiled and was wandering on a few things.

Why do you encode the syntax definition into JVM code? Syntax definition is a data structure and it could be encoded into a structure of Java objects that you build up when the parser definition code is executed. This approach would not require asm library and proxy classes and all such things.

However, if you chose to let the user encode the syntax into methods and since you need proxies to cut off the wire when descending into recursive call stack, why do you generate the proxies during run time? I see nothing against annotation processor solution to this issue (btw, an issue that I can not see why was created at the first place)?

Dipl. Ing. Peter Verhas
peter@verhas.com
+41791542095
skype: verhas

On 2014.01.23., at 16:57, Mathias notifications@github.com wrote:

Cool, thanks!


Reply to this email directly or view it on GitHub.

@sirthias
Copy link
Owner

Syntax definition is a data structure and it could be encoded into a structure of Java objects that you build up when the parser definition code is executed.

This is exactly what is happening. The rule method code does create a data structure of java objects.

This approach would not require asm library and proxy classes and all such things.

Bytecode rewriting via ASM is mainly done to support inline parser action logic without the need for anonymous inner classes. It does enable something like "parsing-specific closures/lambdas".

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

No branches or pull requests

2 participants