[antlr-interest] still dealing with ST
Terence Parr
parrt at cs.usfca.edu
Mon Aug 27 18:48:19 PDT 2007
Hi.
why the extra parens?
variableName=(variableDecl|ID)
That means result of a subrule not rule, which doesn't return
anything (at least for now).
Ter
On Aug 27, 2007, at 4:29 PM, Warner Onstine wrote:
> Ok, got around a few of my earlier issues and have started to create
> my template and rules for rewriting things, but I'm stuck on (I think)
> one of the last assignments. I will attach the grammar, but I want to
> highlight the section I'm currently having an issue with.
>
>
> variableAssignment
> : variableName=(variableDecl|ID) '='
> variableValue=(selectStatement|updateStatement|deleteStatement|ID) ->
> variable_assignment(var={$variableName.st},
> valueToAssign={$variableValue.st})
> ;
>
> No matter what I do the Java that is generated has issues here:
>
> {
> retval.st = templateLib.getInstanceOf
> ("variable_assignment",
> new STAttrMap().put("var",
> variableName.st).put("valueToAssign", variableValue.st));
>
> }
>
> It keeps saying that variableName.st and variableValue.st cannot be
> resolved. Further up in the file they are set to:
> Token variableName=null;
> Token variableValue=null;
>
> And I realize that I may doing something completely wrong here, but
> what I'm trying to do is to pass off the rendered template (sorry if
> the terminology is incorrect just stating it how I see it) to the
> calling template function (variable_assignment in this case). the
> variable_assignment function (in the STG file) shouldn't have to know
> what kind of variable is getting assigned etc. to actually just spit
> out the rendered text.
>
> Let me know if you want the generated Java file.
>
> -warner
> --
> Warner Onstine - Programmer/Author
> New book on Tapestry 4!
> Tapestry 101 available at
> http://sourcebeat.com/books/tapestrylive.html
> warner at warneronstine.com
> http://warneronstine.com/blog
> <Model.g>
More information about the antlr-interest
mailing list