[antlr-interest] A problem with loading AST Node type (screen
picattached)
Micheal J
open.zone at virgin.net
Tue Feb 7 10:02:24 PST 2006
Nothing springs to mind that can help directly. I can only confirm that the heteroAST examples works fine here (.NET 1.1) and it's doing exactly what you are.
- Does that example work on your system?
- Did you build a .NET 2.0 version of the antlr.runtime.dll?
Micheal
-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Ëï¼Í¸Õ Jigang (Robert) Sun
Sent: 07 February 2006 17:39
To: antlr-interest at antlr.org
Subject: [antlr-interest] A problem with loading AST Node type (screen picattached)
A problem with loading AST Node type occured.
Here is my simplest grammar:
primaryExp
:
INTEGER_LITERAL <AST=INTNode>
;
INTNode class under my namespace (all generated classes and main class are all in the same name space)
public abstract class Expr : antlr.BaseAST{
public abstract int value();
}
public class INTNode:Expr{
int val=0;
public INTNode(Token tok){
val=int.Parse(tok.getText());
}
public override int value(){
return val;
}
public override void initialize(AST t){
}
public override void initialize(IToken t){
}
public override void initialize(int i,string s){
}
}
Error occurs when the following method of class ASTFactor y was trying to load my INTNode:
private Type loadNodeTypeObject(string nodeTypeName)
{
Type nodeTypeObject = null;
bool typeCreated = false;
if (nodeTypeName != null)
{
foreach (Assembly assem in AppDomain.CurrentDomain.GetAssemblies())
{
try
{
nodeTypeObject = assem.GetType(nodeTypeName);
if (nodeTypeObject != null)
{
typeCreated = true;
break;
}
}
catch
{
typeCreated = false;
}
}
}
if (!typeCreated)
{
throw new TypeLoadException("Unable to load AST Node Type: '" + nodeTypeName + "'");
}
return nodeTypeObject;
}
the error message is "Unable to load AST Node". I checked locals windows (stepping run mode), found that the node INTNode is "non_public member" as showed on attched picture. I got puzzuled since my class was declared as public.
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/20060207/a77206f4/attachment.html
More information about the antlr-interest
mailing list