[antlr-interest] Problem finding Template
Dr. Kocher, Hartmut
h.kocher at pharmatechnik.de
Fri Jan 26 00:35:51 PST 2007
I'll try this solution. How does the label help here?
I cannot use the pre-beta as it doesn't generate C# code yet (some templates seem to have changed and StringTemplates complains that the C#-template does not match the interface).
But I still don't quite understand: ANTLR tries to load a template which obviously isn't there. So either you have to include that template or you must change the part, which uses the template... Or am I missing something?
Thanks
Hartmut
-----Ursprüngliche Nachricht-----
Von: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] Im Auftrag von Terence Parr
Gesendet: Freitag, 26. Januar 2007 00:26
An: ANTLR List
Betreff: Re: [antlr-interest] Problem finding Template
Hi. I think ID^^ is the problem, but not sure why... seems it
doesn't like it for some reason. Hmm...try 3.0 pre-b6 from site, but
you can try using a label on any token^^ to avoid I think.
Ter
On Jan 25, 2007, at 3:22 PM, Dr. Hartmut Kocher wrote:
> Hi,
>
>
>
> using ANTLR 3.0B5, I get an exception when I parse my grammar: error
> (10): internal error: Test.g : java.lang.IllegalArgumentException:
> Can't find template tokenRefRuleRootTrack.st
>
>
>
> Has anybody encountered this?
>
>
>
> Here's a simple grammar to show the effect:
>
>
>
> Thanks.
>
>
>
> grammar Test;
>
>
>
> options {
>
> language=CSharp;
>
> output=AST;
>
> ASTLabelType=CommonTree;
>
> }
>
>
>
> tokens { KK; }
>
>
>
> logic : logicalExpression EOF;
>
>
>
> logicalExpression : expr ('and'^^ expr)*;
>
>
>
> expr : term ('or'^^ term)*;
>
>
>
> term : (ID^^|lp=INT -> ^(KK[$lp] INT)| '('! logicalExpression^^
> ')'!);
>
>
>
> zahl :lp=INT -> ^(KK[$lp] INT);
>
>
>
> fragment DIGIT : '0'..'9';
>
>
>
> fragment LETTER : ('a'..'z'|'A'..'Z');
>
>
>
> INT : DIGIT+;
>
>
>
> ID : LETTER (LETTER|'_'|DIGIT)+;
>
>
>
>
>
> WS : (' '|'\r'|'\t'|'\f'|'\n')+ { $channel=HIDDEN; };
>
>
>
> SL_COMMENT :
>
> '//'
>
> ( options { greedy=false; } : . )*
>
> ( '\r' | '\r\n' | '\n' )
>
> { $channel=HIDDEN; }
>
> ;
>
>
>
> // multiple-line comments
>
> ML_COMMENT :
>
> '/*'
>
> ( options {greedy=false;} : . )*
>
> '*/'
>
> { $channel=HIDDEN; }
>
> ;
>
>
>
>
>
>
>
> Dr. Hartmut Kocher
>
> Cortex Brainware Consulting & Training GmbH
>
> Kirchplatz 5
> D-82049 Pullach
>
> Tel: +49 (89) 744 850 0
> Fax: +49 (89) 744 850 11
>
> http://www.cortex-brainware.de
>
> E-Mail: hwk at cortex-brainware.de
>
> Handelsregister:
> Registergericht: Amtsgericht München
> HRB-Nr. 120614
>
> Vertretungsberechtigte Geschäftsführer:
> Dipl.-Inform. Dorothea Burger, Dr.-Ing. Hartmut Kocher, Dr.-Ing.
> Martin Lang, Dr. rer. nat. Rolf Peter Wehrum
>
>
>
>
More information about the antlr-interest
mailing list