[antlr-interest] still dealing with ST

Warner Onstine warnero at gmail.com
Mon Aug 27 16:29:38 PDT 2007


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Model.g
Type: application/octet-stream
Size: 1852 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20070827/b7d1f26d/attachment.obj 


More information about the antlr-interest mailing list