From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- languages/java/JavaAST.hpp | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 languages/java/JavaAST.hpp (limited to 'languages/java/JavaAST.hpp') 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 +#include + +class JavaAST; +typedef ANTLR_USE_NAMESPACE(antlr)ASTRefCount 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(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 -- cgit v1.2.1