diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/java/JavaAST.hpp | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/java/JavaAST.hpp')
-rw-r--r-- | languages/java/JavaAST.hpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/languages/java/JavaAST.hpp b/languages/java/JavaAST.hpp new file mode 100644 index 00000000..7108fca1 --- /dev/null +++ b/languages/java/JavaAST.hpp @@ -0,0 +1,77 @@ +#ifndef JAVAAST_HPP +#define JAVAAST_HPP + +#include <antlr/CommonAST.hpp> +#include <antlr/ASTFactory.hpp> + +class JavaAST; +typedef ANTLR_USE_NAMESPACE(antlr)ASTRefCount<JavaAST> RefJavaAST; + +class JavaAST : public ANTLR_USE_NAMESPACE(antlr)CommonAST +{ +public: + JavaAST() + : m_line(0), m_column(0) {} + + virtual ~JavaAST() {} + + int getLine() const { return m_line; } + void setLine( int line ) { m_line = line; } + + int getColumn() const { return m_column; } + void setColumn( int column ) { m_column = column; } + + void initialize( ANTLR_USE_NAMESPACE(antlr)RefToken t ) + { + CommonAST::initialize(t); + m_line = t->getLine() - 1; + m_column = t->getColumn() - 1; + } + + void initialize( ANTLR_USE_NAMESPACE(antlr)RefAST t ) + { + CommonAST::initialize( t ); + + m_line = 0; + m_column = 0; + + RefJavaAST a( dynamic_cast<JavaAST*>(t.get()) ); + m_line = a->getLine(); + m_column = a->getColumn(); + } + + void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) + { + CommonAST::initialize( t, txt ); + m_line = 0; + m_column = 0; + } + + static ANTLR_USE_NAMESPACE(antlr)RefAST factory() + { + RefJavaAST n(new JavaAST); + return n.get(); + } + + +private: + int m_line; + int m_column; + +private: + JavaAST( const JavaAST& source ); + void operator = ( const JavaAST& source ); +}; + +namespace antlr +{ + +class JavaASTFactory: public ASTFactory +{ +public: + JavaASTFactory(): ASTFactory( "JavaAST", JavaAST::factory ) {} +}; + +} // namespace antlr + +#endif |