From 20346f459f37e79a356374e193cdd803d8793f7b Mon Sep 17 00:00:00 2001 From: eeichinger Date: Wed, 29 Jul 2009 17:01:57 +0000 Subject: [PATCH] upgraded to antlr v.2.7.7.1 (latest 2.x dist) --- .../Expressions/Parser/antlr/ASTFactory.cs | 22 ++++++++++++++----- .../Expressions/Parser/antlr/InputBuffer.cs | 6 ++--- .../Expressions/Parser/antlr/SupportClass.cs | 3 +-- src/Spring/Spring.Core/README_ANTLR.txt | 2 +- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Spring/Spring.Core/Expressions/Parser/antlr/ASTFactory.cs b/src/Spring/Spring.Core/Expressions/Parser/antlr/ASTFactory.cs index 7c13d045..6769bdba 100644 --- a/src/Spring/Spring.Core/Expressions/Parser/antlr/ASTFactory.cs +++ b/src/Spring/Spring.Core/Expressions/Parser/antlr/ASTFactory.cs @@ -59,7 +59,7 @@ namespace Spring.Expressions.Parser.antlr /// Constructs an ASTFactory with the default AST node type of /// . /// - public ASTFactory() : this(typeof(CommonAST).FullName) + public ASTFactory() : this(typeof(antlr.CommonAST)) { } @@ -71,13 +71,25 @@ namespace Spring.Expressions.Parser.antlr /// Name of default AST node type for this factory. /// public ASTFactory(string nodeTypeName) + : this( loadNodeTypeObject(nodeTypeName) ) + { + } + + /// + /// Constructs an ASTFactory and use the specified AST node type + /// as the default. + /// + /// + /// MetaType of default AST node type for this factory. + /// + public ASTFactory(Type nodeType) { heteroList_ = new FactoryEntry[Token.MIN_USER_TYPE+1]; - defaultASTNodeTypeObject_ = loadNodeTypeObject(nodeTypeName); + defaultASTNodeTypeObject_ = nodeType; defaultCreator_ = null; typename2creator_ = new Hashtable(32, (float) 0.3); - typename2creator_["antlr.CommonAST"] = CommonAST.Creator; - typename2creator_["antlr.CommonASTWithHiddenTokens"] = CommonASTWithHiddenTokens.Creator; + typename2creator_[typeof(antlr.CommonAST).FullName] = CommonAST.Creator; + typename2creator_[typeof(antlr.CommonASTWithHiddenTokens).FullName] = CommonASTWithHiddenTokens.Creator; } @@ -555,7 +567,7 @@ namespace Spring.Expressions.Parser.antlr // PRIVATE FUNCTION MEMBERS //--------------------------------------------------------------------- - private Type loadNodeTypeObject(string nodeTypeName) + private static Type loadNodeTypeObject(string nodeTypeName) { Type nodeTypeObject = null; bool typeCreated = false; diff --git a/src/Spring/Spring.Core/Expressions/Parser/antlr/InputBuffer.cs b/src/Spring/Spring.Core/Expressions/Parser/antlr/InputBuffer.cs index 3a0ec7a4..16c8e32a 100644 --- a/src/Spring/Spring.Core/Expressions/Parser/antlr/InputBuffer.cs +++ b/src/Spring/Spring.Core/Expressions/Parser/antlr/InputBuffer.cs @@ -107,9 +107,9 @@ namespace Spring.Expressions.Parser.antlr } /*Get a lookahead character */ - public virtual char LA(int i) - { - fill(i); + public virtual char LA(int i) + { + fill(i); if ((this.markerOffset + i) <= this.queue.Count) { return (char)this.queue[(this.markerOffset + i) - 1]; diff --git a/src/Spring/Spring.Core/Expressions/Parser/antlr/SupportClass.cs b/src/Spring/Spring.Core/Expressions/Parser/antlr/SupportClass.cs index ee8f543b..615dfb15 100644 --- a/src/Spring/Spring.Core/Expressions/Parser/antlr/SupportClass.cs +++ b/src/Spring/Spring.Core/Expressions/Parser/antlr/SupportClass.cs @@ -1,5 +1,4 @@ using System; - namespace Spring.Expressions.Parser.antlr { internal class SupportClass @@ -30,4 +29,4 @@ namespace Spring.Expressions.Parser.antlr return URShift(number, (int)bits); } } -} \ No newline at end of file +} diff --git a/src/Spring/Spring.Core/README_ANTLR.txt b/src/Spring/Spring.Core/README_ANTLR.txt index aa42f390..676861fc 100644 --- a/src/Spring/Spring.Core/README_ANTLR.txt +++ b/src/Spring/Spring.Core/README_ANTLR.txt @@ -4,7 +4,7 @@ 28-07-2009 ---------- -*) Added codebase version 2.7.6 of antlr +*) Added codebase version 2.7.7 of antlr *) had to move ::SupportClass to namespace "antlr" *) Replaced Method antlr.InputBuffer.LA(int i) with