[antlr-interest] Switching buildAST to true causes "InvalidASTnode type" error.

Micheal J open.zone at virgin.net
Thu Dec 8 06:47:29 PST 2005


Sorry about the delay in replying. This is the fix I mentioned previously
for the issue in ASTFactory.cs.

It is a replacement for the existing setMaxNodeType(). It's probably best to
try it with 2.7.6.

--------------------------------------------------------------------
public void setMaxNodeType( int NodeType )
{
	//Debug.WriteLine(this, "NodeType = " + NodeType + " and
NodeList.Length = " + nodeTypeList_.Length);
	if (heteroList_ == null)
	{
		heteroList_ = new FactoryEntry[NodeType+1];
	}
	else
	{
		int length = heteroList_.Length;

		if ( NodeType >= length )
		{
			FactoryEntry[] newList = new
FactoryEntry[NodeType+1];
			Array.Copy(heteroList_, 0, newList, 0, length);
			heteroList_ = newList;
		}
		else if ( NodeType < length )
		{
			FactoryEntry[] newList = new
FactoryEntry[NodeType+1];
			Array.Copy(heteroList_, 0, newList, 0,
(NodeType+1));
			heteroList_ = newList;
		}
	}
	//Debug.WriteLine(this, "NodeType = " + NodeType + " and
NodeList.Length = " + nodeTypeList_.Length);
}
------------------------------------------------------------



More information about the antlr-interest mailing list