Thanks!  I think that would work!...  I like that better than keeping it in the 
adaptor or code base, because we view the syntax grammar as the defining 
authority.



Roger Pomeroy
Associate Technical Fellow
Aerodynamics/Geometry
Phone  425-237-2568



________________________________
From: sablecc-discussion-bounces+roger.c.pomeroy=boeing....@lists.sablecc.org 
[mailto:sablecc-discussion-bounces+roger.c.pomeroy=boeing....@lists.sablecc.org]
 On Behalf Of Etienne M. Gagnon
Sent: Tuesday, July 12, 2011 4:31 PM
To: Discussion mailing list for the SableCC project
Subject: Re: Inserting "constant" node in the AST

Hi Roger,

There's currently no support for this. But, how about creating an empty 
production where the name of the production encodes the version:

...
Productions
  program = version ...;
  version = v10;
  v10 = ;


Of course, you would need to devise an encoding that conforms to SableCC's 
identifier syntax.

Have fun!

Etienne

I need to be able to track the revision number of my syntax, so that a user can 
know what version they are using.

I would like be able to somehow define a string that would automatically be 
inserted in the AST of my tree and be able to return that string.  (Basically, 
I want a node that returns a token to always appear in the tree, regardless of 
whether that token *actually* occurs in the input file that I am parsing)

Is there a good way to do this?  I can generate the node in the AST without any 
problem, but feeding it the desired string is what I dont see how to do....



--
Etienne M. Gagnon, Ph.D.
SableCC:                                            http://sablecc.org

_______________________________________________
SableCC-Discussion mailing list
[email protected]
http://lists.sablecc.org/listinfo/sablecc-discussion

Reply via email to