[antlr-interest] problem with using 2.7.6
Micheal J
open.zone at virgin.net
Sat Feb 4 20:09:52 PST 2006
You're still using the 2.7.5 C# runtime assembly(ies). You need to build and use the C# runtime assembly(ies) that comes with 2.7.6 instead. There's a VS.NET solution and/or a NAnt build script to help with that in $ANTLR_DIR$\lib\csharp.
Cheers,
Micheal
-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Ëï¼Í¸Õ Jigang (Robert) Sun
Sent: 05 February 2006 01:11
To: antlr-interest at antlr.org
Subject: [antlr-interest] problem with using 2.7.6
Here is my grammar--
primaryExp returns [object r=null] {object e;}
:
num:INTEGER_LITERAL {r=int.Parse(num.getText());}
| "true" {r=true;}
| "false" {r=false;}
| id:ID {r=retrive(id.getText());}
|"new" "int" LSQUARE e=expression RSQUARE
{if (e is System.Int32)
r=new int [(System.Int32)e];
else
Console.WriteLine("Integer type data expected");
} //new int[3],
| "new" idd:ID LPAREN RPAREN{}// r= new idd.getText() ();} // new a()
;
Antlr 2.7.6 generates --
...
try { // for error handling
switch ( LA(1) )
{
case INTEGER_LITERAL:
{
num = LT(1);
num_AST = astFactory.create(num);
astFactory.addASTChild(ref currentAST, num_AST);
match(INTEGER_LITERAL);
r=int.Parse(num.getText());_ttype = INTL;
primaryExp_AST = currentAST.root;
break;
}
....
C# compiler reports the following statement has some invalid argument, Argument '1' should not be passed with 'ref' keyword:
astFactory.addASTChild(ref currentAST, num_AST);
The above grammar works ok with 2.7.5
Cheers
Jigang
_____
雅虎1G免费邮箱百分百防垃圾信 <http://cn.mail.yahoo.com>
雅虎助手-搜索、杀毒、防骚扰 <http://cn.zs.yahoo.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060205/92021704/attachment.html
More information about the antlr-interest
mailing list