]> git.saurik.com Git - apple/security.git/blobdiff - Security/libsecurity_codesigning/antlr2/antlr/TokenWithIndex.hpp
Security-57031.1.35.tar.gz
[apple/security.git] / Security / libsecurity_codesigning / antlr2 / antlr / TokenWithIndex.hpp
diff --git a/Security/libsecurity_codesigning/antlr2/antlr/TokenWithIndex.hpp b/Security/libsecurity_codesigning/antlr2/antlr/TokenWithIndex.hpp
new file mode 100644 (file)
index 0000000..e4a3e37
--- /dev/null
@@ -0,0 +1,84 @@
+#ifndef INC_TokenWithIndex_hpp__
+#define INC_TokenWithIndex_hpp__
+
+/* ANTLR Translator Generator
+ * Project led by Terence Parr at http://www.jGuru.com
+ * Software rights: http://www.antlr.org/license.html
+ *
+ * $Id:$
+ */
+
+#include <antlr/config.hpp>
+#include <antlr/CommonToken.hpp>
+#include <antlr/String.hpp>
+
+#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
+namespace antlr {
+#endif
+
+class ANTLR_API TokenWithIndex : public ANTLR_USE_NAMESPACE(antlr)CommonToken {
+public:
+       // static size_t count;
+       TokenWithIndex() : CommonToken(), index(0)
+       {
+               // std::cout << __PRETTY_FUNCTION__ << std::endl;
+               // count++;
+       }
+       TokenWithIndex(int t, const ANTLR_USE_NAMESPACE(std)string& txt)
+       : CommonToken(t,txt)
+       , index(0)
+       {
+               // std::cout << __PRETTY_FUNCTION__ << std::endl;
+               // count++;
+       }
+       TokenWithIndex(const ANTLR_USE_NAMESPACE(std)string& s)
+       : CommonToken(s)
+       , index(0)
+       {
+               // std::cout << __PRETTY_FUNCTION__ << std::endl;
+               // count++;
+       }
+       ~TokenWithIndex()
+       {
+               // count--;
+       }
+       void setIndex( size_t idx )
+       {
+               index = idx;
+       }
+       size_t getIndex( void ) const
+       {
+               return index;
+       }
+
+       ANTLR_USE_NAMESPACE(std)string toString() const
+       {
+               return ANTLR_USE_NAMESPACE(std)string("[")+
+                       index+
+                       ":\""+
+                       getText()+"\",<"+
+                       getType()+">,line="+
+                       getLine()+",column="+
+                       getColumn()+"]";
+       }
+
+       static RefToken factory()
+       {
+               return RefToken(new TokenWithIndex());
+       }
+
+protected:
+       size_t index;
+
+private:
+       TokenWithIndex(const TokenWithIndex&);
+       const TokenWithIndex& operator=(const TokenWithIndex&);
+};
+
+typedef TokenRefCount<TokenWithIndex> RefTokenWithIndex;
+
+#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
+}
+#endif
+
+#endif //INC_CommonToken_hpp__