Quantcast

Was using LAST_NODE with parboiled 0.97, struggling to replace it

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Was using LAST_NODE with parboiled 0.97, struggling to replace it

Thibaut Colar
Hi, I have bee using parboiled since version 0.97x.

In my parser I use to call special actions to create "custom" AST nodes using the last_node() method.

https://bitbucket.org/tcolar/fantomidemodule/src/0c0f8dd73c96/src/net/colar/netbeans/fan/parboiled/FantomParserAstActions.java

parser that uses it:
https://bitbucket.org/tcolar/fantomidemodule/src/0c0f8dd73c96/src/net/colar/netbeans/fan/parboiled/FantomParser.java

I was creating an AST tree with back references to the (parse)Nodes.

Now I'm trying to use parboiled 1.x and struggling to figure to replace that. I assumed the "value stack" was probably going to be what to used, but it doesn't seem the last matched node is available when I try to peek/pop it within  FantomParserAstActions.java.

Could you advise me on a proper way to accomplish this (I get the feeling I'm doing this the "wrong way").

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Was using LAST_NODE with parboiled 0.97, struggling to replace it

mathias
Administrator
Thibaut,

the `lastNode` method was removed with the update from 0.9.7.3 to 0.9.8.0 (as you can also see from the CHANGELOG: https://github.com/sirthias/parboiled/blob/master/CHANGELOG).

Since then parboiled default behavior is to not create a parse tree at all.
You need to use the @BuildParseTree annotation on the parser in order to enable parse tree building.
When parse tree building is enabled you can access the created nodes from your action via the MatcherContext.

HTH and cheers,
Mathias

---
[hidden email]
http://www.parboiled.org

On 19.06.2012, at 21:55, Thibaut Colar [via parboiled users] wrote:

> Hi, I have bee using parboiled since version 0.97x.
>
> In my parser I use to call special actions to create "custom" AST nodes using the last_node() method.
>
> https://bitbucket.org/tcolar/fantomidemodule/src/0c0f8dd73c96/src/net/colar/netbeans/fan/parboiled/FantomParserAstActions.java
>
> parser that uses it:
> https://bitbucket.org/tcolar/fantomidemodule/src/0c0f8dd73c96/src/net/colar/netbeans/fan/parboiled/FantomParser.java
>
> I was creating an AST tree with back references to the (parse)Nodes.
>
> Now I'm trying to use parboiled 1.x and struggling to figure to replace that. I assumed the "value stack" was probably going to be what to used, but it doesn't seem the last matched node is available when I try to peek/pop it within  FantomParserAstActions.java.
>
> Could you advise me on a proper way to accomplish this (I get the feeling I'm doing this the "wrong way").
>
> Thanks.
>
> If you reply to this email, your message will be added to the discussion below:
> http://users.parboiled.org/Was-using-LAST-NODE-with-parboiled-0-97-struggling-to-replace-it-tp4024021.html
> To start a new topic under parboiled users, email [hidden email]
> To unsubscribe from parboiled users, click here.
> NAML

Loading...