[antlr-interest] Build AST in multilexer

Bryan Ewbank ewbank at gmail.com
Mon May 29 11:51:36 PDT 2006


I think you are misreading the problem.  I suspect that you are
overwriting the <CICS> node, rather than having the java code executed
before the CICS node is created.  If you print out the EXEC at the
beginnning of your java block, then again at the end, you will
probably see
   // before
   #( EXEC CICS )
   // after
   #( EXEC comandoCICS )
I don't have my environment handy, so cannot verify this.  What you
most lilely need to do is simply be more careful in building the tree
so that you don't clip off the CICS that is already there.

- Bryan Ewbank

On 5/29/06, Jose Ventura <jose.ventura.roda at gmail.com> wrote:
>
> Hi all,
>
> I'm developing a multilexer to test CICS command embedded in cobol program.
> I have the next parser sentence (it's reduced):
>
> cobolSentence:
>    EXEC^ CICS {
>      Main.selector.push("CicsLex");
>      CicsParser b = new CicsParser (getInputState());
>      b.comando();
>      ## = #(##, b.getAST());
>     }
>   END_EXEC
>  ;
>
> I want to build the AST
>
>        EXEC
>               |---------->CICS
>                                  |------------>
> "comandoCICS"
>
> but, the result is
>
>        EXEC
>               |------------> "comandoCICS"
>
> How the java code after token CICS is executed before of creation CICS node,
> the CICS node is lost.
> How can I resolve this problem?
>
> Thanks in advance,
> José Ventura


More information about the antlr-interest mailing list