[stringtemplate-interest] Output error?

Glenn Williams glw at iosemantics.com
Fri May 5 08:01:45 PDT 2006


MessageThanks. That did it.
  ----- Original Message ----- 
  From: Micheal J 
  To: stringtemplate-interest at antlr.org 
  Sent: Friday, May 05, 2006 9:03 AM
  Subject: RE: [stringtemplate-interest] Output error?


  Ensure you're using the right lexer. You want the AngleBracketTemplateLexer. Try setting it explicitly.
    -----Original Message-----
    From: stringtemplate-interest-bounces at antlr.org [mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Glenn Williams
    Sent: 05 May 2006 15:10
    To: stringtemplate-interest at antlr.org
    Subject: [stringtemplate-interest] Output error?


    The following code from the String Template Documentation page is returning "<type> <name>" when it should be returning "int foo".  If I load this from a single file the output is "vardef(type,name) ::= <type> <name>;". What am I doing wrong?

    /// template
    group simple;

    vardef(type,name) ::= "<type> <name>;"

    method(type,name,args) ::= <<
    <type> <name>(<args; separator=",">) {
      <statements; separator="\n">
    }
    >>


    /// code  

    StringTemplateGroup groupf;
      try
      {
       groupf = new StringTemplateGroup( new FileReader(
         "simple.st" ) );
       StringTemplate t = groupf.getInstanceOf( "vardef" );
       t.setAttribute( "type", "int" );
       t.setAttribute( "name", "foo" );
       System.out.println( t );
      }
      catch ( FileNotFoundException e )
      {
       e.printStackTrace();
      }



------------------------------------------------------------------------------


  _______________________________________________
  stringtemplate-interest mailing list
  stringtemplate-interest at antlr.org
  http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20060505/a26a12d2/attachment.html


More information about the stringtemplate-interest mailing list