summaryrefslogtreecommitdiffstats
path: root/poxml/antlr/antlr
diff options
context:
space:
mode:
Diffstat (limited to 'poxml/antlr/antlr')
-rw-r--r--poxml/antlr/antlr/ANTLRException.hpp60
-rw-r--r--poxml/antlr/antlr/AST.hpp108
-rw-r--r--poxml/antlr/antlr/ASTArray.hpp63
-rw-r--r--poxml/antlr/antlr/ASTFactory.hpp113
-rw-r--r--poxml/antlr/antlr/ASTNULLType.hpp72
-rw-r--r--poxml/antlr/antlr/ASTPair.hpp77
-rw-r--r--poxml/antlr/antlr/ASTRefCount.hpp104
-rw-r--r--poxml/antlr/antlr/BaseAST.hpp106
-rw-r--r--poxml/antlr/antlr/BitSet.hpp50
-rw-r--r--poxml/antlr/antlr/CharBuffer.hpp75
-rw-r--r--poxml/antlr/antlr/CharScanner.hpp265
-rw-r--r--poxml/antlr/antlr/CharStreamException.hpp18
-rw-r--r--poxml/antlr/antlr/CharStreamIOException.hpp20
-rw-r--r--poxml/antlr/antlr/CircularQueue.hpp88
-rw-r--r--poxml/antlr/antlr/CommonAST.hpp68
-rw-r--r--poxml/antlr/antlr/CommonASTWithHiddenTokens.hpp41
-rw-r--r--poxml/antlr/antlr/CommonHiddenStreamToken.hpp30
-rw-r--r--poxml/antlr/antlr/CommonToken.hpp77
-rw-r--r--poxml/antlr/antlr/InputBuffer.hpp158
-rw-r--r--poxml/antlr/antlr/LLkParser.hpp82
-rw-r--r--poxml/antlr/antlr/LexerSharedInputState.hpp49
-rw-r--r--poxml/antlr/antlr/Makefile.am45
-rw-r--r--poxml/antlr/antlr/MismatchedCharException.hpp127
-rw-r--r--poxml/antlr/antlr/MismatchedTokenException.hpp167
-rw-r--r--poxml/antlr/antlr/NoViableAltException.hpp71
-rw-r--r--poxml/antlr/antlr/NoViableAltForCharException.hpp64
-rw-r--r--poxml/antlr/antlr/Parser.hpp213
-rw-r--r--poxml/antlr/antlr/ParserSharedInputState.hpp42
-rw-r--r--poxml/antlr/antlr/RecognitionException.hpp78
-rw-r--r--poxml/antlr/antlr/RefCount.hpp87
-rw-r--r--poxml/antlr/antlr/SemanticException.hpp52
-rw-r--r--poxml/antlr/antlr/String.hpp47
-rw-r--r--poxml/antlr/antlr/Token.hpp106
-rw-r--r--poxml/antlr/antlr/TokenBuffer.hpp141
-rw-r--r--poxml/antlr/antlr/TokenStream.hpp54
-rw-r--r--poxml/antlr/antlr/TokenStreamBasicFilter.hpp35
-rw-r--r--poxml/antlr/antlr/TokenStreamException.hpp19
-rw-r--r--poxml/antlr/antlr/TokenStreamHiddenTokenFilter.hpp84
-rw-r--r--poxml/antlr/antlr/TokenStreamIOException.hpp22
-rw-r--r--poxml/antlr/antlr/TokenStreamRecognitionException.hpp21
-rw-r--r--poxml/antlr/antlr/TokenStreamRetryException.hpp17
-rw-r--r--poxml/antlr/antlr/TokenStreamSelector.hpp78
-rw-r--r--poxml/antlr/antlr/TreeParser.hpp159
-rw-r--r--poxml/antlr/antlr/TreeParserSharedInputState.hpp34
-rw-r--r--poxml/antlr/antlr/config.hpp168
45 files changed, 3655 insertions, 0 deletions
diff --git a/poxml/antlr/antlr/ANTLRException.hpp b/poxml/antlr/antlr/ANTLRException.hpp
new file mode 100644
index 00000000..efbe0d7f
--- /dev/null
+++ b/poxml/antlr/antlr/ANTLRException.hpp
@@ -0,0 +1,60 @@
+#ifndef INC_ANTLRException_hpp__
+#define INC_ANTLRException_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include <exception>
+#include <string>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class ANTLRException : public ANTLR_USE_NAMESPACE(std)exception {
+private:
+ ANTLR_USE_NAMESPACE(std)string text;
+
+public:
+ ANTLRException();
+ ANTLRException(const ANTLR_USE_NAMESPACE(std)string& s);
+ virtual ~ANTLRException() throw();
+
+ virtual ANTLR_USE_NAMESPACE(std)string toString() const;
+
+ virtual ANTLR_USE_NAMESPACE(std)string getMessage() const;
+
+ virtual const char* what() const throw();
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_ANTLRException_hpp__
diff --git a/poxml/antlr/antlr/AST.hpp b/poxml/antlr/antlr/AST.hpp
new file mode 100644
index 00000000..a36ffd15
--- /dev/null
+++ b/poxml/antlr/antlr/AST.hpp
@@ -0,0 +1,108 @@
+#ifndef INC_AST_hpp__
+#define INC_AST_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/ASTRefCount.hpp"
+#include "antlr/Token.hpp"
+#include <vector>
+#include <string>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+struct ASTRef;
+
+class AST {
+public:
+ AST() : ref(0) {}
+ virtual ~AST() {}
+
+ virtual void addChild(RefAST c)=0;
+
+ virtual bool equals(RefAST t) const=0;
+ virtual bool equalsList(RefAST t) const=0;
+ virtual bool equalsListPartial(RefAST t) const=0;
+ virtual bool equalsTree(RefAST t) const=0;
+ virtual bool equalsTreePartial(RefAST t) const=0;
+
+ virtual ANTLR_USE_NAMESPACE(std)vector<RefAST> findAll(RefAST t)=0;
+ virtual ANTLR_USE_NAMESPACE(std)vector<RefAST> findAllPartial(RefAST t)=0;
+
+ /** Get the first child of this node; null if no children */
+ virtual RefAST getFirstChild() const=0;
+ /** Get the next sibling in line after this one */
+ virtual RefAST getNextSibling() const=0;
+
+ /** Get the token text for this node */
+ virtual ANTLR_USE_NAMESPACE(std)string getText() const=0;
+ /** Get the token type for this node */
+ virtual int getType() const=0;
+
+ virtual void initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt)=0;
+ virtual void initialize(RefAST t)=0;
+ virtual void initialize(RefToken t)=0;
+
+ /** Set the first child of a node. */
+ virtual void setFirstChild(RefAST c)=0;
+ /** Set the next sibling after this one. */
+ virtual void setNextSibling(RefAST n)=0;
+
+ /** Set the token text for this node */
+ virtual void setText(const ANTLR_USE_NAMESPACE(std)string& txt)=0;
+ /** Set the token type for this node */
+ virtual void setType(int type)=0;
+
+ virtual ANTLR_USE_NAMESPACE(std)string toString() const=0;
+ virtual ANTLR_USE_NAMESPACE(std)string toStringList() const=0;
+ virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const=0;
+private:
+ friend struct ASTRef;
+ ASTRef* ref;
+
+ AST(const AST& other);
+ AST(RefAST other);
+ AST& operator=(const AST& other);
+ AST& operator=(RefAST other);
+};
+
+extern RefAST nullAST;
+extern AST* const nullASTptr;
+
+#ifdef NEEDS_OPERATOR_LESS_THAN
+inline operator<(RefAST l,RefAST r); // {return true;}
+#endif
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_AST_hpp__
diff --git a/poxml/antlr/antlr/ASTArray.hpp b/poxml/antlr/antlr/ASTArray.hpp
new file mode 100644
index 00000000..5203acf0
--- /dev/null
+++ b/poxml/antlr/antlr/ASTArray.hpp
@@ -0,0 +1,63 @@
+#ifndef INC_ASTArray_hpp__
+#define INC_ASTArray_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/AST.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/** ASTArray is a class that allows ANTLR to
+ * generate code that can create and initialize an array
+ * in one expression, like:
+ * (new ASTArray(3))->add(x)->add(y)->add(z)
+ */
+class ASTArray {
+public:
+ int size; // = 0;
+ ANTLR_USE_NAMESPACE(std)vector<RefAST> array;
+
+ ASTArray(int capacity)
+ : size(0)
+ , array(capacity)
+ {}
+ ASTArray* add(RefAST node) {
+ array[size++] = node;
+ return this;
+ }
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_ASTArray_hpp__
diff --git a/poxml/antlr/antlr/ASTFactory.hpp b/poxml/antlr/antlr/ASTFactory.hpp
new file mode 100644
index 00000000..584cee6d
--- /dev/null
+++ b/poxml/antlr/antlr/ASTFactory.hpp
@@ -0,0 +1,113 @@
+#ifndef INC_ASTFactory_hpp__
+#define INC_ASTFactory_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/AST.hpp"
+#include "antlr/ASTArray.hpp"
+#include "antlr/ASTPair.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/** AST Support code shared by TreeParser and Parser.
+ * We use delegation to share code (and have only one
+ * bit of code to maintain) rather than subclassing
+ * or superclassing (forces AST support code to be
+ * loaded even when you don't want to do AST stuff).
+ *
+ * Typically, setASTNodeType is used to specify the
+ * type of node to create, but you can override
+ * create to make heterogeneous nodes etc...
+ */
+class ASTFactory {
+public:
+ typedef RefAST (*factory_type)();
+protected:
+ /** Name of AST class to create during tree construction.
+ * Null implies that the create method should create
+ * a default AST type such as CommonAST.
+ */
+ factory_type nodeFactory;
+
+public:
+ ASTFactory();
+ /** Add a child to the current AST */
+ void addASTChild(ASTPair& currentAST, RefAST child);
+ /** Create a new empty AST node; if the user did not specify
+ * an AST node type, then create a default one: CommonAST.
+ */
+ virtual RefAST create();
+ RefAST create(int type);
+ RefAST create(int type, const ANTLR_USE_NAMESPACE(std)string& txt);
+ /** Create a new empty AST node; if the user did not specify
+ * an AST node type, then create a default one: CommonAST.
+ */
+ RefAST create(RefAST tr);
+ RefAST create(RefToken tok);
+ /** Copy a single node. clone() is not used because
+ * we want to return an AST not a plain object...a type
+ * safety issue. Further, we want to have all AST node
+ * creation go through the factory so creation can be
+ * tracked. Returns null if t is null.
+ */
+ RefAST dup(RefAST t);
+ /** Duplicate tree including siblings of root. */
+ RefAST dupList(RefAST t);
+ /**Duplicate a tree, assuming this is a root node of a tree--
+ * duplicate that node and what's below; ignore siblings of root node.
+ */
+ RefAST dupTree(RefAST t);
+ /** Make a tree from a list of nodes. The first element in the
+ * array is the root. If the root is null, then the tree is
+ * a simple list not a tree. Handles null children nodes correctly.
+ * For example, build(a, b, null, c) yields tree (a b c). build(null,a,b)
+ * yields tree (nil a b).
+ */
+ RefAST make(ANTLR_USE_NAMESPACE(std)vector<RefAST> nodes);
+ /** Make a tree from a list of nodes, where the nodes are contained
+ * in an ASTArray object
+ */
+ RefAST make(ASTArray* nodes);
+ /** Make an AST the root of current AST */
+ void makeASTRoot(ASTPair& currentAST, RefAST root);
+ void setASTNodeFactory(factory_type factory);
+ virtual ~ASTFactory() {}
+private:
+ ASTFactory( const ASTFactory& );
+ ASTFactory& operator=( const ASTFactory& );
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_ASTFactory_hpp__
diff --git a/poxml/antlr/antlr/ASTNULLType.hpp b/poxml/antlr/antlr/ASTNULLType.hpp
new file mode 100644
index 00000000..8f3faa46
--- /dev/null
+++ b/poxml/antlr/antlr/ASTNULLType.hpp
@@ -0,0 +1,72 @@
+#ifndef INC_ASTNULLType_hpp__
+#define INC_ASTNULLType_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/AST.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/** There is only one instance of this class **/
+class ASTNULLType : public AST {
+public:
+ void addChild(RefAST c) {;}
+ bool equals(RefAST t) const {return false;}
+ bool equalsList(RefAST t) const {return false;}
+ bool equalsListPartial(RefAST t) const {return false;}
+ bool equalsTree(RefAST t) const {return false;}
+ bool equalsTreePartial(RefAST t) const {return false;}
+ ANTLR_USE_NAMESPACE(std)vector<RefAST> findAll(RefAST tree)
+ {return ANTLR_USE_NAMESPACE(std)vector<RefAST>();}
+ ANTLR_USE_NAMESPACE(std)vector<RefAST> findAllPartial(RefAST subtree)
+ {return ANTLR_USE_NAMESPACE(std)vector<RefAST>();}
+ RefAST getFirstChild() const { return this; }
+ RefAST getNextSibling() const { return this; }
+ ANTLR_USE_NAMESPACE(std)string getText() const { return "<ASTNULL>"; }
+ int getType() const { return Token::NULL_TREE_LOOKAHEAD; }
+ void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) {}
+ void initialize(RefAST t) {}
+ void initialize(RefToken t) {}
+ void setFirstChild(RefAST c) {;}
+ void setNextSibling(RefAST n) {;}
+ void setText(const ANTLR_USE_NAMESPACE(std)string& text) {;}
+ void setType(int ttype) {;}
+ ANTLR_USE_NAMESPACE(std)string toString() const {return getText();}
+ ANTLR_USE_NAMESPACE(std)string toStringList() const {return getText();}
+ ANTLR_USE_NAMESPACE(std)string toStringTree() const {return getText();}
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_ASTNULLType_hpp__
diff --git a/poxml/antlr/antlr/ASTPair.hpp b/poxml/antlr/antlr/ASTPair.hpp
new file mode 100644
index 00000000..eb7629ba
--- /dev/null
+++ b/poxml/antlr/antlr/ASTPair.hpp
@@ -0,0 +1,77 @@
+#ifndef INC_ASTPair_hpp__
+#define INC_ASTPair_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+#include "antlr/config.hpp"
+#include "antlr/AST.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/** ASTPair: utility class used for manipulating a pair of ASTs
+ * representing the current AST root and current AST sibling.
+ * This exists to compensate for the lack of pointers or 'var'
+ * arguments in Java.
+ *
+ * OK, so we can do those things in C++, but it seems easier
+ * to stick with the Java way for now.
+ */
+class ASTPair {
+public:
+ RefAST root; // current root of tree
+ RefAST child; // current child to which siblings are added
+
+ /** Make sure that child is the last sibling */
+ void advanceChildToEnd() {
+ if (child) {
+ while (child->getNextSibling()) {
+ child = child->getNextSibling();
+ }
+ }
+ }
+// /** Copy an ASTPair. Don't call it clone() because we want type-safety */
+// ASTPair copy() {
+// ASTPair tmp = new ASTPair();
+// tmp.root = root;
+// tmp.child = child;
+// return tmp;
+// }
+ ANTLR_USE_NAMESPACE(std)string toString() const {
+ ANTLR_USE_NAMESPACE(std)string r = !root ? ANTLR_USE_NAMESPACE(std)string("null") : root->getText();
+ ANTLR_USE_NAMESPACE(std)string c = !child ? ANTLR_USE_NAMESPACE(std)string("null") : child->getText();
+ return "["+r+","+c+"]";
+ }
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_ASTPair_hpp__
diff --git a/poxml/antlr/antlr/ASTRefCount.hpp b/poxml/antlr/antlr/ASTRefCount.hpp
new file mode 100644
index 00000000..cb44128b
--- /dev/null
+++ b/poxml/antlr/antlr/ASTRefCount.hpp
@@ -0,0 +1,104 @@
+#ifndef INC_ASTRefCount_hpp__
+# define INC_ASTRefCount_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+# include "antlr/config.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+ class AST;
+
+struct ASTRef
+{
+ AST* const ptr;
+ unsigned int count;
+
+ ASTRef(AST* p);
+ ~ASTRef();
+ ASTRef* increment();
+ bool decrement();
+
+ static ASTRef* getRef(const AST* p);
+private:
+ ASTRef( const ASTRef& );
+ ASTRef& operator=( const ASTRef& );
+};
+
+template<class T>
+ class ASTRefCount
+{
+private:
+ ASTRef* ref;
+
+public:
+ ASTRefCount(const AST* p=0)
+ : ref(p ? ASTRef::getRef(p) : 0)
+ {
+ }
+ ASTRefCount(const ASTRefCount<T>& other)
+ : ref(other.ref ? other.ref->increment() : 0)
+ {
+ }
+ ~ASTRefCount()
+ {
+ if (ref && ref->decrement()) delete ref;
+ }
+ ASTRefCount<T>& operator=(AST* other)
+ {
+ ASTRef* tmp=ASTRef::getRef(other);
+ if (ref && ref->decrement()) delete ref;
+ ref=tmp;
+ return *this;
+ }
+ ASTRefCount<T>& operator=(const ASTRefCount<T>& other)
+ {
+ ASTRef* tmp=other.ref ? other.ref->increment() : 0;
+ if (ref && ref->decrement()) delete ref;
+ ref=tmp;
+ return *this;
+ }
+
+ operator T* () const
+ { return ref ? static_cast<T*>(ref->ptr) : 0; }
+ T* operator->() const
+ { return ref ? static_cast<T*>(ref->ptr) : 0; }
+ T* get() const
+ { return ref ? static_cast<T*>(ref->ptr) : 0; }
+};
+
+typedef ASTRefCount<AST> RefAST;
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_ASTRefCount_hpp__
diff --git a/poxml/antlr/antlr/BaseAST.hpp b/poxml/antlr/antlr/BaseAST.hpp
new file mode 100644
index 00000000..7b93c1ef
--- /dev/null
+++ b/poxml/antlr/antlr/BaseAST.hpp
@@ -0,0 +1,106 @@
+#ifndef INC_BaseAST_hpp__
+#define INC_BaseAST_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/AST.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class BaseAST;
+typedef ASTRefCount<BaseAST> RefBaseAST;
+
+class BaseAST : public AST {
+public:
+ BaseAST() : AST() {}
+ virtual ~BaseAST() {}
+protected:
+ RefBaseAST down;
+ RefBaseAST right;
+
+//private:
+// static bool verboseStringConversion;
+// static ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string> tokenNames;
+
+public:
+ virtual void addChild(RefAST c);
+
+private:
+ void doWorkForFindAll(ANTLR_USE_NAMESPACE(std)vector<RefAST>& v,
+ RefAST target,bool partialMatch);
+
+public:
+ virtual bool equals(RefAST t) const;
+ virtual bool equalsList(RefAST t) const;
+ virtual bool equalsListPartial(RefAST t) const;
+ virtual bool equalsTree(RefAST t) const;
+ virtual bool equalsTreePartial(RefAST t) const;
+
+ virtual ANTLR_USE_NAMESPACE(std)vector<RefAST> findAll(RefAST t);
+ virtual ANTLR_USE_NAMESPACE(std)vector<RefAST> findAllPartial(RefAST t);
+
+ /** Get the first child of this node; null if no children */
+ virtual RefAST getFirstChild() const;
+ /** Get the next sibling in line after this one */
+ virtual RefAST getNextSibling() const;
+
+ /** Get the token text for this node */
+ virtual ANTLR_USE_NAMESPACE(std)string getText() const;
+ /** Get the token type for this node */
+ virtual int getType() const;
+
+ /** Remove all children */
+ virtual void removeChildren();
+
+ /** Set the first child of a node. */
+ virtual void setFirstChild(RefAST c);
+ /** Set the next sibling after this one. */
+ void setNextSibling(RefAST n);
+
+ /** Set the token text for this node */
+ virtual void setText(const ANTLR_USE_NAMESPACE(std)string& txt);
+ /** Set the token type for this node */
+ virtual void setType(int type);
+
+// static void setVerboseStringConversion(bool verbose,
+// const ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string>& names);
+
+ virtual ANTLR_USE_NAMESPACE(std)string toString() const;
+ virtual ANTLR_USE_NAMESPACE(std)string toStringList() const;
+ virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const;
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_BaseAST_hpp__
diff --git a/poxml/antlr/antlr/BitSet.hpp b/poxml/antlr/antlr/BitSet.hpp
new file mode 100644
index 00000000..4eb400c7
--- /dev/null
+++ b/poxml/antlr/antlr/BitSet.hpp
@@ -0,0 +1,50 @@
+#ifndef INC_BitSet_hpp__
+#define INC_BitSet_hpp__
+
+#include "antlr/config.hpp"
+#include <vector>
+#include <stdexcept>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/**A BitSet to replace java.util.BitSet.
+ * Primary differences are that most set operators return new sets
+ * as opposed to oring and anding "in place". Further, a number of
+ * operations were added. I cannot contain a BitSet because there
+ * is no way to access the internal bits (which I need for speed)
+ * and, because it is final, I cannot subclass to add functionality.
+ * Consider defining set degree. Without access to the bits, I must
+ * call a method n times to test the ith bit...ack!
+ *
+ * Also seems like or() from util is wrong when size of incoming set is bigger
+ * than this.length.
+ *
+ *
+ * This is a C++ version of the Java class described above, with only
+ * a handful of the methods implemented, because we don't need the
+ * others at runtime. It's really just a wrapper around vector<bool>,
+ * which should probably be changed to a wrapper around bitset, once
+ * bitset is more widely available.
+ *
+ * @author Terence Parr, MageLang Institute
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+class BitSet {
+private:
+ ANTLR_USE_NAMESPACE(std)vector<bool> storage;
+
+public:
+ BitSet(int nbits=64);
+ BitSet(const unsigned long* bits_,int nlongs);
+ ~BitSet();
+
+ void add(int el);
+
+ bool member(int el) const;
+
+ ANTLR_USE_NAMESPACE(std)vector<int> toArray() const;
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_BitSet_hpp__
diff --git a/poxml/antlr/antlr/CharBuffer.hpp b/poxml/antlr/antlr/CharBuffer.hpp
new file mode 100644
index 00000000..45d467bb
--- /dev/null
+++ b/poxml/antlr/antlr/CharBuffer.hpp
@@ -0,0 +1,75 @@
+#ifndef INC_CharBuffer_hpp__
+#define INC_CharBuffer_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+/**A Stream of characters fed to the lexer from a InputStream that can
+ * be rewound via mark()/rewind() methods.
+ * <p>
+ * A dynamic array is used to buffer up all the input characters. Normally,
+ * "k" characters are stored in the buffer. More characters may be stored during
+ * guess mode (testing syntactic predicate), or when LT(i>k) is referenced.
+ * Consumption of characters is deferred. In other words, reading the next
+ * character is not done by conume(), but deferred until needed by LA or LT.
+ * <p>
+ *
+ * @see antlr.CharQueue
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/InputBuffer.hpp"
+#include <iostream>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class CharBuffer : public InputBuffer {
+private:
+ // char source
+ ANTLR_USE_NAMESPACE(std)istream& input;
+
+public:
+ /** Create a character buffer */
+ CharBuffer(ANTLR_USE_NAMESPACE(std)istream& input_);
+
+ /** Get the next character from the stream */
+ int getChar();
+
+private:
+// Not implemented.
+// CharBuffer(const CharBuffer& other);
+// CharBuffer& operator=(const CharBuffer& other);
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_CharBuffer_hpp__
diff --git a/poxml/antlr/antlr/CharScanner.hpp b/poxml/antlr/antlr/CharScanner.hpp
new file mode 100644
index 00000000..b0ab9276
--- /dev/null
+++ b/poxml/antlr/antlr/CharScanner.hpp
@@ -0,0 +1,265 @@
+#ifndef INC_CharScanner_hpp__
+#define INC_CharScanner_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * $Id$
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/TokenStream.hpp"
+#include "antlr/RecognitionException.hpp"
+#include "antlr/InputBuffer.hpp"
+#include "antlr/BitSet.hpp"
+#include "antlr/LexerSharedInputState.hpp"
+#include <map>
+#include <cstdio>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class CharScanner;
+
+class CharScannerLiteralsLess : public ANTLR_USE_NAMESPACE(std)binary_function<ANTLR_USE_NAMESPACE(std)string,ANTLR_USE_NAMESPACE(std)string,bool> {
+private:
+ const CharScanner* scanner;
+public:
+#ifdef NO_TEMPLATE_PARTS
+ CharScannerLiteralsLess(); // not really used
+#endif
+ CharScannerLiteralsLess(const CharScanner* theScanner);
+ bool operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const;
+private:
+// CharScannerLiteralsLess(const CharScannerLiteralsLess&);
+// CharScannerLiteralsLess& operator=(const CharScannerLiteralsLess&);
+};
+
+class CharScanner : public TokenStream {
+private:
+#ifndef NO_STATIC_CONSTS
+ static const int NO_CHAR = 0;
+#else
+ enum {
+ NO_CHAR = 0
+ };
+#endif
+
+public:
+#ifndef NO_STATIC_CONSTS
+ static const int EOF_CHAR = EOF;
+#else
+ enum {
+ EOF_CHAR = EOF
+ };
+#endif
+
+protected:
+ ANTLR_USE_NAMESPACE(std)string text; // text of current token
+
+ bool saveConsumedInput; // does consume() save characters?
+
+ typedef RefToken (*factory_type)();
+ factory_type tokenFactory; // what kind of tokens to create?
+
+ bool caseSensitive;
+ ANTLR_USE_NAMESPACE(std)map<ANTLR_USE_NAMESPACE(std)string,int,CharScannerLiteralsLess> literals; // set by subclass
+
+ RefToken _returnToken; // used to return tokens w/o using return val
+
+ // Input chars
+ LexerSharedInputState inputState;
+
+ /** Used during filter mode to indicate that path is desired.
+ * A subsequent scan error will report an error as usual if acceptPath=true;
+ */
+ bool commitToPath;
+
+public:
+ CharScanner();
+
+ CharScanner(InputBuffer& cb);
+ CharScanner(InputBuffer* cb);
+
+ CharScanner(const LexerSharedInputState& state);
+
+ virtual ~CharScanner();
+
+ virtual void append(char c);
+
+ virtual void append(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ virtual void commit();
+
+ virtual void consume();
+
+ /** Consume chars until one matches the given char */
+ virtual void consumeUntil(int c);
+
+ /** Consume chars until one matches the given set */
+ virtual void consumeUntil(const BitSet& set);
+
+ virtual bool getCaseSensitive() const;
+
+ virtual bool getCaseSensitiveLiterals() const=0;
+
+ virtual int getColumn() const;
+
+ virtual void setColumn(int c);
+
+ virtual bool getCommitToPath() const;
+
+ virtual const ANTLR_USE_NAMESPACE(std)string& getFilename() const;
+
+ virtual InputBuffer& getInputBuffer();
+
+ virtual LexerSharedInputState getInputState();
+
+ virtual int getLine() const;
+
+ /** return a copy of the current text buffer */
+ virtual const ANTLR_USE_NAMESPACE(std)string& getText() const;
+
+ virtual RefToken getTokenObject() const;
+
+ virtual int LA(int i);
+
+protected:
+ virtual RefToken makeToken(int t);
+
+public:
+ virtual int mark();
+
+ virtual void match(int c);
+
+ virtual void match(const BitSet& b);
+
+ virtual void match(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ virtual void matchNot(int c);
+
+ virtual void matchRange(int c1, int c2);
+
+ virtual void newline();
+
+ virtual void tab();
+
+ void panic();
+
+ void panic(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ /** Report exception errors caught in nextToken() */
+ virtual void reportError(const RecognitionException& e);
+
+ /** Parser error-reporting function can be overridden in subclass */
+ virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ /** Parser warning-reporting function can be overridden in subclass */
+ virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ virtual void resetText();
+
+ virtual void rewind(int pos);
+
+ virtual void setCaseSensitive(bool t);
+
+ virtual void setCommitToPath(bool commit);
+
+ virtual void setFilename(const ANTLR_USE_NAMESPACE(std)string& f);
+
+ virtual void setInputState(LexerSharedInputState state);
+
+ virtual void setLine(int l);
+
+ virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ virtual void setTokenObjectFactory(factory_type factory);
+
+ // Test the token text against the literals table
+ // Override this method to perform a different literals test
+ virtual int testLiteralsTable(int ttype) const;
+
+ // Test the text passed in against the literals table
+ // Override this method to perform a different literals test
+ // This is used primarily when you want to test a portion of
+ // a token
+ virtual int testLiteralsTable(const ANTLR_USE_NAMESPACE(std)string& text,int ttype) const;
+
+ // Override this method to get more specific case handling
+ virtual int toLower(int c) const;
+
+protected:
+ class Tracer {
+ private:
+ CharScanner* parser;
+ ANTLR_USE_NAMESPACE(std)string text;
+ public:
+ Tracer(CharScanner* p,const ANTLR_USE_NAMESPACE(std)string& t)
+ : parser(p), text(t) { parser->traceIn(text); }
+ ~Tracer()
+ { parser->traceOut(text); }
+ };
+
+ int traceDepth;
+public:
+ virtual void traceIndent();
+ virtual void traceIn(const ANTLR_USE_NAMESPACE(std)string& rname);
+ virtual void traceOut(const ANTLR_USE_NAMESPACE(std)string& rname);
+
+ /* This method is called by YourLexer::nextToken() when the lexer has
+ * hit EOF condition. EOF is NOT a character.
+ * This method is not called if EOF is reached during
+ * syntactic predicate evaluation or during evaluation
+ * of normal lexical rules, which presumably would be
+ * an IOException. This traps the "normal" EOF condition.
+ *
+ * uponEOF() is called after the complete evaluation of
+ * the previous token and only if your parser asks
+ * for another token beyond that last non-EOF token.
+ *
+ * You might want to throw token or char stream exceptions
+ * like: "Heh, premature eof" or a retry stream exception
+ * ("I found the end of this file, go back to referencing file").
+ */
+ virtual void uponEOF();
+};
+
+inline int CharScanner::LA(int i)
+{
+ if ( caseSensitive ) {
+ return inputState->getInput().LA(i);
+ } else {
+ return toLower(inputState->getInput().LA(i));
+ }
+}
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_CharScanner_hpp__
diff --git a/poxml/antlr/antlr/CharStreamException.hpp b/poxml/antlr/antlr/CharStreamException.hpp
new file mode 100644
index 00000000..33f52061
--- /dev/null
+++ b/poxml/antlr/antlr/CharStreamException.hpp
@@ -0,0 +1,18 @@
+#ifndef INC_CharStreamException_hpp__
+#define INC_CharStreamException_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/ANTLRException.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class CharStreamException : public ANTLRException {
+public:
+ CharStreamException(const ANTLR_USE_NAMESPACE(std)string& s)
+ : ANTLRException(s) {}
+ ~CharStreamException() throw() {}
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_CharStreamException_hpp__
diff --git a/poxml/antlr/antlr/CharStreamIOException.hpp b/poxml/antlr/antlr/CharStreamIOException.hpp
new file mode 100644
index 00000000..1a8b1d1e
--- /dev/null
+++ b/poxml/antlr/antlr/CharStreamIOException.hpp
@@ -0,0 +1,20 @@
+#ifndef INC_CharStreamIOException_hpp__
+#define INC_CharStreamIOException_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/CharStreamException.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class CharStreamIOException : public CharStreamException {
+public:
+ ANTLR_USE_NAMESPACE(std)exception io;
+
+ CharStreamIOException(ANTLR_USE_NAMESPACE(std)exception& e)
+ : CharStreamException(e.what()), io(e) {}
+ ~CharStreamIOException() throw() {}
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_CharStreamIOException_hpp__
diff --git a/poxml/antlr/antlr/CircularQueue.hpp b/poxml/antlr/antlr/CircularQueue.hpp
new file mode 100644
index 00000000..eadf8d42
--- /dev/null
+++ b/poxml/antlr/antlr/CircularQueue.hpp
@@ -0,0 +1,88 @@
+#ifndef INC_CircularQueue_hpp__
+#define INC_CircularQueue_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include <vector>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+// Resize every 5000 items
+#define OFFSET_MAX_RESIZE 5000
+
+template <class T>
+class CircularQueue {
+private:
+ ANTLR_USE_NAMESPACE(std)vector<T> storage;
+
+public:
+ CircularQueue()
+ : storage(), m_offset(0) {}
+ ~CircularQueue()
+ {}
+
+ T elementAt(int idx) const
+ { return storage[idx+m_offset]; } //Is this safe?
+ void removeFirst()
+ {
+ if (m_offset >= OFFSET_MAX_RESIZE) {
+ storage.erase( storage.begin(), storage.begin() + m_offset + 1 );
+ m_offset = 0;
+ } else {
+ ++m_offset;
+ }
+ }
+ inline void removeItems( int nb )
+ {
+ if (m_offset >= OFFSET_MAX_RESIZE) {
+ storage.erase( storage.begin(), storage.begin() + m_offset + nb );
+ m_offset = 0;
+ } else {
+ m_offset+=nb;
+ }
+ }
+ void append(const T& t)
+ { storage.push_back(t); }
+ int entries() const
+ { return storage.size()-m_offset; }
+
+private:
+ int m_offset;
+ CircularQueue(const CircularQueue&);
+ const CircularQueue& operator=(const CircularQueue&);
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_CircularQueue_hpp__
diff --git a/poxml/antlr/antlr/CommonAST.hpp b/poxml/antlr/antlr/CommonAST.hpp
new file mode 100644
index 00000000..c7ab7313
--- /dev/null
+++ b/poxml/antlr/antlr/CommonAST.hpp
@@ -0,0 +1,68 @@
+#ifndef INC_CommonAST_hpp__
+#define INC_CommonAST_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/BaseAST.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class CommonAST : public BaseAST {
+public:
+ CommonAST();
+ CommonAST(RefToken t);
+ virtual ~CommonAST();
+
+ virtual ANTLR_USE_NAMESPACE(std)string getText() const;
+ virtual int getType() const;
+
+ virtual void initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt);
+ virtual void initialize(RefAST t);
+ virtual void initialize(RefToken t);
+
+ virtual void setText(const ANTLR_USE_NAMESPACE(std)string& txt);
+ virtual void setType(int type);
+
+ static RefAST factory();
+
+protected:
+ int ttype;
+ ANTLR_USE_NAMESPACE(std)string text;
+};
+
+typedef ASTRefCount<CommonAST> RefCommonAST;
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_CommonAST_hpp__
diff --git a/poxml/antlr/antlr/CommonASTWithHiddenTokens.hpp b/poxml/antlr/antlr/CommonASTWithHiddenTokens.hpp
new file mode 100644
index 00000000..11e030e7
--- /dev/null
+++ b/poxml/antlr/antlr/CommonASTWithHiddenTokens.hpp
@@ -0,0 +1,41 @@
+#ifndef INC_CommonASTWithHiddenTokens_hpp__
+#define INC_CommonASTWithHiddenTokens_hpp__
+
+/** A CommonAST whose initialization copies hidden token
+ * information from the Token used to create a node.
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/CommonAST.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class CommonASTWithHiddenTokens : public CommonAST {
+public:
+ CommonASTWithHiddenTokens() : CommonAST()
+ {
+ }
+ virtual ~CommonASTWithHiddenTokens()
+ {
+ }
+protected:
+ RefToken hiddenBefore,hiddenAfter; // references to hidden tokens
+public:
+ virtual RefToken getHiddenAfter() const
+ { return hiddenAfter; }
+ virtual RefToken getHiddenBefore() const
+ { return hiddenBefore; }
+
+ // Borland C++ builder seems to need the decl's of the first two...
+ virtual void initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt);
+ virtual void initialize(RefAST t);
+ virtual void initialize(RefToken t);
+
+ static RefAST factory();
+};
+
+typedef ASTRefCount<CommonASTWithHiddenTokens> RefCommonASTWithHiddenTokens;
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_CommonASTWithHiddenTokens_hpp__
diff --git a/poxml/antlr/antlr/CommonHiddenStreamToken.hpp b/poxml/antlr/antlr/CommonHiddenStreamToken.hpp
new file mode 100644
index 00000000..50ff2354
--- /dev/null
+++ b/poxml/antlr/antlr/CommonHiddenStreamToken.hpp
@@ -0,0 +1,30 @@
+#ifndef INC_CommonHiddenStreamToken_hpp__
+#define INC_CommonHiddenStreamToken_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/CommonToken.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class CommonHiddenStreamToken : public CommonToken {
+protected:
+ RefToken hiddenBefore;
+ RefToken hiddenAfter;
+
+public:
+ CommonHiddenStreamToken();
+ CommonHiddenStreamToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt);
+ CommonHiddenStreamToken(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ RefToken getHiddenAfter();
+ RefToken getHiddenBefore();
+
+ static RefToken factory();
+
+ void setHiddenAfter(RefToken t);
+ void setHiddenBefore(RefToken t);
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_CommonHiddenStreamToken_hpp__
diff --git a/poxml/antlr/antlr/CommonToken.hpp b/poxml/antlr/antlr/CommonToken.hpp
new file mode 100644
index 00000000..669aa535
--- /dev/null
+++ b/poxml/antlr/antlr/CommonToken.hpp
@@ -0,0 +1,77 @@
+#ifndef INC_CommonToken_hpp__
+#define INC_CommonToken_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/Token.hpp"
+#include <string>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class CommonToken : public Token {
+protected:
+ // most tokens will want line and text information
+ int line;
+ int col;
+ ANTLR_USE_NAMESPACE(std)string text;
+
+public:
+ CommonToken();
+ CommonToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt);
+ CommonToken(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ int getLine() const;
+ ANTLR_USE_NAMESPACE(std)string getText() const;
+ void setLine(int l);
+ void setText(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ ANTLR_USE_NAMESPACE(std)string toString() const;
+
+ /** Return token's start column */
+ int getColumn() const;
+
+ void setColumn(int c);
+
+ bool isInvalid() const;
+
+ static RefToken factory();
+
+private:
+ CommonToken(const CommonToken&);
+ const CommonToken& operator=(const CommonToken&);
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_CommonToken_hpp__
diff --git a/poxml/antlr/antlr/InputBuffer.hpp b/poxml/antlr/antlr/InputBuffer.hpp
new file mode 100644
index 00000000..96e62191
--- /dev/null
+++ b/poxml/antlr/antlr/InputBuffer.hpp
@@ -0,0 +1,158 @@
+#ifndef INC_InputBuffer_hpp__
+#define INC_InputBuffer_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+/**A Stream of characters fed to the lexer from a InputStream that can
+ * be rewound via mark()/rewind() methods.
+ * <p>
+ * A dynamic array is used to buffer up all the input characters. Normally,
+ * "k" characters are stored in the buffer. More characters may be stored during
+ * guess mode (testing syntactic predicate), or when LT(i>k) is referenced.
+ * Consumption of characters is deferred. In other words, reading the next
+ * character is not done by conume(), but deferred until needed by LA or LT.
+ * <p>
+ *
+ * @see antlr.CharQueue
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/CircularQueue.hpp"
+#include <string>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class InputBuffer {
+protected:
+ // char source
+ // leave to subclasses
+
+ // Number of active markers
+ int nMarkers; // = 0;
+
+ // Additional offset used when markers are active
+ int markerOffset; // = 0;
+
+ // Number of calls to consume() since last LA() or LT() call
+ int numToConsume; // = 0;
+
+ // Circular queue
+ CircularQueue<int> queue;
+
+public:
+ /** Create a character buffer */
+ InputBuffer();
+
+ virtual ~InputBuffer() {}
+
+ /** This method updates the state of the input buffer so that
+ * the text matched since the most recent mark() is no longer
+ * held by the buffer. So, you either do a mark/rewind for
+ * failed predicate or mark/commit to keep on parsing without
+ * rewinding the input.
+ */
+ void commit();
+
+ /** Mark another character for deferred consumption */
+ virtual void consume();
+
+ /** Ensure that the character buffer is sufficiently full */
+ virtual void fill(int amount);
+
+ /** Override this in subclasses to get the next character */
+ virtual int getChar()=0;
+
+ ANTLR_USE_NAMESPACE(std)string getLAChars() const;
+
+ ANTLR_USE_NAMESPACE(std)string getMarkedChars() const;
+
+ virtual bool isMarked() const;
+
+ /** Get a lookahead character */
+ virtual int LA(int i);
+
+ /**Return an integer marker that can be used to rewind the buffer to
+ * its current state.
+ */
+ virtual int mark();
+
+ /**Rewind the character buffer to a marker.
+ * @param mark Marker returned previously from mark()
+ */
+ virtual void rewind(int mark);
+
+protected:
+ /** Sync up deferred consumption */
+ void syncConsume();
+
+private:
+ InputBuffer(const InputBuffer& other);
+ InputBuffer& operator=(const InputBuffer& other);
+};
+
+/** Sync up deferred consumption */
+inline void InputBuffer::syncConsume() {
+#ifdef OLD_CODE
+ while (numToConsume > 0) {
+ if (nMarkers > 0)
+ {
+ // guess mode -- leave leading characters and bump offset.
+ markerOffset++;
+ } else {
+ // normal mode -- remove first character
+ queue.removeFirst();
+ }
+ numToConsume--;
+ }
+#endif
+
+ if (numToConsume > 0) {
+ if (nMarkers > 0) {
+ markerOffset += numToConsume;
+ } else {
+ queue.removeItems( numToConsume );
+ }
+ numToConsume = 0;
+ }
+}
+
+/** Get a lookahead character */
+inline int InputBuffer::LA(int i)
+{
+ fill(i);
+ return queue.elementAt(markerOffset + i - 1);
+}
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_InputBuffer_hpp__
diff --git a/poxml/antlr/antlr/LLkParser.hpp b/poxml/antlr/antlr/LLkParser.hpp
new file mode 100644
index 00000000..8b8db188
--- /dev/null
+++ b/poxml/antlr/antlr/LLkParser.hpp
@@ -0,0 +1,82 @@
+#ifndef INC_LLkParser_hpp__
+#define INC_LLkParser_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/Parser.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/**An LL(k) parser.
+ *
+ * @see antlr.Token
+ * @see antlr.TokenBuffer
+ * @see antlr.LL1Parser
+ */
+class LLkParser : public Parser {
+protected:
+ int k;
+
+public:
+// LLkParser(int k_);
+
+ LLkParser(const ParserSharedInputState& lexer, int k_);
+
+ LLkParser(TokenBuffer& tokenBuf, int k_);
+
+ LLkParser(TokenStream& lexer, int k_);
+
+ /**Consume another token from the input stream. Can only write sequentially!
+ * If you need 3 tokens ahead, you must consume() 3 times.
+ * <p>
+ * Note that it is possible to overwrite tokens that have not been matched.
+ * For example, calling consume() 3 times when k=2, means that the first token
+ * consumed will be overwritten with the 3rd.
+ */
+ void consume();
+
+ int LA(int i);
+
+ RefToken LT(int i);
+
+private:
+ void trace(const ANTLR_USE_NAMESPACE(std)string& ee, const ANTLR_USE_NAMESPACE(std)string& rname);
+public:
+ void traceIn(const ANTLR_USE_NAMESPACE(std)string& rname);
+ void traceOut(const ANTLR_USE_NAMESPACE(std)string& rname);
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_LLkParser_hpp__
diff --git a/poxml/antlr/antlr/LexerSharedInputState.hpp b/poxml/antlr/antlr/LexerSharedInputState.hpp
new file mode 100644
index 00000000..dba2a5f4
--- /dev/null
+++ b/poxml/antlr/antlr/LexerSharedInputState.hpp
@@ -0,0 +1,49 @@
+#ifndef INC_LexerSharedInputState_hpp__
+#define INC_LexerSharedInputState_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/InputBuffer.hpp"
+#include "antlr/RefCount.hpp"
+#include <string>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/** This object contains the data associated with an
+ * input stream of characters. Multiple lexers
+ * share a single LexerSharedInputState to lex
+ * the same input stream.
+ */
+class LexerInputState {
+public:
+ LexerInputState(InputBuffer* inbuf);
+ LexerInputState(InputBuffer& inbuf);
+ LexerInputState(ANTLR_USE_NAMESPACE(std)istream& in);
+ ~LexerInputState();
+
+ int column;
+ int line;
+ int tokenStartColumn;
+ int tokenStartLine;
+ int guessing;
+ /** What file (if known) caused the problem? */
+ ANTLR_USE_NAMESPACE(std)string filename;
+ InputBuffer& getInput();
+private:
+ InputBuffer* input;
+ bool inputResponsible;
+
+ // we don't want these:
+ LexerInputState(const LexerInputState&);
+ LexerInputState& operator=(const LexerInputState&);
+};
+
+typedef RefCount<LexerInputState> LexerSharedInputState;
+
+inline InputBuffer& LexerInputState::getInput()
+{
+ return *input;
+}
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_LexerSharedInputState_hpp__
diff --git a/poxml/antlr/antlr/Makefile.am b/poxml/antlr/antlr/Makefile.am
new file mode 100644
index 00000000..bafa1347
--- /dev/null
+++ b/poxml/antlr/antlr/Makefile.am
@@ -0,0 +1,45 @@
+noinst_HEADERS = \
+ ANTLRException.hpp \
+ AST.hpp \
+ ASTArray.hpp \
+ ASTFactory.hpp \
+ ASTNULLType.hpp \
+ ASTPair.hpp \
+ ASTRefCount.hpp \
+ BaseAST.hpp \
+ BitSet.hpp \
+ CharBuffer.hpp \
+ CharScanner.hpp \
+ CharStreamException.hpp \
+ CharStreamIOException.hpp \
+ CircularQueue.hpp \
+ CommonAST.hpp \
+ CommonASTWithHiddenTokens.hpp \
+ CommonHiddenStreamToken.hpp \
+ CommonToken.hpp \
+ InputBuffer.hpp \
+ LLkParser.hpp \
+ LexerSharedInputState.hpp \
+ MismatchedCharException.hpp \
+ MismatchedTokenException.hpp \
+ NoViableAltException.hpp \
+ NoViableAltForCharException.hpp \
+ Parser.hpp \
+ ParserSharedInputState.hpp \
+ RecognitionException.hpp \
+ RefCount.hpp \
+ SemanticException.hpp \
+ String.hpp \
+ Token.hpp \
+ TokenBuffer.hpp \
+ TokenStream.hpp \
+ TokenStreamBasicFilter.hpp \
+ TokenStreamException.hpp \
+ TokenStreamHiddenTokenFilter.hpp \
+ TokenStreamIOException.hpp \
+ TokenStreamRecognitionException.hpp \
+ TokenStreamRetryException.hpp \
+ TokenStreamSelector.hpp \
+ TreeParser.hpp \
+ TreeParserSharedInputState.hpp \
+ config.hpp
diff --git a/poxml/antlr/antlr/MismatchedCharException.hpp b/poxml/antlr/antlr/MismatchedCharException.hpp
new file mode 100644
index 00000000..ea923a9d
--- /dev/null
+++ b/poxml/antlr/antlr/MismatchedCharException.hpp
@@ -0,0 +1,127 @@
+#ifndef INC_MismatchedCharException_hpp__
+#define INC_MismatchedCharException_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/RecognitionException.hpp"
+#include "antlr/BitSet.hpp"
+#include "antlr/CharScanner.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class MismatchedCharException : public RecognitionException {
+public:
+ // Types of chars
+#ifndef NO_STATIC_CONSTS
+ static const int CHAR = 1;
+ static const int NOT_CHAR = 2;
+ static const int RANGE = 3;
+ static const int NOT_RANGE = 4;
+ static const int SET = 5;
+ static const int NOT_SET = 6;
+#else
+ enum {
+ CHAR = 1,
+ NOT_CHAR = 2,
+ RANGE = 3,
+ NOT_RANGE = 4,
+ SET = 5,
+ NOT_SET = 6
+ };
+#endif
+
+public:
+ // One of the above
+ int mismatchType;
+
+ // what was found on the input stream
+ int foundChar;
+
+ // For CHAR/NOT_CHAR and RANGE/NOT_RANGE
+ int expecting;
+
+ // For RANGE/NOT_RANGE (expecting is lower bound of range)
+ int upper;
+
+ // For SET/NOT_SET
+ BitSet set;
+
+protected:
+ // who knows...they may want to ask scanner questions
+ CharScanner* scanner;
+
+public:
+ MismatchedCharException();
+
+ // Expected range / not range
+ MismatchedCharException(
+ int c,
+ int lower,
+ int upper_,
+ bool matchNot,
+ CharScanner* scanner_
+ );
+
+ // Expected token / not token
+ MismatchedCharException(
+ int c,
+ int expecting_,
+ bool matchNot,
+ CharScanner* scanner_
+ );
+
+ // Expected BitSet / not BitSet
+ MismatchedCharException(
+ int c,
+ BitSet set_,
+ bool matchNot,
+ CharScanner* scanner_
+ );
+
+ MismatchedCharException(
+ const ANTLR_USE_NAMESPACE(std)string& s,
+ int line
+ );
+ ~MismatchedCharException() throw() {}
+
+ /**
+ * Returns the error message that happened on the line/col given.
+ * Copied from toString().
+ */
+ ANTLR_USE_NAMESPACE(std)string getMessage() const;
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_MismatchedCharException_hpp__
diff --git a/poxml/antlr/antlr/MismatchedTokenException.hpp b/poxml/antlr/antlr/MismatchedTokenException.hpp
new file mode 100644
index 00000000..ae4a82cd
--- /dev/null
+++ b/poxml/antlr/antlr/MismatchedTokenException.hpp
@@ -0,0 +1,167 @@
+#ifndef INC_MismatchedTokenException_hpp__
+#define INC_MismatchedTokenException_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/RecognitionException.hpp"
+#include "antlr/BitSet.hpp"
+#include "antlr/Token.hpp"
+#include "antlr/AST.hpp"
+#include <vector>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class MismatchedTokenException : public RecognitionException {
+private:
+ // Token names array for formatting
+ ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string> tokenNames;
+
+public:
+ // The token that was encountered
+ const RefToken token;
+ // The offending AST node if tree walking
+ const RefAST node;
+
+ ANTLR_USE_NAMESPACE(std)string tokenText; // taken from node or token object
+
+ // Types of tokens
+#ifndef NO_STATIC_CONSTS
+ static const int TOKEN = 1;
+ static const int NOT_TOKEN = 2;
+ static const int RANGE = 3;
+ static const int NOT_RANGE = 4;
+ static const int SET = 5;
+ static const int NOT_SET = 6;
+#else
+ enum {
+ TOKEN = 1,
+ NOT_TOKEN = 2,
+ RANGE = 3,
+ NOT_RANGE = 4,
+ SET = 5,
+ NOT_SET = 6
+ };
+#endif
+
+public:
+ // One of the above
+ int mismatchType;
+
+ // For TOKEN/NOT_TOKEN and RANGE/NOT_RANGE
+ int expecting;
+
+ // For RANGE/NOT_RANGE (expecting is lower bound of range)
+ int upper;
+
+ // For SET/NOT_SET
+ BitSet set;
+
+ MismatchedTokenException();
+
+ // Expected range / not range
+ MismatchedTokenException(
+ const ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string>& tokenNames_,
+ RefAST node_,
+ int lower,
+ int upper_,
+ bool matchNot
+ );
+
+ // Expected token / not token
+ MismatchedTokenException(
+ const ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string>& tokenNames_,
+ RefAST node_,
+ int expecting_,
+ bool matchNot
+ );
+
+ // Expected BitSet / not BitSet
+ MismatchedTokenException(
+ const ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string>& tokenNames_,
+ RefAST node_,
+ BitSet set_,
+ bool matchNot
+ );
+
+ // Expected range / not range
+ MismatchedTokenException(
+ const ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string>& tokenNames_,
+ RefToken token_,
+ int lower,
+ int upper_,
+ bool matchNot,
+ const ANTLR_USE_NAMESPACE(std)string& fileName_
+ );
+
+ // Expected token / not token
+ MismatchedTokenException(
+ const ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string>& tokenNames_,
+ RefToken token_,
+ int expecting_,
+ bool matchNot,
+ const ANTLR_USE_NAMESPACE(std)string& fileName_
+ );
+
+ // Expected BitSet / not BitSet
+ MismatchedTokenException(
+ const ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string>& tokenNames_,
+ RefToken token_,
+ BitSet set_,
+ bool matchNot,
+ const ANTLR_USE_NAMESPACE(std)string& fileName_
+ );
+ ~MismatchedTokenException() throw() {}
+
+ /**
+ * @deprecated As of ANTLR 2.7.0
+ */
+ ANTLR_USE_NAMESPACE(std)string getErrorMessage() const;
+
+ /**
+ * Returns the error message that happened on the line/col given.
+ * Copied from toString().
+ */
+ ANTLR_USE_NAMESPACE(std)string getMessage() const;
+
+private:
+ ANTLR_USE_NAMESPACE(std)string tokenName(int tokenType) const;
+
+public:
+ ANTLR_USE_NAMESPACE(std)string toString() const;
+
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_MismatchedTokenException_hpp__
diff --git a/poxml/antlr/antlr/NoViableAltException.hpp b/poxml/antlr/antlr/NoViableAltException.hpp
new file mode 100644
index 00000000..f85bcf96
--- /dev/null
+++ b/poxml/antlr/antlr/NoViableAltException.hpp
@@ -0,0 +1,71 @@
+#ifndef INC_NoViableAltException_hpp__
+#define INC_NoViableAltException_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/RecognitionException.hpp"
+#include "antlr/Token.hpp"
+#include "antlr/AST.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class NoViableAltException : public RecognitionException {
+public:
+ const RefToken token;
+ const RefAST node; // handles parsing and treeparsing
+
+ NoViableAltException(RefAST t);
+
+ NoViableAltException(RefToken t,const ANTLR_USE_NAMESPACE(std)string& fileName_);
+ ~NoViableAltException() throw() {}
+
+ /**
+ * @deprecated As of ANTLR 2.7.0
+ */
+ ANTLR_USE_NAMESPACE(std)string getErrorMessage() const;
+
+ /**
+ * Returns a clean error message (no line number/column information)
+ */
+ ANTLR_USE_NAMESPACE(std)string getMessage() const;
+
+ /**
+ * Returns a string representation of this exception.
+ */
+ virtual ANTLR_USE_NAMESPACE(std)string toString() const;
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_NoViableAltException_hpp__
diff --git a/poxml/antlr/antlr/NoViableAltForCharException.hpp b/poxml/antlr/antlr/NoViableAltForCharException.hpp
new file mode 100644
index 00000000..756e9c7f
--- /dev/null
+++ b/poxml/antlr/antlr/NoViableAltForCharException.hpp
@@ -0,0 +1,64 @@
+#ifndef INC_NoViableAltForCharException_hpp__
+#define INC_NoViableAltForCharException_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Institute
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Institute
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/RecognitionException.hpp"
+#include "antlr/CharScanner.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class NoViableAltForCharException : public RecognitionException {
+public:
+ int foundChar;
+
+ NoViableAltForCharException(int c, CharScanner* scanner);
+
+ NoViableAltForCharException(int c, const ANTLR_USE_NAMESPACE(std)string& fileName_, int line_);
+ ~NoViableAltForCharException() throw() {}
+
+ /**
+ * @deprecated As of ANTLR 2.7.0
+ */
+ virtual ANTLR_USE_NAMESPACE(std)string getErrorMessage() const;
+
+ /**
+ * Returns a clean error message (no line number/column information)
+ */
+ virtual ANTLR_USE_NAMESPACE(std)string getMessage() const;
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_NoViableAltForCharException_hpp__
diff --git a/poxml/antlr/antlr/Parser.hpp b/poxml/antlr/antlr/Parser.hpp
new file mode 100644
index 00000000..767953d3
--- /dev/null
+++ b/poxml/antlr/antlr/Parser.hpp
@@ -0,0 +1,213 @@
+#ifndef INC_Parser_hpp__
+#define INC_Parser_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/BitSet.hpp"
+#include "antlr/TokenBuffer.hpp"
+#include "antlr/RecognitionException.hpp"
+#include "antlr/ASTFactory.hpp"
+#include "antlr/ParserSharedInputState.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/**A generic ANTLR parser (LL(k) for k>=1) containing a bunch of
+ * utility routines useful at any lookahead depth. We distinguish between
+ * the LL(1) and LL(k) parsers because of efficiency. This may not be
+ * necessary in the near future.
+ *
+ * Each parser object contains the state of the parse including a lookahead
+ * cache (the form of which is determined by the subclass), whether or
+ * not the parser is in guess mode, where tokens come from, etc...
+ *
+ * <p>
+ * During <b>guess</b> mode, the current lookahead token(s) and token type(s)
+ * cache must be saved because the token stream may not have been informed
+ * to save the token (via <tt>mark</tt>) before the <tt>try</tt> block.
+ * Guessing is started by:
+ * <ol>
+ * <li>saving the lookahead cache.
+ * <li>marking the current position in the TokenBuffer.
+ * <li>increasing the guessing level.
+ * </ol>
+ *
+ * After guessing, the parser state is restored by:
+ * <ol>
+ * <li>restoring the lookahead cache.
+ * <li>rewinding the TokenBuffer.
+ * <li>decreasing the guessing level.
+ * </ol>
+ *
+ * @see antlr.Token
+ * @see antlr.TokenBuffer
+ * @see antlr.TokenStream
+ * @see antlr.LL1Parser
+ * @see antlr.LLkParser
+ */
+
+extern bool DEBUG_PARSER;
+
+class Parser {
+protected:
+ ParserSharedInputState inputState;
+
+ /** Nesting level of registered handlers */
+ // int exceptionLevel;
+
+ /** Table of token type to token names */
+ ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string> tokenNames;
+ /** AST return value for a rule is squirreled away here */
+ RefAST returnAST;
+ /** AST support code; parser and treeparser delegate to this object */
+ ASTFactory astFactory;
+
+// Parser();
+
+ Parser(TokenBuffer& input_);
+ Parser(TokenBuffer* input_);
+
+ Parser(const ParserSharedInputState& state);
+
+public:
+ virtual ~Parser();
+
+protected:
+ void setTokenNames(const char** tokenNames_);
+
+public:
+ /**Get another token object from the token stream */
+ virtual void consume()=0;
+
+ /** Consume tokens until one matches the given token */
+ void consumeUntil(int tokenType);
+
+ /** Consume tokens until one matches the given token set */
+ void consumeUntil(const BitSet& set);
+
+ /** Get the AST return value squirreled away in the parser */
+ RefAST getAST();
+
+ ASTFactory& getASTFactory();
+
+ ANTLR_USE_NAMESPACE(std)string getFilename() const;
+
+ virtual ParserSharedInputState getInputState() const;
+
+ ANTLR_USE_NAMESPACE(std)string getTokenName(int num) const;
+ ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string> getTokenNames() const;
+
+ /** Return the token type of the ith token of lookahead where i=1
+ * is the current token being examined by the parser (i.e., it
+ * has not been matched yet).
+ */
+ virtual int LA(int i)=0;
+
+ /**Return the ith token of lookahead */
+ virtual RefToken LT(int i)=0;
+
+ // Forwarded to TokenBuffer
+ virtual int mark();
+
+ /**Make sure current lookahead symbol matches token type <tt>t</tt>.
+ * Throw an exception upon mismatch, which is catch by either the
+ * error handler or by the syntactic predicate.
+ */
+ void match(int t);
+
+ /**Make sure current lookahead symbol matches the given set
+ * Throw an exception upon mismatch, which is catch by either the
+ * error handler or by the syntactic predicate.
+ */
+ void match(const BitSet& b);
+
+ void matchNot(int t);
+
+ static void panic();
+
+ /** Parser error-reporting function can be overridden in subclass */
+ virtual void reportError(const RecognitionException& ex);
+
+ /** Parser error-reporting function can be overridden in subclass */
+ virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ /** Parser warning-reporting function can be overridden in subclass */
+ virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ virtual void rewind(int pos);
+
+ /** Set the object used to generate ASTs */
+// void setASTFactory(ASTFactory astFactory_);
+
+ /** Specify the type of node to create during tree building */
+ void setASTNodeFactory(ASTFactory::factory_type factory);
+
+ void setFilename(const ANTLR_USE_NAMESPACE(std)string& f);
+
+ void setInputState(ParserSharedInputState state);
+
+ /** Set or change the input token buffer */
+// void setTokenBuffer(TokenBuffer<Token>* t);
+
+ virtual void traceIndent();
+ virtual void traceIn(const ANTLR_USE_NAMESPACE(std)string& rname);
+ virtual void traceOut(const ANTLR_USE_NAMESPACE(std)string& rname);
+protected:
+ int traceDepth; // used to keep track of the indentation for the trace
+
+protected:
+ /** Utility class which allows tracing to work even when exceptions are
+ * thrown.
+ */
+ class Tracer {
+ private:
+ Parser* parser;
+ ANTLR_USE_NAMESPACE(std)string text;
+ public:
+ Tracer(Parser* p,const ANTLR_USE_NAMESPACE(std)string& t)
+ : parser(p), text(t) { parser->traceIn(text); }
+ ~Tracer()
+ { parser->traceOut(text); }
+ private:
+ Tracer(const Tracer&); // undefined
+ const Tracer& operator=(const Tracer&); // undefined
+ };
+
+private:
+ Parser(const Parser&); // undefined
+ const Parser& operator=(const Parser&); // undefined
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_Parser_hpp__
diff --git a/poxml/antlr/antlr/ParserSharedInputState.hpp b/poxml/antlr/antlr/ParserSharedInputState.hpp
new file mode 100644
index 00000000..b5599954
--- /dev/null
+++ b/poxml/antlr/antlr/ParserSharedInputState.hpp
@@ -0,0 +1,42 @@
+#ifndef INC_ParserSharedInputState_hpp__
+#define INC_ParserSharedInputState_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/TokenBuffer.hpp"
+#include "antlr/RefCount.hpp"
+#include <string>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/** This object contains the data associated with an
+ * input stream of tokens. Multiple parsers
+ * share a single ParserSharedInputState to parse
+ * the same stream of tokens.
+ */
+class ParserInputState {
+public:
+ ParserInputState(TokenBuffer* input_);
+ ParserInputState(TokenBuffer& input_);
+ ~ParserInputState();
+
+public:
+ /** Are we guessing (guessing>0)? */
+ int guessing; //= 0;
+ /** What file (if known) caused the problem? */
+ ANTLR_USE_NAMESPACE(std)string filename;
+ TokenBuffer& getInput();
+private:
+ /** Where to get token objects */
+ TokenBuffer* input;
+ bool inputResponsible;
+
+ // we don't want these:
+ ParserInputState(const ParserInputState&);
+ ParserInputState& operator=(const ParserInputState&);
+};
+
+typedef RefCount<ParserInputState> ParserSharedInputState;
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_ParserSharedInputState_hpp__
diff --git a/poxml/antlr/antlr/RecognitionException.hpp b/poxml/antlr/antlr/RecognitionException.hpp
new file mode 100644
index 00000000..c6439111
--- /dev/null
+++ b/poxml/antlr/antlr/RecognitionException.hpp
@@ -0,0 +1,78 @@
+#ifndef INC_RecognitionException_hpp__
+#define INC_RecognitionException_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/ANTLRException.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class RecognitionException : public ANTLRException {
+public:
+ ANTLR_USE_NAMESPACE(std)string fileName; // not used by treeparsers
+ int line; // not used by treeparsers
+ int column; // not used by treeparsers
+
+ RecognitionException();
+
+ RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s,const ANTLR_USE_NAMESPACE(std)string& fileName_,int line);
+ RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s,const ANTLR_USE_NAMESPACE(std)string& fileName_,int line,int column);
+ ~RecognitionException() throw() {}
+
+ /**
+ * @return the column number that this exception happened on.
+ * @author Shawn P. Vincent (svincent@svincent.com)
+ */
+ virtual int getColumn() const;
+ /**
+ * @deprecated As of ANTLR 2.7.0
+ */
+ virtual ANTLR_USE_NAMESPACE(std)string getErrorMessage() const;
+protected:
+ virtual ANTLR_USE_NAMESPACE(std)string getFileLineString() const;
+public:
+ virtual ANTLR_USE_NAMESPACE(std)string getFilename() const;
+ /**
+ * @return the line number that this exception happened on.
+ * @author Shawn P. Vincent (svincent@svincent.com)
+ */
+ virtual int getLine() const;
+ virtual ANTLR_USE_NAMESPACE(std)string toString() const;
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_RecognitionException_hpp__
diff --git a/poxml/antlr/antlr/RefCount.hpp b/poxml/antlr/antlr/RefCount.hpp
new file mode 100644
index 00000000..9306576b
--- /dev/null
+++ b/poxml/antlr/antlr/RefCount.hpp
@@ -0,0 +1,87 @@
+#ifndef INC_RefCount_hpp__
+#define INC_RefCount_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+template<class T>
+class RefCount {
+private:
+ struct Ref {
+ T* const ptr;
+ unsigned int count;
+
+ Ref(T* p) : ptr(p), count(1) {}
+ ~Ref() {delete ptr;}
+ Ref* increment() {++count;return this;}
+ bool decrement() {return (--count==0);}
+ private:
+ Ref(const Ref&);
+ Ref& operator=(const Ref&);
+ }* ref;
+
+public:
+ explicit RefCount(T* p=0)
+ : ref(p ? new Ref(p) : 0)
+ {
+ }
+ RefCount(const RefCount<T>& other)
+ : ref(other.ref ? other.ref->increment() : 0)
+ {
+ }
+ ~RefCount()
+ {
+ if (ref && ref->decrement()) delete ref;
+ }
+ RefCount<T>& operator=(const RefCount<T>& other)
+ {
+ Ref* tmp=other.ref ? other.ref->increment() : 0;
+ if (ref && ref->decrement()) delete ref;
+ ref=tmp;
+ return *this;
+ }
+
+ operator T* () const
+ { return ref ? ref->ptr : 0; }
+ T* operator->() const
+ { return ref ? ref->ptr : 0; }
+ T* get() const
+ { return ref ? ref->ptr : 0; }
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_RefCount_hpp__
diff --git a/poxml/antlr/antlr/SemanticException.hpp b/poxml/antlr/antlr/SemanticException.hpp
new file mode 100644
index 00000000..3f1a9447
--- /dev/null
+++ b/poxml/antlr/antlr/SemanticException.hpp
@@ -0,0 +1,52 @@
+#ifndef INC_SemanticException_hpp__
+#define INC_SemanticException_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/RecognitionException.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class SemanticException : public RecognitionException {
+public:
+ SemanticException(const ANTLR_USE_NAMESPACE(std)string& s)
+ : RecognitionException(s) {}
+ SemanticException(const ANTLR_USE_NAMESPACE(std)string& s,const ANTLR_USE_NAMESPACE(std)string& fileName_,int line_)
+ : RecognitionException(s,fileName_,line_) {}
+ ~SemanticException() throw() {}
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_SemanticException_hpp__
diff --git a/poxml/antlr/antlr/String.hpp b/poxml/antlr/antlr/String.hpp
new file mode 100644
index 00000000..5fac82d6
--- /dev/null
+++ b/poxml/antlr/antlr/String.hpp
@@ -0,0 +1,47 @@
+#ifndef INC_String_hpp__
+#define INC_String_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include <string>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+ANTLR_USE_NAMESPACE(std)string operator+(const ANTLR_USE_NAMESPACE(std)string& lhs,int rhs);
+
+ANTLR_USE_NAMESPACE(std)string charName(int ch);
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_String_hpp__
diff --git a/poxml/antlr/antlr/Token.hpp b/poxml/antlr/antlr/Token.hpp
new file mode 100644
index 00000000..b85551c3
--- /dev/null
+++ b/poxml/antlr/antlr/Token.hpp
@@ -0,0 +1,106 @@
+#ifndef INC_Token_hpp__
+#define INC_Token_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/RefCount.hpp"
+#include <string>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/** A token is minimally a token type. Subclasses can add the text matched
+ * for the token and line info.
+ */
+
+class Token;
+typedef RefCount<Token> RefToken;
+
+class Token {
+public:
+ // constants
+#ifndef NO_STATIC_CONSTS
+ static const int MIN_USER_TYPE = 4;
+ static const int NULL_TREE_LOOKAHEAD = 3;
+ static const int INVALID_TYPE = 0;
+ static const int EOF_TYPE = 1;
+ static const int SKIP = -1;
+#else
+ enum {
+ MIN_USER_TYPE = 4,
+ NULL_TREE_LOOKAHEAD = 3,
+ INVALID_TYPE = 0,
+ EOF_TYPE = 1,
+ SKIP = -1
+ };
+#endif
+
+ // each Token has at least a token type
+ int type; //=INVALID_TYPE;
+
+public:
+ // the illegal token object
+ static RefToken badToken; // = new Token(INVALID_TYPE, "<no text>");
+
+ Token();
+ Token(int t);
+ Token(int t, const ANTLR_USE_NAMESPACE(std)string& txt);
+
+ virtual int getColumn() const;
+ virtual int getLine() const;
+ virtual ANTLR_USE_NAMESPACE(std)string getText() const;
+ virtual int getType() const;
+
+ virtual void setColumn(int c);
+
+ virtual void setLine(int l);
+ virtual void setText(const ANTLR_USE_NAMESPACE(std)string& t);
+ virtual void setType(int t);
+
+ virtual ANTLR_USE_NAMESPACE(std)string toString() const;
+
+ virtual ~Token();
+private:
+ Token(const Token&);
+ const Token& operator=(const Token&);
+};
+
+#ifdef NEEDS_OPERATOR_LESS_THAN
+inline operator<(RefToken l,RefToken r); //{return true;}
+#endif
+
+extern RefToken nullToken;
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_Token_hpp__
diff --git a/poxml/antlr/antlr/TokenBuffer.hpp b/poxml/antlr/antlr/TokenBuffer.hpp
new file mode 100644
index 00000000..b7c1b25f
--- /dev/null
+++ b/poxml/antlr/antlr/TokenBuffer.hpp
@@ -0,0 +1,141 @@
+#ifndef INC_TokenBuffer_hpp__
+#define INC_TokenBuffer_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/TokenStream.hpp"
+#include "antlr/CircularQueue.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/**A Stream of Token objects fed to the parser from a TokenStream that can
+ * be rewound via mark()/rewind() methods.
+ * <p>
+ * A dynamic array is used to buffer up all the input tokens. Normally,
+ * "k" tokens are stored in the buffer. More tokens may be stored during
+ * guess mode (testing syntactic predicate), or when LT(i>k) is referenced.
+ * Consumption of tokens is deferred. In other words, reading the next
+ * token is not done by conume(), but deferred until needed by LA or LT.
+ * <p>
+ *
+ * @see antlr.Token
+ * @see antlr.TokenStream
+ * @see antlr.TokenQueue
+ */
+class TokenBuffer {
+protected:
+ // Token source
+ TokenStream& input;
+
+private:
+ // Number of active markers
+ int nMarkers;
+
+ // Additional offset used when markers are active
+ int markerOffset;
+
+ // Number of calls to consume() since last LA() or LT() call
+ int numToConsume;
+
+ // Circular queue
+ CircularQueue<RefToken> queue;
+
+public:
+ /** Create a token buffer */
+ TokenBuffer(TokenStream& input_);
+
+ /** Mark another token for deferred consumption */
+ void consume();
+
+private:
+ /** Ensure that the token buffer is sufficiently full */
+ void fill(int amount);
+
+public:
+ /** Get a lookahead token value */
+ int LA(int i);
+
+ /** Get a lookahead token */
+ RefToken LT(int i);
+
+ /**Return an integer marker that can be used to rewind the buffer to
+ * its current state.
+ */
+ int mark();
+
+ /**Rewind the token buffer to a marker.
+ * @param mark Marker returned previously from mark()
+ */
+ void rewind(int mark);
+
+private:
+ /** Sync up deferred consumption */
+ void syncConsume();
+
+private:
+ TokenBuffer(const TokenBuffer& other);
+ const TokenBuffer& operator=(const TokenBuffer& other);
+public:
+// virtual ~TokenBuffer() {}
+};
+
+/** Sync up deferred consumption */
+inline void TokenBuffer::syncConsume()
+{
+#ifdef OLD_CODE
+ while (numToConsume > 0) {
+ if (nMarkers > 0) {
+ // guess mode -- leave leading tokens and bump offset.
+ markerOffset++;
+ } else {
+ // normal mode -- remove first token
+ queue.removeFirst();
+ }
+ numToConsume--;
+ }
+#endif
+
+ if (numToConsume > 0) {
+ if (nMarkers > 0) {
+ markerOffset += numToConsume;
+ } else {
+ queue.removeItems( numToConsume );
+ }
+ numToConsume = 0;
+ }
+}
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TokenBuffer_hpp__
diff --git a/poxml/antlr/antlr/TokenStream.hpp b/poxml/antlr/antlr/TokenStream.hpp
new file mode 100644
index 00000000..e8436419
--- /dev/null
+++ b/poxml/antlr/antlr/TokenStream.hpp
@@ -0,0 +1,54 @@
+#ifndef INC_TokenStream_hpp__
+#define INC_TokenStream_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+/**This interface allows any object to pretend it is a stream
+ * of tokens.
+ * @author Terence Parr, MageLang Institute
+ */
+
+#include "antlr/config.hpp"
+#include "antlr/Token.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class TokenStream {
+public:
+ virtual RefToken nextToken()=0;
+ virtual ~TokenStream() {}
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TokenStream_hpp__
diff --git a/poxml/antlr/antlr/TokenStreamBasicFilter.hpp b/poxml/antlr/antlr/TokenStreamBasicFilter.hpp
new file mode 100644
index 00000000..5438878b
--- /dev/null
+++ b/poxml/antlr/antlr/TokenStreamBasicFilter.hpp
@@ -0,0 +1,35 @@
+#ifndef INC_TokenStreamBasicFilter_hpp__
+#define INC_TokenStreamBasicFilter_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/BitSet.hpp"
+#include "antlr/TokenStream.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/** This object is a TokenStream that passes through all
+ * tokens except for those that you tell it to discard.
+ * There is no buffering of the tokens.
+ */
+class TokenStreamBasicFilter : public TokenStream {
+ /** The set of token types to discard */
+protected:
+ BitSet discardMask;
+
+ /** The input stream */
+protected:
+ TokenStream* input;
+
+public:
+ TokenStreamBasicFilter(TokenStream& input_);
+
+ void discard(int ttype);
+
+ void discard(const BitSet& mask);
+
+ RefToken nextToken();
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TokenStreamBasicFilter_hpp__
diff --git a/poxml/antlr/antlr/TokenStreamException.hpp b/poxml/antlr/antlr/TokenStreamException.hpp
new file mode 100644
index 00000000..2dc96776
--- /dev/null
+++ b/poxml/antlr/antlr/TokenStreamException.hpp
@@ -0,0 +1,19 @@
+#ifndef INC_TokenStreamException_hpp__
+#define INC_TokenStreamException_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/ANTLRException.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class TokenStreamException : public ANTLRException {
+public:
+ TokenStreamException() {}
+ TokenStreamException(const ANTLR_USE_NAMESPACE(std)string& s)
+ : ANTLRException(s) {}
+ virtual ~TokenStreamException() throw() {}
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TokenStreamException_hpp__
diff --git a/poxml/antlr/antlr/TokenStreamHiddenTokenFilter.hpp b/poxml/antlr/antlr/TokenStreamHiddenTokenFilter.hpp
new file mode 100644
index 00000000..47aad001
--- /dev/null
+++ b/poxml/antlr/antlr/TokenStreamHiddenTokenFilter.hpp
@@ -0,0 +1,84 @@
+#ifndef INC_TokenStreamHiddenTokenFilter_hpp__
+#define INC_TokenStreamHiddenTokenFilter_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/TokenStreamBasicFilter.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/**This object filters a token stream coming from a lexer
+ * or another TokenStream so that only certain token channels
+ * get transmitted to the parser.
+ *
+ * Any of the channels can be filtered off as "hidden" channels whose
+ * tokens can be accessed from the parser.
+ */
+class TokenStreamHiddenTokenFilter : public TokenStreamBasicFilter {
+ // protected BitSet discardMask;
+protected:
+ BitSet hideMask;
+
+private:
+ RefToken nextMonitoredToken;
+
+protected:
+ /** track tail of hidden list emanating from previous
+ * monitored token
+ */
+ RefToken lastHiddenToken;
+
+ RefToken firstHidden; // = null;
+
+public:
+ TokenStreamHiddenTokenFilter(TokenStream& input);
+
+protected:
+ void consume();
+
+private:
+ void consumeFirst();
+
+public:
+ BitSet getDiscardMask() const;
+
+ /** Return a ptr to the hidden token appearing immediately after
+ * token t in the input stream.
+ */
+ RefToken getHiddenAfter(RefToken t);
+
+ /** Return a ptr to the hidden token appearing immediately before
+ * token t in the input stream.
+ */
+ RefToken getHiddenBefore(RefToken t);
+
+ BitSet getHideMask() const;
+
+ /** Return the first hidden token if one appears
+ * before any monitored token.
+ */
+ RefToken getInitialHiddenToken();
+
+ void hide(int m);
+
+ void hide(const BitSet& mask);
+
+protected:
+ RefToken LA(int i);
+
+public:
+/** Return the next monitored token.
+ * Test the token following the monitored token.
+ * If following is another monitored token, save it
+ * for the next invocation of nextToken (like a single
+ * lookahead token) and return it then.
+ * If following is unmonitored, nondiscarded (hidden)
+ * channel token, add it to the monitored token.
+ *
+ * Note: EOF must be a monitored Token.
+ */
+ RefToken nextToken();
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TokenStreamHiddenTokenFilter_hpp__
diff --git a/poxml/antlr/antlr/TokenStreamIOException.hpp b/poxml/antlr/antlr/TokenStreamIOException.hpp
new file mode 100644
index 00000000..9ac6d759
--- /dev/null
+++ b/poxml/antlr/antlr/TokenStreamIOException.hpp
@@ -0,0 +1,22 @@
+#ifndef INC_TokenStreamIOException_hpp__
+#define INC_TokenStreamIOException_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/TokenStreamException.hpp"
+#include <exception>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class TokenStreamIOException : public TokenStreamException {
+public:
+ ANTLR_USE_NAMESPACE(std)exception io;
+
+ TokenStreamIOException() {}
+ TokenStreamIOException(const ANTLR_USE_NAMESPACE(std)exception& e)
+ : TokenStreamException(e.what()), io(e) {}
+ ~TokenStreamIOException() throw() {}
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TokenStreamIOException_hpp__
diff --git a/poxml/antlr/antlr/TokenStreamRecognitionException.hpp b/poxml/antlr/antlr/TokenStreamRecognitionException.hpp
new file mode 100644
index 00000000..4aa4609f
--- /dev/null
+++ b/poxml/antlr/antlr/TokenStreamRecognitionException.hpp
@@ -0,0 +1,21 @@
+#ifndef INC_TokenStreamRecognitionException_hpp__
+#define INC_TokenStreamRecognitionException_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/TokenStreamException.hpp"
+#include <exception>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class TokenStreamRecognitionException : public TokenStreamException {
+public:
+ RecognitionException recog;
+
+ TokenStreamRecognitionException(RecognitionException& re)
+ : TokenStreamException(re.getMessage()), recog(re) {}
+ ~TokenStreamRecognitionException() throw() {}
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TokenStreamRecognitionException_hpp__
diff --git a/poxml/antlr/antlr/TokenStreamRetryException.hpp b/poxml/antlr/antlr/TokenStreamRetryException.hpp
new file mode 100644
index 00000000..a940d8c4
--- /dev/null
+++ b/poxml/antlr/antlr/TokenStreamRetryException.hpp
@@ -0,0 +1,17 @@
+#ifndef INC_TokenStreamRetryException_hpp__
+#define INC_TokenStreamRetryException_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/TokenStreamException.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class TokenStreamRetryException : public TokenStreamException {
+public:
+ TokenStreamRetryException() {}
+ ~TokenStreamRetryException() throw() {}
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TokenStreamRetryException_hpp__
diff --git a/poxml/antlr/antlr/TokenStreamSelector.hpp b/poxml/antlr/antlr/TokenStreamSelector.hpp
new file mode 100644
index 00000000..7e7d7398
--- /dev/null
+++ b/poxml/antlr/antlr/TokenStreamSelector.hpp
@@ -0,0 +1,78 @@
+#ifndef INC_TokenStreamSelector_hpp__
+#define INC_TokenStreamSelector_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/TokenStream.hpp"
+#include <map>
+#include <stack>
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/** A token stream MUX (multiplexor) knows about n token streams
+ * and can multiplex them onto the same channel for use by token
+ * stream consumer like a parser. This is a way to have multiple
+ * lexers break up the same input stream for a single parser.
+ * Or, you can have multiple instances of the same lexer handle
+ * multiple input streams; this works great for includes.
+ */
+class TokenStreamSelector : public TokenStream {
+protected:
+ /** The set of inputs to the MUX */
+#ifdef OS_NO_ALLOCATOR
+ typedef ANTLR_USE_NAMESPACE(std)less<ANTLR_USE_NAMESPACE(std)string> lessp;
+ typedef ANTLR_USE_NAMESPACE(std)map<ANTLR_USE_NAMESPACE(std)string,TokenStream*,lessp> inputStreamNames_coll;
+#else
+ typedef ANTLR_USE_NAMESPACE(std)map<ANTLR_USE_NAMESPACE(std)string,TokenStream*> inputStreamNames_coll;
+#endif
+ inputStreamNames_coll inputStreamNames;
+
+ /** The currently-selected token stream input */
+ TokenStream* input;
+
+ /** Used to track stack of input streams */
+#ifdef OS_NO_ALLOCATOR
+ typedef ANTLR_USE_NAMESPACE(std)stack<TokenStream*, ANTLR_USE_NAMESPACE(std)deque<TokenStream*> > streamStack_coll;
+#else
+ typedef ANTLR_USE_NAMESPACE(std)stack<TokenStream*> streamStack_coll;
+#endif
+ streamStack_coll streamStack;
+
+public:
+ TokenStreamSelector();
+ ~TokenStreamSelector();
+
+ void addInputStream(TokenStream* stream, const ANTLR_USE_NAMESPACE(std)string& key);
+
+ /** Return the stream from which tokens are being pulled at
+ * the moment.
+ */
+ TokenStream* getCurrentStream() const;
+
+ TokenStream* getStream(const ANTLR_USE_NAMESPACE(std)string& sname) const;
+
+ RefToken nextToken();
+
+ TokenStream* pop();
+
+ void push(TokenStream* stream);
+
+ void push(const ANTLR_USE_NAMESPACE(std)string& sname);
+
+ /** Abort recognition of current Token and try again.
+ * A stream can push a new stream (for include files
+ * for example, and then retry(), which will cause
+ * the current stream to abort back to this.nextToken().
+ * this.nextToken() then asks for a token from the
+ * current stream, which is the new "substream."
+ */
+ void retry();
+
+/** Set the stream without pushing old stream */
+ void select(TokenStream* stream);
+
+ void select(const ANTLR_USE_NAMESPACE(std)string& sname);
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TokenStreamSelector_hpp__
diff --git a/poxml/antlr/antlr/TreeParser.hpp b/poxml/antlr/antlr/TreeParser.hpp
new file mode 100644
index 00000000..ed474bd1
--- /dev/null
+++ b/poxml/antlr/antlr/TreeParser.hpp
@@ -0,0 +1,159 @@
+#ifndef INC_TreeParser_hpp__
+#define INC_TreeParser_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+#include "antlr/config.hpp"
+#include "antlr/AST.hpp"
+#include "antlr/ASTFactory.hpp"
+#include "antlr/BitSet.hpp"
+#include "antlr/RecognitionException.hpp"
+#include "antlr/TreeParserSharedInputState.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+class TreeParser {
+public:
+ TreeParser();
+ TreeParser(const TreeParserSharedInputState& state);
+ virtual ~TreeParser();
+
+protected:
+ void setTokenNames(const char** tokenNames_);
+
+public:
+ /** The AST Null object; the parsing cursor is set to this when
+ * it is found to be null. This way, we can test the
+ * token type of a node without having to have tests for null
+ * everywhere.
+ */
+ static RefAST ASTNULL;
+
+protected:
+ /** Where did this rule leave off parsing; avoids a return parameter */
+ RefAST _retTree;
+
+ /** guessing nesting level; guessing==0 implies not guessing */
+ // int guessing; // = 0;
+
+ /** Nesting level of registered handlers */
+ // int exceptionLevel; // = 0;
+
+ TreeParserSharedInputState inputState;
+
+ /** Table of token type to token names */
+ ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string> tokenNames;
+
+ /** AST return value for a rule is squirreled away here */
+ RefAST returnAST;
+
+ /** AST support code; parser and treeparser delegate to this object */
+ ASTFactory astFactory; // = new ASTFactory();
+
+ /** Used to keep track of indent depth with -traceTreeParser */
+ int traceDepth;
+
+public:
+ /** Get the AST return value squirreled away in the parser */
+ RefAST getAST() const {
+ return returnAST;
+ }
+
+ ANTLR_USE_NAMESPACE(std)string getTokenName(int num) const;
+ ANTLR_USE_NAMESPACE(std)vector<ANTLR_USE_NAMESPACE(std)string> getTokenNames() const;
+
+protected:
+ void match(RefAST t, int ttype);
+
+public:
+ /**Make sure current lookahead symbol matches the given set
+ * Throw an exception upon mismatch, which is catch by either the
+ * error handler or by the syntactic predicate.
+ */
+ void match(RefAST t, const BitSet& b);
+
+protected:
+ void matchNot(RefAST t, int ttype);
+
+public:
+ static void panic();
+
+ /** Parser error-reporting function can be overridden in subclass */
+ virtual void reportError(const RecognitionException& ex);
+
+ /** Parser error-reporting function can be overridden in subclass */
+ virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ /** Parser warning-reporting function can be overridden in subclass */
+ virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s);
+
+ /** Specify an object with support code (shared by
+ * Parser and TreeParser. Normally, the programmer
+ * does not play with this, using setASTNodeType instead.
+ */
+// void setASTFactory(ASTFactory f);
+
+ /** Specify the type of node to create during tree building */
+ void setASTNodeFactory(ASTFactory::factory_type factory);
+
+protected:
+ /** Utility class which allows tracing to work even when exceptions are
+ * thrown.
+ */
+ class Tracer {
+ private:
+ TreeParser* parser;
+ ANTLR_USE_NAMESPACE(std)string text;
+ RefAST tree;
+ public:
+ Tracer(TreeParser* p,const ANTLR_USE_NAMESPACE(std)string& t, RefAST a)
+ : parser(p), text(t), tree(a) { parser->traceIn(text,tree); }
+ ~Tracer()
+ { parser->traceOut(text,tree); }
+ private:
+ Tracer(const Tracer&); // undefined
+ const Tracer& operator=(const Tracer&); // undefined
+ };
+
+public:
+ void traceIndent();
+ void traceIn(const ANTLR_USE_NAMESPACE(std)string& rname, RefAST t);
+ void traceOut(const ANTLR_USE_NAMESPACE(std)string& rname, RefAST t);
+
+private:
+ TreeParser(const TreeParser& other);
+ TreeParser& operator=(const TreeParser& other);
+};
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TreeParser_hpp__
diff --git a/poxml/antlr/antlr/TreeParserSharedInputState.hpp b/poxml/antlr/antlr/TreeParserSharedInputState.hpp
new file mode 100644
index 00000000..8f7b0922
--- /dev/null
+++ b/poxml/antlr/antlr/TreeParserSharedInputState.hpp
@@ -0,0 +1,34 @@
+#ifndef INC_TreeParserSharedInputState_hpp__
+#define INC_TreeParserSharedInputState_hpp__
+
+#include "antlr/config.hpp"
+#include "antlr/RefCount.hpp"
+
+ANTLR_BEGIN_NAMESPACE(antlr)
+
+/** This object contains the data associated with an
+ * input AST. Multiple parsers
+ * share a single TreeParserSharedInputState to parse
+ * the same tree or to have the parser walk multiple
+ * trees.
+ */
+class TreeParserInputState {
+public:
+ TreeParserInputState();
+ ~TreeParserInputState();
+
+public:
+ /** Are we guessing (guessing>0)? */
+ int guessing; //= 0;
+
+private:
+ // we don't want these:
+ TreeParserInputState(const TreeParserInputState&);
+ TreeParserInputState& operator=(const TreeParserInputState&);
+};
+
+typedef RefCount<TreeParserInputState> TreeParserSharedInputState;
+
+ANTLR_END_NAMESPACE
+
+#endif //INC_TreeParserSharedInputState_hpp__
diff --git a/poxml/antlr/antlr/config.hpp b/poxml/antlr/antlr/config.hpp
new file mode 100644
index 00000000..8ac94a3a
--- /dev/null
+++ b/poxml/antlr/antlr/config.hpp
@@ -0,0 +1,168 @@
+#ifndef INC_config_hpp__
+#define INC_config_hpp__
+
+/**
+ * <b>SOFTWARE RIGHTS</b>
+ * <p>
+ * ANTLR 2.6.0 MageLang Insitute, 1999
+ * <p>
+ * We reserve no legal rights to the ANTLR--it is fully in the
+ * public domain. An individual or company may do whatever
+ * they wish with source code distributed with ANTLR or the
+ * code generated by ANTLR, including the incorporation of
+ * ANTLR, or its output, into commerical software.
+ * <p>
+ * We encourage users to develop software with ANTLR. However,
+ * we do ask that credit is given to us for developing
+ * ANTLR. By "credit", we mean that if you use ANTLR or
+ * incorporate any source code into one of your programs
+ * (commercial product, research project, or otherwise) that
+ * you acknowledge this fact somewhere in the documentation,
+ * research report, etc... If you like ANTLR and have
+ * developed a nice tool with the output, please mention that
+ * you developed it using ANTLR. In addition, we ask that the
+ * headers remain intact in our source code. As long as these
+ * guidelines are kept, we expect to continue enhancing this
+ * system and expect to make other tools available as they are
+ * completed.
+ * <p>
+ * The ANTLR gang:
+ * @version ANTLR 2.6.0 MageLang Insitute, 1999
+ * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
+ * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
+ * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
+ */
+
+/*
+ * Just a simple configuration file to differentiate between the
+ * various compilers used.
+ */
+
+/*
+ Some compilers do not accept namespaces std:: for example.
+ In this case, just define #define ANTLR_USE_NAMESPACE(_x_).
+
+ See SunWorkShop 4.2 for example.
+ */
+#define ANTLR_USE_NAMESPACE(_x_) _x_::
+#define ANTLR_USING_NAMESPACE(_x_) using namespace _x_;
+#define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ {
+#define ANTLR_END_NAMESPACE }
+#define ANTLR_C_USING(_x_)
+
+#if defined(_MSC_VER) && !defined(__ICL) // Microsoft Visual C++
+
+// This warning really gets on my nerves.
+// It's the one about symbol longer than 256 chars, and it happens
+// all the time with STL.
+#pragma warning( disable : 4786 )
+
+// Now, some defines for shortcomings in the MS compiler:
+
+// Not allowed to put 'static const int XXX=20;' in a class definition
+#define NO_STATIC_CONSTS
+// Using vector<XXX> requires operator<(X,X) to be defined
+#define NEEDS_OPERATOR_LESS_THAN
+// No strcasecmp in the C library (so use stricmp instead)
+// - Anyone know which is in which standard?
+#define NO_STRCASECMP
+
+#endif
+
+#if defined(__ICL)
+#define NO_STRCASECMP
+#endif
+
+//
+// SunPro Compiler (Using OBJECTSPACE STL)
+//
+#ifdef __SUNPRO_CC
+
+#if (__SUNPRO_CC >= 0x500)
+
+#define NEEDS_OPERATOR_LESS_THAN
+#define NO_TEMPLATE_PARTS
+
+#else
+
+#undef namespace
+#define namespace
+
+
+#if (__SUNPRO_CC == 0x420)
+
+/* This code is specif to SunWspro Compiler 4.2, and will compile with
+ the objectspace 2.1 toolkit for Solaris2.6 */
+#define HAS_NOT_CASSERT_H
+#define HAS_NOT_CSTRING_H
+#define HAS_NOT_CCTYPE_H
+#define HAS_NOT_CSTDIO_H
+#define HAS_OSTREAM_H
+
+/* #define OS_SOLARIS_2_6
+#define OS_NO_WSTRING
+#define OS_NO_ALLOCATORS
+#define OS_MULTI_THREADED
+#define OS_SOLARIS_NATIVE
+#define OS_REALTIME
+#define __OSVERSION__=5
+#define SVR4
+*/
+
+// ObjectSpace + some specific templates constructions with stl.
+/* #define OS_NO_ALLOCATOR */
+
+// This great compiler does not have the namespace feature.
+#undef ANTLR_USE_NAMESPACE
+#define ANTLR_USE_NAMESPACE(_x_)
+#undef ANTLR_USING_NAMESPACE
+#define ANTLR_USING_NAMESPACE(_x_)
+#undef ANTLR_BEGIN_NAMESPACE
+#define ANTLR_BEGIN_NAMESPACE(_x_)
+#undef ANTLR_END_NAMESPACE
+#define ANTLR_END_NAMESPACE
+
+#endif
+
+#undef explicit
+#define explicit
+
+#define exception os_exception
+#define bad_exception os_bad_exception
+
+// Not allowed to put 'static const int XXX=20;' in a class definition
+#define NO_STATIC_CONSTS
+// Using vector<XXX> requires operator<(X,X) to be defined
+#define NEEDS_OPERATOR_LESS_THAN
+
+#endif
+
+#endif
+
+//
+// Inprise C++ Builder 3.0
+//
+#ifdef __BCPLUSPLUS__
+
+#define NO_TEMPLATE_PARTS
+#define NO_STRCASECMP
+#endif
+
+#ifdef _AIX
+#include <strings.h>
+#endif
+
+//
+// Metrowerks Codewarrior
+//
+#ifdef __MWERKS__
+#if (__MWERKS__ <= 0x2201)
+#define NO_TEMPLATE_PARTS
+#define ANTLR_REALLY_NO_STRCASECMP
+#endif
+
+#undef ANTLR_C_USING
+#define ANTLR_C_USING(_x_) using std:: ## _x_;
+#endif
+
+#endif //INC_config_hpp__