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 | |
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')
81 files changed, 20814 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 diff --git a/languages/java/JavaLexer.cpp b/languages/java/JavaLexer.cpp new file mode 100644 index 00000000..623e816f --- /dev/null +++ b/languages/java/JavaLexer.cpp @@ -0,0 +1,2183 @@ +/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaLexer.cpp"$ */ +#include "JavaLexer.hpp" +#include <antlr/CharBuffer.hpp> +#include <antlr/TokenStreamException.hpp> +#include <antlr/TokenStreamIOException.hpp> +#include <antlr/TokenStreamRecognitionException.hpp> +#include <antlr/CharStreamException.hpp> +#include <antlr/CharStreamIOException.hpp> +#include <antlr/NoViableAltForCharException.hpp> + +#line 1041 "java.g" + +#include <string> + +#line 16 "JavaLexer.cpp" +JavaLexer::JavaLexer(ANTLR_USE_NAMESPACE(std)istream& in) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(new ANTLR_USE_NAMESPACE(antlr)CharBuffer(in),true) +{ + initLiterals(); +} + +JavaLexer::JavaLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(ib,true) +{ + initLiterals(); +} + +JavaLexer::JavaLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(state,true) +{ + initLiterals(); +} + +void JavaLexer::initLiterals() +{ + literals["byte"] = 51; + literals["public"] = 62; + literals["case"] = 94; + literals["short"] = 53; + literals["break"] = 89; + literals["while"] = 87; + literals["new"] = 137; + literals["instanceof"] = 122; + literals["implements"] = 76; + literals["synchronized"] = 68; + literals["float"] = 55; + literals["package"] = 44; + literals["return"] = 91; + literals["throw"] = 93; + literals["null"] = 136; + literals["threadsafe"] = 67; + literals["protected"] = 63; + literals["class"] = 70; + literals["throws"] = 82; + literals["do"] = 88; + literals["strictfp"] = 41; + literals["super"] = 80; + literals["transient"] = 65; + literals["native"] = 66; + literals["interface"] = 72; + literals["final"] = 39; + literals["if"] = 84; + literals["double"] = 57; + literals["volatile"] = 69; + literals["catch"] = 98; + literals["try"] = 96; + literals["int"] = 54; + literals["for"] = 86; + literals["extends"] = 71; + literals["boolean"] = 50; + literals["char"] = 52; + literals["private"] = 61; + literals["default"] = 95; + literals["false"] = 135; + literals["this"] = 79; + literals["static"] = 64; + literals["abstract"] = 40; + literals["continue"] = 90; + literals["finally"] = 97; + literals["else"] = 85; + literals["import"] = 46; + literals["void"] = 49; + literals["switch"] = 92; + literals["true"] = 134; + literals["long"] = 56; +} + +ANTLR_USE_NAMESPACE(antlr)RefToken JavaLexer::nextToken() +{ + ANTLR_USE_NAMESPACE(antlr)RefToken theRetToken; + for (;;) { + ANTLR_USE_NAMESPACE(antlr)RefToken theRetToken; + int _ttype = ANTLR_USE_NAMESPACE(antlr)Token::INVALID_TYPE; + resetText(); + try { // for lexical and char stream error handling + switch ( LA(1)) { + case 0x3f /* '?' */ : + { + mQUESTION(true); + theRetToken=_returnToken; + break; + } + case 0x28 /* '(' */ : + { + mLPAREN(true); + theRetToken=_returnToken; + break; + } + case 0x29 /* ')' */ : + { + mRPAREN(true); + theRetToken=_returnToken; + break; + } + case 0x5b /* '[' */ : + { + mLBRACK(true); + theRetToken=_returnToken; + break; + } + case 0x5d /* ']' */ : + { + mRBRACK(true); + theRetToken=_returnToken; + break; + } + case 0x7b /* '{' */ : + { + mLCURLY(true); + theRetToken=_returnToken; + break; + } + case 0x7d /* '}' */ : + { + mRCURLY(true); + theRetToken=_returnToken; + break; + } + case 0x3a /* ':' */ : + { + mCOLON(true); + theRetToken=_returnToken; + break; + } + case 0x2c /* ',' */ : + { + mCOMMA(true); + theRetToken=_returnToken; + break; + } + case 0x7e /* '~' */ : + { + mBNOT(true); + theRetToken=_returnToken; + break; + } + case 0x3b /* ';' */ : + { + mSEMI(true); + theRetToken=_returnToken; + break; + } + case 0x9 /* '\t' */ : + case 0xa /* '\n' */ : + case 0xc /* '\14' */ : + case 0xd /* '\r' */ : + case 0x20 /* ' ' */ : + { + mWS(true); + theRetToken=_returnToken; + break; + } + case 0x27 /* '\'' */ : + { + mCHAR_LITERAL(true); + theRetToken=_returnToken; + break; + } + case 0x22 /* '\"' */ : + { + mSTRING_LITERAL(true); + theRetToken=_returnToken; + break; + } + case 0x24 /* '$' */ : + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + case 0x47 /* 'G' */ : + case 0x48 /* 'H' */ : + case 0x49 /* 'I' */ : + case 0x4a /* 'J' */ : + case 0x4b /* 'K' */ : + case 0x4c /* 'L' */ : + case 0x4d /* 'M' */ : + case 0x4e /* 'N' */ : + case 0x4f /* 'O' */ : + case 0x50 /* 'P' */ : + case 0x51 /* 'Q' */ : + case 0x52 /* 'R' */ : + case 0x53 /* 'S' */ : + case 0x54 /* 'T' */ : + case 0x55 /* 'U' */ : + case 0x56 /* 'V' */ : + case 0x57 /* 'W' */ : + case 0x58 /* 'X' */ : + case 0x59 /* 'Y' */ : + case 0x5a /* 'Z' */ : + case 0x5f /* '_' */ : + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + mIDENT(true); + theRetToken=_returnToken; + break; + } + case 0x2e /* '.' */ : + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + mNUM_INT(true); + theRetToken=_returnToken; + break; + } + default: + if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3e /* '>' */ ) && (LA(3) == 0x3e /* '>' */ ) && (LA(4) == 0x3d /* '=' */ )) { + mBSR_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3e /* '>' */ ) && (LA(3) == 0x3d /* '=' */ )) { + mSR_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3e /* '>' */ ) && (LA(3) == 0x3e /* '>' */ ) && (true)) { + mBSR(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3c /* '<' */ ) && (LA(3) == 0x3d /* '=' */ )) { + mSL_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3d /* '=' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mEQUAL(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x21 /* '!' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mNOT_EQUAL(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2f /* '/' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mDIV_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2b /* '+' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mPLUS_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2b /* '+' */ ) && (LA(2) == 0x2b /* '+' */ )) { + mINC(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2d /* '-' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mMINUS_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2d /* '-' */ ) && (LA(2) == 0x2d /* '-' */ )) { + mDEC(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2a /* '*' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mSTAR_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x25 /* '%' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mMOD_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3e /* '>' */ ) && (true)) { + mSR(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mGE(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3c /* '<' */ ) && (true)) { + mSL(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mLE(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x5e /* '^' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mBXOR_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x7c /* '|' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mBOR_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x7c /* '|' */ ) && (LA(2) == 0x7c /* '|' */ )) { + mLOR(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x26 /* '&' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mBAND_ASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x26 /* '&' */ ) && (LA(2) == 0x26 /* '&' */ )) { + mLAND(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2f /* '/' */ ) && (LA(2) == 0x2f /* '/' */ )) { + mSL_COMMENT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2f /* '/' */ ) && (LA(2) == 0x2a /* '*' */ )) { + mML_COMMENT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3d /* '=' */ ) && (true)) { + mASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x21 /* '!' */ ) && (true)) { + mLNOT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2f /* '/' */ ) && (true)) { + mDIV(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2b /* '+' */ ) && (true)) { + mPLUS(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2d /* '-' */ ) && (true)) { + mMINUS(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2a /* '*' */ ) && (true)) { + mSTAR(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x25 /* '%' */ ) && (true)) { + mMOD(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3e /* '>' */ ) && (true)) { + mGT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (true)) { + mLT_(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x5e /* '^' */ ) && (true)) { + mBXOR(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x7c /* '|' */ ) && (true)) { + mBOR(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x26 /* '&' */ ) && (true)) { + mBAND(true); + theRetToken=_returnToken; + } + else { + if (LA(1)==EOF_CHAR) + { + uponEOF(); + _returnToken = makeToken(ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE); + } + else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + } + if ( !_returnToken ) + goto tryAgain; // found SKIP token + + _ttype = _returnToken->getType(); + _returnToken->setType(_ttype); + return _returnToken; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& e) { + throw ANTLR_USE_NAMESPACE(antlr)TokenStreamRecognitionException(e); + } + catch (ANTLR_USE_NAMESPACE(antlr)CharStreamIOException& csie) { + throw ANTLR_USE_NAMESPACE(antlr)TokenStreamIOException(csie.io); + } + catch (ANTLR_USE_NAMESPACE(antlr)CharStreamException& cse) { + throw ANTLR_USE_NAMESPACE(antlr)TokenStreamException(cse.getMessage()); + } +tryAgain:; + } +} + +void JavaLexer::mQUESTION(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = QUESTION; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('?' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mLPAREN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LPAREN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('(' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mRPAREN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = RPAREN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(')' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mLBRACK(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LBRACK; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('[' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mRBRACK(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = RBRACK; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(']' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mLCURLY(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LCURLY; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('{' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mRCURLY(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = RCURLY; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('}' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mCOLON(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COLON; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(':' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mCOMMA(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COMMA; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(',' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('=' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mEQUAL(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = EQUAL; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("=="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mLNOT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LNOT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('!' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mBNOT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = BNOT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('~' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mNOT_EQUAL(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = NOT_EQUAL; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("!="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mDIV(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = DIV; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('/' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mDIV_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = DIV_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("/="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mPLUS(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = PLUS; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('+' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mPLUS_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = PLUS_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("+="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mINC(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = INC; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("++"); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mMINUS(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = MINUS; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('-' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mMINUS_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = MINUS_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("-="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mDEC(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = DEC; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("--"); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mSTAR(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = STAR; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('*' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mSTAR_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = STAR_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("*="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mMOD(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = MOD; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('%' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mMOD_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = MOD_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("%="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mSR(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SR; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(">>"); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mSR_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SR_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(">>="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mBSR(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = BSR; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(">>>"); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mBSR_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = BSR_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(">>>="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mGE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = GE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(">="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mGT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = GT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(">"); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mSL(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SL; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("<<"); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mSL_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SL_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("<<="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mLE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("<="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mLT_(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LT_; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('<' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mBXOR(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = BXOR; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('^' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mBXOR_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = BXOR_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("^="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mBOR(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = BOR; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('|' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mBOR_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = BOR_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("|="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mLOR(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LOR; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("||"); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mBAND(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = BAND; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('&' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mBAND_ASSIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = BAND_ASSIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("&="); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mLAND(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LAND; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("&&"); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mSEMI(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SEMI; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(';' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mWS(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = WS; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { // ( ... )+ + int _cnt245=0; + for (;;) { + switch ( LA(1)) { + case 0x20 /* ' ' */ : + { + match(' ' /* charlit */ ); + break; + } + case 0x9 /* '\t' */ : + { + match('\t' /* charlit */ ); + break; + } + case 0xc /* '\14' */ : + { + match('\14' /* charlit */ ); + break; + } + case 0xa /* '\n' */ : + case 0xd /* '\r' */ : + { + { + if ((LA(1) == 0xd /* '\r' */ ) && (LA(2) == 0xa /* '\n' */ ) && (true) && (true)) { + match("\r\n"); + } + else if ((LA(1) == 0xd /* '\r' */ ) && (true) && (true) && (true)) { + match('\r' /* charlit */ ); + } + else if ((LA(1) == 0xa /* '\n' */ )) { + match('\n' /* charlit */ ); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + + } +#line 1137 "java.g" + newline(); +#line 1109 "JavaLexer.cpp" + break; + } + default: + { + if ( _cnt245>=1 ) { goto _loop245; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + } + _cnt245++; + } + _loop245:; + } // ( ... )+ +#line 1139 "java.g" + _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; +#line 1123 "JavaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mSL_COMMENT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SL_COMMENT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("//"); + { // ( ... )* + for (;;) { + if ((_tokenSet_0.member(LA(1)))) { + { + match(_tokenSet_0); + } + } + else { + goto _loop249; + } + + } + _loop249:; + } // ( ... )* + { + switch ( LA(1)) { + case 0xa /* '\n' */ : + { + match('\n' /* charlit */ ); + break; + } + case 0xd /* '\r' */ : + { + match('\r' /* charlit */ ); + { + if ((LA(1) == 0xa /* '\n' */ )) { + match('\n' /* charlit */ ); + } + else { + } + + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } +#line 1146 "java.g" + + _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; + newline(); + +#line 1183 "JavaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mML_COMMENT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = ML_COMMENT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("/*"); + { // ( ... )* + for (;;) { + if ((LA(1) == 0xd /* '\r' */ ) && (LA(2) == 0xa /* '\n' */ ) && ((LA(3) >= 0x3 /* '\3' */ && LA(3) <= 0xff)) && ((LA(4) >= 0x3 /* '\3' */ && LA(4) <= 0xff))) { + match('\r' /* charlit */ ); + match('\n' /* charlit */ ); +#line 1167 "java.g" + newline(); +#line 1205 "JavaLexer.cpp" + } + else if (((LA(1) == 0x2a /* '*' */ ) && ((LA(2) >= 0x3 /* '\3' */ && LA(2) <= 0xff)) && ((LA(3) >= 0x3 /* '\3' */ && LA(3) <= 0xff)))&&( LA(2)!='/' )) { + match('*' /* charlit */ ); + } + else if ((LA(1) == 0xd /* '\r' */ ) && ((LA(2) >= 0x3 /* '\3' */ && LA(2) <= 0xff)) && ((LA(3) >= 0x3 /* '\3' */ && LA(3) <= 0xff)) && (true)) { + match('\r' /* charlit */ ); +#line 1168 "java.g" + newline(); +#line 1214 "JavaLexer.cpp" + } + else if ((LA(1) == 0xa /* '\n' */ )) { + match('\n' /* charlit */ ); +#line 1169 "java.g" + newline(); +#line 1220 "JavaLexer.cpp" + } + else if ((_tokenSet_1.member(LA(1)))) { + { + match(_tokenSet_1); + } + } + else { + goto _loop255; + } + + } + _loop255:; + } // ( ... )* + match("*/"); +#line 1173 "java.g" + _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; +#line 1237 "JavaLexer.cpp" + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mCHAR_LITERAL(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = CHAR_LITERAL; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('\'' /* charlit */ ); + { + if ((LA(1) == 0x5c /* '\\' */ )) { + mESC(false); + } + else if ((_tokenSet_2.member(LA(1)))) { + matchNot('\'' /* charlit */ ); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + + } + match('\'' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mESC(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = ESC; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('\\' /* charlit */ ); + { + switch ( LA(1)) { + case 0x6e /* 'n' */ : + { + match('n' /* charlit */ ); + break; + } + case 0x72 /* 'r' */ : + { + match('r' /* charlit */ ); + break; + } + case 0x74 /* 't' */ : + { + match('t' /* charlit */ ); + break; + } + case 0x62 /* 'b' */ : + { + match('b' /* charlit */ ); + break; + } + case 0x66 /* 'f' */ : + { + match('f' /* charlit */ ); + break; + } + case 0x22 /* '\"' */ : + { + match('\"' /* charlit */ ); + break; + } + case 0x27 /* '\'' */ : + { + match('\'' /* charlit */ ); + break; + } + case 0x5c /* '\\' */ : + { + match('\\' /* charlit */ ); + break; + } + case 0x75 /* 'u' */ : + { + { // ( ... )+ + int _cnt265=0; + for (;;) { + if ((LA(1) == 0x75 /* 'u' */ )) { + match('u' /* charlit */ ); + } + else { + if ( _cnt265>=1 ) { goto _loop265; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt265++; + } + _loop265:; + } // ( ... )+ + mHEX_DIGIT(false); + mHEX_DIGIT(false); + mHEX_DIGIT(false); + mHEX_DIGIT(false); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + { + matchRange('0','3'); + { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x37 /* '7' */ )) && ((LA(2) >= 0x3 /* '\3' */ && LA(2) <= 0xff)) && (true) && (true)) { + matchRange('0','7'); + { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x37 /* '7' */ )) && ((LA(2) >= 0x3 /* '\3' */ && LA(2) <= 0xff)) && (true) && (true)) { + matchRange('0','7'); + } + else if (((LA(1) >= 0x3 /* '\3' */ && LA(1) <= 0xff)) && (true) && (true) && (true)) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + + } + } + else if (((LA(1) >= 0x3 /* '\3' */ && LA(1) <= 0xff)) && (true) && (true) && (true)) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + + } + break; + } + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + { + matchRange('4','7'); + { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x37 /* '7' */ )) && ((LA(2) >= 0x3 /* '\3' */ && LA(2) <= 0xff)) && (true) && (true)) { + matchRange('0','7'); + } + else if (((LA(1) >= 0x3 /* '\3' */ && LA(1) <= 0xff)) && (true) && (true) && (true)) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mSTRING_LITERAL(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = STRING_LITERAL; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('\"' /* charlit */ ); + { // ( ... )* + for (;;) { + if ((LA(1) == 0x5c /* '\\' */ )) { + mESC(false); + } + else if ((_tokenSet_3.member(LA(1)))) { + { + match(_tokenSet_3); + } + } + else { + goto _loop261; + } + + } + _loop261:; + } // ( ... )* + match('\"' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mHEX_DIGIT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = HEX_DIGIT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + switch ( LA(1)) { + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + matchRange('0','9'); + break; + } + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + { + matchRange('A','F'); + break; + } + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + { + matchRange('a','f'); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mVOCAB(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = VOCAB; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + matchRange('\3',static_cast<unsigned char>('\377')); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mIDENT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = IDENT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + switch ( LA(1)) { + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + matchRange('a','z'); + break; + } + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + case 0x47 /* 'G' */ : + case 0x48 /* 'H' */ : + case 0x49 /* 'I' */ : + case 0x4a /* 'J' */ : + case 0x4b /* 'K' */ : + case 0x4c /* 'L' */ : + case 0x4d /* 'M' */ : + case 0x4e /* 'N' */ : + case 0x4f /* 'O' */ : + case 0x50 /* 'P' */ : + case 0x51 /* 'Q' */ : + case 0x52 /* 'R' */ : + case 0x53 /* 'S' */ : + case 0x54 /* 'T' */ : + case 0x55 /* 'U' */ : + case 0x56 /* 'V' */ : + case 0x57 /* 'W' */ : + case 0x58 /* 'X' */ : + case 0x59 /* 'Y' */ : + case 0x5a /* 'Z' */ : + { + matchRange('A','Z'); + break; + } + case 0x5f /* '_' */ : + { + match('_' /* charlit */ ); + break; + } + case 0x24 /* '$' */ : + { + match('$' /* charlit */ ); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + matchRange('a','z'); + break; + } + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + case 0x47 /* 'G' */ : + case 0x48 /* 'H' */ : + case 0x49 /* 'I' */ : + case 0x4a /* 'J' */ : + case 0x4b /* 'K' */ : + case 0x4c /* 'L' */ : + case 0x4d /* 'M' */ : + case 0x4e /* 'N' */ : + case 0x4f /* 'O' */ : + case 0x50 /* 'P' */ : + case 0x51 /* 'Q' */ : + case 0x52 /* 'R' */ : + case 0x53 /* 'S' */ : + case 0x54 /* 'T' */ : + case 0x55 /* 'U' */ : + case 0x56 /* 'V' */ : + case 0x57 /* 'W' */ : + case 0x58 /* 'X' */ : + case 0x59 /* 'Y' */ : + case 0x5a /* 'Z' */ : + { + matchRange('A','Z'); + break; + } + case 0x5f /* '_' */ : + { + match('_' /* charlit */ ); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + matchRange('0','9'); + break; + } + case 0x24 /* '$' */ : + { + match('$' /* charlit */ ); + break; + } + default: + { + goto _loop275; + } + } + } + _loop275:; + } // ( ... )* + _ttype = testLiteralsTable(_ttype); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mNUM_INT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = NUM_INT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + ANTLR_USE_NAMESPACE(antlr)RefToken f1; + ANTLR_USE_NAMESPACE(antlr)RefToken f2; + ANTLR_USE_NAMESPACE(antlr)RefToken f3; + ANTLR_USE_NAMESPACE(antlr)RefToken f4; +#line 1251 "java.g" + + bool isDecimal = false; + ANTLR_USE_NAMESPACE(antlr)RefToken t = ANTLR_USE_NAMESPACE(antlr)nullToken; + +#line 1707 "JavaLexer.cpp" + + switch ( LA(1)) { + case 0x2e /* '.' */ : + { + match('.' /* charlit */ ); +#line 1256 "java.g" + _ttype = DOT; +#line 1715 "JavaLexer.cpp" + { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + { // ( ... )+ + int _cnt279=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + matchRange('0','9'); + } + else { + if ( _cnt279>=1 ) { goto _loop279; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt279++; + } + _loop279:; + } // ( ... )+ + { + if ((LA(1) == 0x45 /* 'E' */ || LA(1) == 0x65 /* 'e' */ )) { + mEXPONENT(false); + } + else { + } + + } + { + if ((LA(1) == 0x44 /* 'D' */ || LA(1) == 0x46 /* 'F' */ || LA(1) == 0x64 /* 'd' */ || LA(1) == 0x66 /* 'f' */ )) { + mFLOAT_SUFFIX(true); + f1=_returnToken; +#line 1257 "java.g" + t=f1; +#line 1746 "JavaLexer.cpp" + } + else { + } + + } +#line 1258 "java.g" + + if ( t && + (t->getText().find('f') != ANTLR_USE_NAMESPACE(std)string::npos || + t->getText().find('F') != ANTLR_USE_NAMESPACE(std)string::npos ) ) { + _ttype = NUM_FLOAT; + } + else { + _ttype = NUM_DOUBLE; // assume double + } + +#line 1763 "JavaLexer.cpp" + } + else { + } + + } + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + { + switch ( LA(1)) { + case 0x30 /* '0' */ : + { + match('0' /* charlit */ ); +#line 1270 "java.g" + isDecimal = true; +#line 1789 "JavaLexer.cpp" + { + switch ( LA(1)) { + case 0x58 /* 'X' */ : + case 0x78 /* 'x' */ : + { + { + switch ( LA(1)) { + case 0x78 /* 'x' */ : + { + match('x' /* charlit */ ); + break; + } + case 0x58 /* 'X' */ : + { + match('X' /* charlit */ ); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { // ( ... )+ + int _cnt286=0; + for (;;) { + if ((_tokenSet_4.member(LA(1))) && (true) && (true) && (true)) { + mHEX_DIGIT(false); + } + else { + if ( _cnt286>=1 ) { goto _loop286; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt286++; + } + _loop286:; + } // ( ... )+ + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + { + { // ( ... )+ + int _cnt288=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x37 /* '7' */ ))) { + matchRange('0','7'); + } + else { + if ( _cnt288>=1 ) { goto _loop288; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt288++; + } + _loop288:; + } // ( ... )+ + break; + } + default: + { + } + } + } + break; + } + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + { + matchRange('1','9'); + } + { // ( ... )* + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + matchRange('0','9'); + } + else { + goto _loop291; + } + + } + _loop291:; + } // ( ... )* +#line 1285 "java.g" + isDecimal=true; +#line 1888 "JavaLexer.cpp" + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { + if ((LA(1) == 0x4c /* 'L' */ || LA(1) == 0x6c /* 'l' */ )) { + { + switch ( LA(1)) { + case 0x6c /* 'l' */ : + { + match('l' /* charlit */ ); + break; + } + case 0x4c /* 'L' */ : + { + match('L' /* charlit */ ); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } +#line 1287 "java.g" + _ttype = NUM_LONG; +#line 1919 "JavaLexer.cpp" + } + else if (((LA(1) == 0x2e /* '.' */ || LA(1) == 0x44 /* 'D' */ || LA(1) == 0x45 /* 'E' */ || LA(1) == 0x46 /* 'F' */ || LA(1) == 0x64 /* 'd' */ || LA(1) == 0x65 /* 'e' */ || LA(1) == 0x66 /* 'f' */ ))&&(isDecimal)) { + { + switch ( LA(1)) { + case 0x2e /* '.' */ : + { + match('.' /* charlit */ ); + { // ( ... )* + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + matchRange('0','9'); + } + else { + goto _loop296; + } + + } + _loop296:; + } // ( ... )* + { + if ((LA(1) == 0x45 /* 'E' */ || LA(1) == 0x65 /* 'e' */ )) { + mEXPONENT(false); + } + else { + } + + } + { + if ((LA(1) == 0x44 /* 'D' */ || LA(1) == 0x46 /* 'F' */ || LA(1) == 0x64 /* 'd' */ || LA(1) == 0x66 /* 'f' */ )) { + mFLOAT_SUFFIX(true); + f2=_returnToken; +#line 1291 "java.g" + t=f2; +#line 1953 "JavaLexer.cpp" + } + else { + } + + } + break; + } + case 0x45 /* 'E' */ : + case 0x65 /* 'e' */ : + { + mEXPONENT(false); + { + if ((LA(1) == 0x44 /* 'D' */ || LA(1) == 0x46 /* 'F' */ || LA(1) == 0x64 /* 'd' */ || LA(1) == 0x66 /* 'f' */ )) { + mFLOAT_SUFFIX(true); + f3=_returnToken; +#line 1292 "java.g" + t=f3; +#line 1971 "JavaLexer.cpp" + } + else { + } + + } + break; + } + case 0x44 /* 'D' */ : + case 0x46 /* 'F' */ : + case 0x64 /* 'd' */ : + case 0x66 /* 'f' */ : + { + mFLOAT_SUFFIX(true); + f4=_returnToken; +#line 1293 "java.g" + t=f4; +#line 1988 "JavaLexer.cpp" + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } +#line 1295 "java.g" + + if ( t && + (t->getText().find('f') != ANTLR_USE_NAMESPACE(std)string::npos || + t->getText().find('F') != ANTLR_USE_NAMESPACE(std)string::npos ) ) { + _ttype = NUM_FLOAT; + } + else { + _ttype = NUM_DOUBLE; // assume double + } + +#line 2008 "JavaLexer.cpp" + } + else { + } + + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mEXPONENT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = EXPONENT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + switch ( LA(1)) { + case 0x65 /* 'e' */ : + { + match('e' /* charlit */ ); + break; + } + case 0x45 /* 'E' */ : + { + match('E' /* charlit */ ); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { + switch ( LA(1)) { + case 0x2b /* '+' */ : + { + match('+' /* charlit */ ); + break; + } + case 0x2d /* '-' */ : + { + match('-' /* charlit */ ); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { // ( ... )+ + int _cnt304=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + matchRange('0','9'); + } + else { + if ( _cnt304>=1 ) { goto _loop304; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt304++; + } + _loop304:; + } // ( ... )+ + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void JavaLexer::mFLOAT_SUFFIX(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = FLOAT_SUFFIX; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + switch ( LA(1)) { + case 0x66 /* 'f' */ : + { + match('f' /* charlit */ ); + break; + } + case 0x46 /* 'F' */ : + { + match('F' /* charlit */ ); + break; + } + case 0x64 /* 'd' */ : + { + match('d' /* charlit */ ); + break; + } + case 0x44 /* 'D' */ : + { + match('D' /* charlit */ ); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + + +const unsigned long JavaLexer::_tokenSet_0_data_[] = { 4294958072UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12 0x13 0x14 +// 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! \" # $ % +// & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G +// H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d e f g h +// i j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82 0x83 +// 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x91 +// 0x92 0x93 0x94 0x95 0x96 0x97 +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaLexer::_tokenSet_0(_tokenSet_0_data_,16); +const unsigned long JavaLexer::_tokenSet_1_data_[] = { 4294958072UL, 4294966271UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12 0x13 0x14 +// 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! \" # $ % +// & \' ( ) + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H +// I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d e f g h i +// j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82 0x83 0x84 +// 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x91 0x92 +// 0x93 0x94 0x95 0x96 0x97 +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaLexer::_tokenSet_1(_tokenSet_1_data_,16); +const unsigned long JavaLexer::_tokenSet_2_data_[] = { 4294967288UL, 4294967167UL, 4026531839UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11 0x12 0x13 +// 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! \" # +// $ % & ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F +// G H I J K L M N O P Q R S T U V W X Y Z [ ] ^ _ ` a b c d e f g h i +// j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82 0x83 0x84 +// 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x91 0x92 +// 0x93 0x94 0x95 0x96 0x97 +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaLexer::_tokenSet_2(_tokenSet_2_data_,16); +const unsigned long JavaLexer::_tokenSet_3_data_[] = { 4294967288UL, 4294967291UL, 4026531839UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11 0x12 0x13 +// 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! # $ +// % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F +// G H I J K L M N O P Q R S T U V W X Y Z [ ] ^ _ ` a b c d e f g h i +// j k l m n o p q r s t u v w x y z { | } ~ 0x7f 0x80 0x81 0x82 0x83 0x84 +// 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x91 0x92 +// 0x93 0x94 0x95 0x96 0x97 +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaLexer::_tokenSet_3(_tokenSet_3_data_,16); +const unsigned long JavaLexer::_tokenSet_4_data_[] = { 0UL, 67043328UL, 126UL, 126UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaLexer::_tokenSet_4(_tokenSet_4_data_,10); + diff --git a/languages/java/JavaLexer.hpp b/languages/java/JavaLexer.hpp new file mode 100644 index 00000000..a46022cd --- /dev/null +++ b/languages/java/JavaLexer.hpp @@ -0,0 +1,132 @@ +#ifndef INC_JavaLexer_hpp_ +#define INC_JavaLexer_hpp_ + +#line 2 "java.g" + + #include "driver.h" + #include "JavaAST.hpp" + + #include <qlistview.h> + #include <kdebug.h> + + #define SET_POSITION(ast,t)\ + { \ + RefJavaAST(ast)->setLine( t->getLine() );\ + RefJavaAST(ast)->setColumn( t->getColumn() ); \ + } + +#line 19 "JavaLexer.hpp" +#include <antlr/config.hpp> +/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaLexer.hpp"$ */ +#include <antlr/CommonToken.hpp> +#include <antlr/InputBuffer.hpp> +#include <antlr/BitSet.hpp> +#include "JavaTokenTypes.hpp" +#include <antlr/CharScanner.hpp> +class CUSTOM_API JavaLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public JavaTokenTypes +{ +#line 1058 "java.g" + +private: + Driver* m_driver; + +public: + void setDriver( Driver* d ) { m_driver = d; } + void setFileName( const QString& fileName ) { m_driver->currentFileName() = fileName; } + + virtual void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(ex.getMessage().c_str()), ex.getLine(), ex.getColumn()) ); + } + + virtual void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(errorMessage.c_str()), getLine(), getColumn()) ); + } + + virtual void reportWarning( const ANTLR_USE_NAMESPACE(std)string& warnMessage ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(warnMessage.c_str()), getLine(), getColumn()) ); + } +#line 30 "JavaLexer.hpp" +private: + void initLiterals(); +public: + bool getCaseSensitiveLiterals() const + { + return true; + } +public: + JavaLexer(ANTLR_USE_NAMESPACE(std)istream& in); + JavaLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); + JavaLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); + ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); + public: void mQUESTION(bool _createToken); + public: void mLPAREN(bool _createToken); + public: void mRPAREN(bool _createToken); + public: void mLBRACK(bool _createToken); + public: void mRBRACK(bool _createToken); + public: void mLCURLY(bool _createToken); + public: void mRCURLY(bool _createToken); + public: void mCOLON(bool _createToken); + public: void mCOMMA(bool _createToken); + public: void mASSIGN(bool _createToken); + public: void mEQUAL(bool _createToken); + public: void mLNOT(bool _createToken); + public: void mBNOT(bool _createToken); + public: void mNOT_EQUAL(bool _createToken); + public: void mDIV(bool _createToken); + public: void mDIV_ASSIGN(bool _createToken); + public: void mPLUS(bool _createToken); + public: void mPLUS_ASSIGN(bool _createToken); + public: void mINC(bool _createToken); + public: void mMINUS(bool _createToken); + public: void mMINUS_ASSIGN(bool _createToken); + public: void mDEC(bool _createToken); + public: void mSTAR(bool _createToken); + public: void mSTAR_ASSIGN(bool _createToken); + public: void mMOD(bool _createToken); + public: void mMOD_ASSIGN(bool _createToken); + public: void mSR(bool _createToken); + public: void mSR_ASSIGN(bool _createToken); + public: void mBSR(bool _createToken); + public: void mBSR_ASSIGN(bool _createToken); + public: void mGE(bool _createToken); + public: void mGT(bool _createToken); + public: void mSL(bool _createToken); + public: void mSL_ASSIGN(bool _createToken); + public: void mLE(bool _createToken); + public: void mLT_(bool _createToken); + public: void mBXOR(bool _createToken); + public: void mBXOR_ASSIGN(bool _createToken); + public: void mBOR(bool _createToken); + public: void mBOR_ASSIGN(bool _createToken); + public: void mLOR(bool _createToken); + public: void mBAND(bool _createToken); + public: void mBAND_ASSIGN(bool _createToken); + public: void mLAND(bool _createToken); + public: void mSEMI(bool _createToken); + public: void mWS(bool _createToken); + public: void mSL_COMMENT(bool _createToken); + public: void mML_COMMENT(bool _createToken); + public: void mCHAR_LITERAL(bool _createToken); + protected: void mESC(bool _createToken); + public: void mSTRING_LITERAL(bool _createToken); + protected: void mHEX_DIGIT(bool _createToken); + protected: void mVOCAB(bool _createToken); + public: void mIDENT(bool _createToken); + public: void mNUM_INT(bool _createToken); + protected: void mEXPONENT(bool _createToken); + protected: void mFLOAT_SUFFIX(bool _createToken); +private: + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; +}; + +#endif /*INC_JavaLexer_hpp_*/ diff --git a/languages/java/JavaRecognizer.cpp b/languages/java/JavaRecognizer.cpp new file mode 100644 index 00000000..1021c6a0 --- /dev/null +++ b/languages/java/JavaRecognizer.cpp @@ -0,0 +1,6540 @@ +/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaRecognizer.cpp"$ */ +#include "JavaRecognizer.hpp" +#include <antlr/NoViableAltException.hpp> +#include <antlr/SemanticException.hpp> +#include <antlr/ASTFactory.hpp> +#line 1 "java.g" +#line 8 "JavaRecognizer.cpp" +JavaRecognizer::JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,k) +{ +} + +JavaRecognizer::JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,2) +{ +} + +JavaRecognizer::JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(lexer,k) +{ +} + +JavaRecognizer::JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(lexer,2) +{ +} + +JavaRecognizer::JavaRecognizer(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(state,2) +{ +} + +void JavaRecognizer::compilationUnit() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST compilationUnit_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case LITERAL_package: + { + packageDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE: + case FINAL: + case ABSTRACT: + case STRICTFP: + case SEMI: + case LITERAL_import: + case LITERAL_private: + case LITERAL_public: + case LITERAL_protected: + case LITERAL_static: + case LITERAL_transient: + case LITERAL_native: + case LITERAL_threadsafe: + case LITERAL_synchronized: + case LITERAL_volatile: + case LITERAL_class: + case LITERAL_interface: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { // ( ... )* + for (;;) { + if ((LA(1) == LITERAL_import)) { + importDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop4; + } + + } + _loop4:; + } // ( ... )* + { // ( ... )* + for (;;) { + if ((_tokenSet_0.member(LA(1)))) { + typeDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop6; + } + + } + _loop6:; + } // ( ... )* + match(ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE); + compilationUnit_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } + returnAST = compilationUnit_AST; +} + +void JavaRecognizer::packageDefinition() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST packageDefinition_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken p = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST p_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + p = LT(1); + if ( inputState->guessing == 0 ) { + p_AST = astFactory->create(p); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(p_AST)); + } + match(LITERAL_package); + if ( inputState->guessing==0 ) { +#line 196 "java.g" + p_AST->setType(PACKAGE_DEF); +#line 137 "JavaRecognizer.cpp" + } + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + packageDefinition_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_2); + } else { + throw; + } + } + returnAST = packageDefinition_AST; +} + +void JavaRecognizer::importDefinition() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST importDefinition_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken i = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST i_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + i = LT(1); + if ( inputState->guessing == 0 ) { + i_AST = astFactory->create(i); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(i_AST)); + } + match(LITERAL_import); + if ( inputState->guessing==0 ) { +#line 202 "java.g" + i_AST->setType(IMPORT); +#line 174 "JavaRecognizer.cpp" + } + identifierStar(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + importDefinition_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_2); + } else { + throw; + } + } + returnAST = importDefinition_AST; +} + +void JavaRecognizer::typeDefinition() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST typeDefinition_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST m_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case FINAL: + case ABSTRACT: + case STRICTFP: + case LITERAL_private: + case LITERAL_public: + case LITERAL_protected: + case LITERAL_static: + case LITERAL_transient: + case LITERAL_native: + case LITERAL_threadsafe: + case LITERAL_synchronized: + case LITERAL_volatile: + case LITERAL_class: + case LITERAL_interface: + { + modifiers(); + if (inputState->guessing==0) { + m_AST = returnAST; + } + { + switch ( LA(1)) { + case LITERAL_class: + { + classDefinition(m_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case LITERAL_interface: + { + interfaceDefinition(m_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + typeDefinition_AST = RefJavaAST(currentAST.root); + break; + } + case SEMI: + { + match(SEMI); + typeDefinition_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_3); + } else { + throw; + } + } + returnAST = typeDefinition_AST; +} + +void JavaRecognizer::identifier() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST identifier_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefJavaAST tmp5_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp5_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp5_AST)); + } + match(IDENT); + { // ( ... )* + for (;;) { + if ((LA(1) == DOT)) { + RefJavaAST tmp6_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp6_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp6_AST)); + } + match(DOT); + RefJavaAST tmp7_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp7_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp7_AST)); + } + match(IDENT); + } + else { + goto _loop23; + } + + } + _loop23:; + } // ( ... )* + identifier_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_4); + } else { + throw; + } + } + returnAST = identifier_AST; +} + +void JavaRecognizer::identifierStar() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST identifierStar_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefJavaAST tmp8_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp8_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp8_AST)); + } + match(IDENT); + { // ( ... )* + for (;;) { + if ((LA(1) == DOT) && (LA(2) == IDENT)) { + RefJavaAST tmp9_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp9_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp9_AST)); + } + match(DOT); + RefJavaAST tmp10_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp10_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp10_AST)); + } + match(IDENT); + } + else { + goto _loop26; + } + + } + _loop26:; + } // ( ... )* + { + switch ( LA(1)) { + case DOT: + { + RefJavaAST tmp11_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp11_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp11_AST)); + } + match(DOT); + RefJavaAST tmp12_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp12_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp12_AST)); + } + match(STAR); + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + identifierStar_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_5); + } else { + throw; + } + } + returnAST = identifierStar_AST; +} + +void JavaRecognizer::modifiers() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST modifiers_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { // ( ... )* + for (;;) { + if ((_tokenSet_6.member(LA(1)))) { + modifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop30; + } + + } + _loop30:; + } // ( ... )* + if ( inputState->guessing==0 ) { + modifiers_AST = RefJavaAST(currentAST.root); +#line 290 "java.g" + modifiers_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(modifiers_AST)))); +#line 420 "JavaRecognizer.cpp" + currentAST.root = modifiers_AST; + if ( modifiers_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + modifiers_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = modifiers_AST->getFirstChild(); + else + currentAST.child = modifiers_AST; + currentAST.advanceChildToEnd(); + } + modifiers_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_7); + } else { + throw; + } + } + returnAST = modifiers_AST; +} + +void JavaRecognizer::classDefinition( + RefJavaAST modifiers +) { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST classDefinition_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST sc_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST ic_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST cb_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(LITERAL_class); + RefJavaAST tmp14_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp14_AST = astFactory->create(LT(1)); + } + match(IDENT); + superClassClause(); + if (inputState->guessing==0) { + sc_AST = returnAST; + } + implementsClause(); + if (inputState->guessing==0) { + ic_AST = returnAST; + } + classBlock(); + if (inputState->guessing==0) { + cb_AST = returnAST; + } + if ( inputState->guessing==0 ) { + classDefinition_AST = RefJavaAST(currentAST.root); +#line 319 "java.g" + classDefinition_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(6))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(CLASS_DEF,"CLASS_DEF")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(modifiers))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(tmp14_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(sc_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(ic_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(cb_AST)))); +#line 475 "JavaRecognizer.cpp" + currentAST.root = classDefinition_AST; + if ( classDefinition_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + classDefinition_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = classDefinition_AST->getFirstChild(); + else + currentAST.child = classDefinition_AST; + currentAST.advanceChildToEnd(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_8); + } else { + throw; + } + } + returnAST = classDefinition_AST; +} + +void JavaRecognizer::interfaceDefinition( + RefJavaAST modifiers +) { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST interfaceDefinition_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST ie_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST cb_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(LITERAL_interface); + RefJavaAST tmp16_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp16_AST = astFactory->create(LT(1)); + } + match(IDENT); + interfaceExtends(); + if (inputState->guessing==0) { + ie_AST = returnAST; + } + classBlock(); + if (inputState->guessing==0) { + cb_AST = returnAST; + } + if ( inputState->guessing==0 ) { + interfaceDefinition_AST = RefJavaAST(currentAST.root); +#line 335 "java.g" + interfaceDefinition_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(5))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(INTERFACE_DEF,"INTERFACE_DEF")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(modifiers))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(tmp16_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(ie_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(cb_AST)))); +#line 524 "JavaRecognizer.cpp" + currentAST.root = interfaceDefinition_AST; + if ( interfaceDefinition_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + interfaceDefinition_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = interfaceDefinition_AST->getFirstChild(); + else + currentAST.child = interfaceDefinition_AST; + currentAST.advanceChildToEnd(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_9); + } else { + throw; + } + } + returnAST = interfaceDefinition_AST; +} + +/** A declaration is the creation of a reference or primitive-type variable + * Create a separate Type/Var tree for each var in the var list. + */ +void JavaRecognizer::declaration() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST declaration_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST m_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST t_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST v_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + modifiers(); + if (inputState->guessing==0) { + m_AST = returnAST; + } + typeSpec(false); + if (inputState->guessing==0) { + t_AST = returnAST; + } + variableDefinitions(m_AST,t_AST); + if (inputState->guessing==0) { + v_AST = returnAST; + } + if ( inputState->guessing==0 ) { + declaration_AST = RefJavaAST(currentAST.root); +#line 220 "java.g" + declaration_AST = v_AST; +#line 573 "JavaRecognizer.cpp" + currentAST.root = declaration_AST; + if ( declaration_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + declaration_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = declaration_AST->getFirstChild(); + else + currentAST.child = declaration_AST; + currentAST.advanceChildToEnd(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_5); + } else { + throw; + } + } + returnAST = declaration_AST; +} + +void JavaRecognizer::typeSpec( + bool addImagNode +) { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST typeSpec_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case IDENT: + { + classTypeSpec(addImagNode); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + typeSpec_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + { + builtInTypeSpec(addImagNode); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + typeSpec_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_10); + } else { + throw; + } + } + returnAST = typeSpec_AST; +} + +void JavaRecognizer::variableDefinitions( + RefJavaAST mods, RefJavaAST t +) { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST variableDefinitions_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + variableDeclarator((RefJavaAST)getASTFactory()->dupTree((antlr::RefAST)mods), + (RefJavaAST)getASTFactory()->dupTree((antlr::RefAST)t)); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + variableDeclarator((RefJavaAST)getASTFactory()->dupTree((antlr::RefAST)mods), + (RefJavaAST)getASTFactory()->dupTree((antlr::RefAST)t)); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop59; + } + + } + _loop59:; + } // ( ... )* + variableDefinitions_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_5); + } else { + throw; + } + } + returnAST = variableDefinitions_AST; +} + +void JavaRecognizer::classTypeSpec( + bool addImagNode +) { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST classTypeSpec_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lb = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lb_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == LBRACK)) { + lb = LT(1); + if ( inputState->guessing == 0 ) { + lb_AST = astFactory->create(lb); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lb_AST)); + } + match(LBRACK); + if ( inputState->guessing==0 ) { +#line 233 "java.g" + lb_AST->setType(ARRAY_DECLARATOR); +#line 715 "JavaRecognizer.cpp" + } + match(RBRACK); + } + else { + goto _loop15; + } + + } + _loop15:; + } // ( ... )* + if ( inputState->guessing==0 ) { + classTypeSpec_AST = RefJavaAST(currentAST.root); +#line 234 "java.g" + + if ( addImagNode ) { + classTypeSpec_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(TYPE,"TYPE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(classTypeSpec_AST)))); + } + +#line 734 "JavaRecognizer.cpp" + currentAST.root = classTypeSpec_AST; + if ( classTypeSpec_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + classTypeSpec_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = classTypeSpec_AST->getFirstChild(); + else + currentAST.child = classTypeSpec_AST; + currentAST.advanceChildToEnd(); + } + classTypeSpec_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_10); + } else { + throw; + } + } + returnAST = classTypeSpec_AST; +} + +void JavaRecognizer::builtInTypeSpec( + bool addImagNode +) { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST builtInTypeSpec_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lb = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lb_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + builtInType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == LBRACK)) { + lb = LT(1); + if ( inputState->guessing == 0 ) { + lb_AST = astFactory->create(lb); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lb_AST)); + } + match(LBRACK); + if ( inputState->guessing==0 ) { +#line 244 "java.g" + lb_AST->setType(ARRAY_DECLARATOR); +#line 782 "JavaRecognizer.cpp" + } + match(RBRACK); + } + else { + goto _loop18; + } + + } + _loop18:; + } // ( ... )* + if ( inputState->guessing==0 ) { + builtInTypeSpec_AST = RefJavaAST(currentAST.root); +#line 245 "java.g" + + if ( addImagNode ) { + builtInTypeSpec_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(TYPE,"TYPE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(builtInTypeSpec_AST)))); + } + +#line 801 "JavaRecognizer.cpp" + currentAST.root = builtInTypeSpec_AST; + if ( builtInTypeSpec_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + builtInTypeSpec_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = builtInTypeSpec_AST->getFirstChild(); + else + currentAST.child = builtInTypeSpec_AST; + currentAST.advanceChildToEnd(); + } + builtInTypeSpec_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_10); + } else { + throw; + } + } + returnAST = builtInTypeSpec_AST; +} + +void JavaRecognizer::builtInType() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST builtInType_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case LITERAL_void: + { + RefJavaAST tmp20_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp20_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp20_AST)); + } + match(LITERAL_void); + builtInType_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_boolean: + { + RefJavaAST tmp21_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp21_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp21_AST)); + } + match(LITERAL_boolean); + builtInType_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_byte: + { + RefJavaAST tmp22_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp22_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp22_AST)); + } + match(LITERAL_byte); + builtInType_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_char: + { + RefJavaAST tmp23_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp23_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp23_AST)); + } + match(LITERAL_char); + builtInType_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_short: + { + RefJavaAST tmp24_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp24_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp24_AST)); + } + match(LITERAL_short); + builtInType_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_int: + { + RefJavaAST tmp25_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp25_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp25_AST)); + } + match(LITERAL_int); + builtInType_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_float: + { + RefJavaAST tmp26_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp26_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp26_AST)); + } + match(LITERAL_float); + builtInType_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_long: + { + RefJavaAST tmp27_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp27_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp27_AST)); + } + match(LITERAL_long); + builtInType_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_double: + { + RefJavaAST tmp28_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp28_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp28_AST)); + } + match(LITERAL_double); + builtInType_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_11); + } else { + throw; + } + } + returnAST = builtInType_AST; +} + +void JavaRecognizer::type() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST type_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case IDENT: + { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + { + builtInType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_12); + } else { + throw; + } + } + returnAST = type_AST; +} + +void JavaRecognizer::modifier() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST modifier_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case LITERAL_private: + { + RefJavaAST tmp29_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp29_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp29_AST)); + } + match(LITERAL_private); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_public: + { + RefJavaAST tmp30_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp30_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp30_AST)); + } + match(LITERAL_public); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_protected: + { + RefJavaAST tmp31_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp31_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp31_AST)); + } + match(LITERAL_protected); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_static: + { + RefJavaAST tmp32_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp32_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp32_AST)); + } + match(LITERAL_static); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_transient: + { + RefJavaAST tmp33_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp33_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp33_AST)); + } + match(LITERAL_transient); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case FINAL: + { + RefJavaAST tmp34_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp34_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp34_AST)); + } + match(FINAL); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case ABSTRACT: + { + RefJavaAST tmp35_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp35_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp35_AST)); + } + match(ABSTRACT); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_native: + { + RefJavaAST tmp36_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp36_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp36_AST)); + } + match(LITERAL_native); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_threadsafe: + { + RefJavaAST tmp37_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp37_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp37_AST)); + } + match(LITERAL_threadsafe); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_synchronized: + { + RefJavaAST tmp38_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp38_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp38_AST)); + } + match(LITERAL_synchronized); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_volatile: + { + RefJavaAST tmp39_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp39_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp39_AST)); + } + match(LITERAL_volatile); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + case STRICTFP: + { + RefJavaAST tmp40_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp40_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp40_AST)); + } + match(STRICTFP); + modifier_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_13); + } else { + throw; + } + } + returnAST = modifier_AST; +} + +void JavaRecognizer::superClassClause() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST superClassClause_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST id_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case LITERAL_extends: + { + match(LITERAL_extends); + identifier(); + if (inputState->guessing==0) { + id_AST = returnAST; + } + break; + } + case LCURLY: + case LITERAL_implements: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + superClassClause_AST = RefJavaAST(currentAST.root); +#line 325 "java.g" + superClassClause_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(EXTENDS_CLAUSE,"EXTENDS_CLAUSE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(id_AST)))); +#line 1185 "JavaRecognizer.cpp" + currentAST.root = superClassClause_AST; + if ( superClassClause_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + superClassClause_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = superClassClause_AST->getFirstChild(); + else + currentAST.child = superClassClause_AST; + currentAST.advanceChildToEnd(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_14); + } else { + throw; + } + } + returnAST = superClassClause_AST; +} + +void JavaRecognizer::implementsClause() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST implementsClause_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken i = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST i_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case LITERAL_implements: + { + i = LT(1); + if ( inputState->guessing == 0 ) { + i_AST = astFactory->create(i); + } + match(LITERAL_implements); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop46; + } + + } + _loop46:; + } // ( ... )* + break; + } + case LCURLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + implementsClause_AST = RefJavaAST(currentAST.root); +#line 363 "java.g" + implementsClause_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(IMPLEMENTS_CLAUSE,"IMPLEMENTS_CLAUSE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(implementsClause_AST)))); +#line 1259 "JavaRecognizer.cpp" + currentAST.root = implementsClause_AST; + if ( implementsClause_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + implementsClause_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = implementsClause_AST->getFirstChild(); + else + currentAST.child = implementsClause_AST; + currentAST.advanceChildToEnd(); + } + implementsClause_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_15); + } else { + throw; + } + } + returnAST = implementsClause_AST; +} + +void JavaRecognizer::classBlock() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST classBlock_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(LCURLY); + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case FINAL: + case ABSTRACT: + case STRICTFP: + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LITERAL_private: + case LITERAL_public: + case LITERAL_protected: + case LITERAL_static: + case LITERAL_transient: + case LITERAL_native: + case LITERAL_threadsafe: + case LITERAL_synchronized: + case LITERAL_volatile: + case LITERAL_class: + case LITERAL_interface: + case LCURLY: + { + field(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + { + match(SEMI); + break; + } + default: + { + goto _loop38; + } + } + } + _loop38:; + } // ( ... )* + match(RCURLY); + if ( inputState->guessing==0 ) { + classBlock_AST = RefJavaAST(currentAST.root); +#line 345 "java.g" + classBlock_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(OBJBLOCK,"OBJBLOCK")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(classBlock_AST)))); +#line 1341 "JavaRecognizer.cpp" + currentAST.root = classBlock_AST; + if ( classBlock_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + classBlock_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = classBlock_AST->getFirstChild(); + else + currentAST.child = classBlock_AST; + currentAST.advanceChildToEnd(); + } + classBlock_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = classBlock_AST; +} + +void JavaRecognizer::interfaceExtends() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST interfaceExtends_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken e = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST e_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case LITERAL_extends: + { + e = LT(1); + if ( inputState->guessing == 0 ) { + e_AST = astFactory->create(e); + } + match(LITERAL_extends); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop42; + } + + } + _loop42:; + } // ( ... )* + break; + } + case LCURLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + interfaceExtends_AST = RefJavaAST(currentAST.root); +#line 354 "java.g" + interfaceExtends_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(EXTENDS_CLAUSE,"EXTENDS_CLAUSE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(interfaceExtends_AST)))); +#line 1416 "JavaRecognizer.cpp" + currentAST.root = interfaceExtends_AST; + if ( interfaceExtends_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + interfaceExtends_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = interfaceExtends_AST->getFirstChild(); + else + currentAST.child = interfaceExtends_AST; + currentAST.advanceChildToEnd(); + } + interfaceExtends_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_15); + } else { + throw; + } + } + returnAST = interfaceExtends_AST; +} + +void JavaRecognizer::field() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST field_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST mods_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST h_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST s_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST cd_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST id_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST t_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST param_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST rt_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST tc_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST s2_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST v_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST s3_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST s4_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + if ((_tokenSet_13.member(LA(1))) && (_tokenSet_17.member(LA(2)))) { + modifiers(); + if (inputState->guessing==0) { + mods_AST = returnAST; + } + { + switch ( LA(1)) { + case LITERAL_class: + { + classDefinition(mods_AST); + if (inputState->guessing==0) { + cd_AST = returnAST; + } + if ( inputState->guessing==0 ) { + field_AST = RefJavaAST(currentAST.root); +#line 378 "java.g" + field_AST = cd_AST; +#line 1474 "JavaRecognizer.cpp" + currentAST.root = field_AST; + if ( field_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + field_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = field_AST->getFirstChild(); + else + currentAST.child = field_AST; + currentAST.advanceChildToEnd(); + } + break; + } + case LITERAL_interface: + { + interfaceDefinition(mods_AST); + if (inputState->guessing==0) { + id_AST = returnAST; + } + if ( inputState->guessing==0 ) { + field_AST = RefJavaAST(currentAST.root); +#line 381 "java.g" + field_AST = id_AST; +#line 1495 "JavaRecognizer.cpp" + currentAST.root = field_AST; + if ( field_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + field_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = field_AST->getFirstChild(); + else + currentAST.child = field_AST; + currentAST.advanceChildToEnd(); + } + break; + } + default: + if ((LA(1) == IDENT) && (LA(2) == LPAREN)) { + ctorHead(); + if (inputState->guessing==0) { + h_AST = returnAST; + } + constructorBody(); + if (inputState->guessing==0) { + s_AST = returnAST; + } + if ( inputState->guessing==0 ) { + field_AST = RefJavaAST(currentAST.root); +#line 375 "java.g" + field_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(4))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(CTOR_DEF,"CTOR_DEF")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(mods_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(h_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)))); +#line 1520 "JavaRecognizer.cpp" + currentAST.root = field_AST; + if ( field_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + field_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = field_AST->getFirstChild(); + else + currentAST.child = field_AST; + currentAST.advanceChildToEnd(); + } + } + else if (((LA(1) >= LITERAL_void && LA(1) <= IDENT)) && (_tokenSet_18.member(LA(2)))) { + typeSpec(false); + if (inputState->guessing==0) { + t_AST = returnAST; + } + { + if ((LA(1) == IDENT) && (LA(2) == LPAREN)) { + RefJavaAST tmp47_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp47_AST = astFactory->create(LT(1)); + } + match(IDENT); + match(LPAREN); + parameterDeclarationList(); + if (inputState->guessing==0) { + param_AST = returnAST; + } + match(RPAREN); + declaratorBrackets(t_AST); + if (inputState->guessing==0) { + rt_AST = returnAST; + } + { + switch ( LA(1)) { + case LITERAL_throws: + { + throwsClause(); + if (inputState->guessing==0) { + tc_AST = returnAST; + } + break; + } + case SEMI: + case LCURLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case LCURLY: + { + compoundStatement(); + if (inputState->guessing==0) { + s2_AST = returnAST; + } + break; + } + case SEMI: + { + RefJavaAST tmp50_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp50_AST = astFactory->create(LT(1)); + } + match(SEMI); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + field_AST = RefJavaAST(currentAST.root); +#line 396 "java.g" + field_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(7))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(METHOD_DEF,"METHOD_DEF")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(mods_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(TYPE,"TYPE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(rt_AST))))))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(tmp47_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(param_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(tc_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(s2_AST)))); +#line 1602 "JavaRecognizer.cpp" + currentAST.root = field_AST; + if ( field_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + field_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = field_AST->getFirstChild(); + else + currentAST.child = field_AST; + currentAST.advanceChildToEnd(); + } + } + else if ((LA(1) == IDENT) && (_tokenSet_19.member(LA(2)))) { + variableDefinitions(mods_AST,t_AST); + if (inputState->guessing==0) { + v_AST = returnAST; + } + RefJavaAST tmp51_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp51_AST = astFactory->create(LT(1)); + } + match(SEMI); + if ( inputState->guessing==0 ) { + field_AST = RefJavaAST(currentAST.root); +#line 405 "java.g" + field_AST = v_AST; +#line 1626 "JavaRecognizer.cpp" + currentAST.root = field_AST; + if ( field_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + field_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = field_AST->getFirstChild(); + else + currentAST.child = field_AST; + currentAST.advanceChildToEnd(); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + else if ((LA(1) == LITERAL_static) && (LA(2) == LCURLY)) { + match(LITERAL_static); + compoundStatement(); + if (inputState->guessing==0) { + s3_AST = returnAST; + } + if ( inputState->guessing==0 ) { + field_AST = RefJavaAST(currentAST.root); +#line 411 "java.g" + field_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(STATIC_INIT,"STATIC_INIT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(s3_AST)))); +#line 1658 "JavaRecognizer.cpp" + currentAST.root = field_AST; + if ( field_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + field_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = field_AST->getFirstChild(); + else + currentAST.child = field_AST; + currentAST.advanceChildToEnd(); + } + } + else if ((LA(1) == LCURLY)) { + compoundStatement(); + if (inputState->guessing==0) { + s4_AST = returnAST; + } + if ( inputState->guessing==0 ) { + field_AST = RefJavaAST(currentAST.root); +#line 415 "java.g" + field_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(INSTANCE_INIT,"INSTANCE_INIT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(s4_AST)))); +#line 1677 "JavaRecognizer.cpp" + currentAST.root = field_AST; + if ( field_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + field_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = field_AST->getFirstChild(); + else + currentAST.child = field_AST; + currentAST.advanceChildToEnd(); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_20); + } else { + throw; + } + } + returnAST = field_AST; +} + +void JavaRecognizer::ctorHead() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST ctorHead_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefJavaAST tmp53_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp53_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp53_AST)); + } + match(IDENT); + match(LPAREN); + parameterDeclarationList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + { + switch ( LA(1)) { + case LITERAL_throws: + { + throwsClause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case LCURLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + ctorHead_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_15); + } else { + throw; + } + } + returnAST = ctorHead_AST; +} + +void JavaRecognizer::constructorBody() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST constructorBody_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lc = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lc_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + lc = LT(1); + if ( inputState->guessing == 0 ) { + lc_AST = astFactory->create(lc); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lc_AST)); + } + match(LCURLY); + if ( inputState->guessing==0 ) { +#line 419 "java.g" + lc_AST->setType(SLIST); +#line 1771 "JavaRecognizer.cpp" + } + { + if ((LA(1) == LITERAL_this || LA(1) == LITERAL_super) && (LA(2) == LPAREN)) { + explicitConstructorInvocation(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((_tokenSet_21.member(LA(1))) && (_tokenSet_22.member(LA(2)))) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + { // ( ... )* + for (;;) { + if ((_tokenSet_23.member(LA(1)))) { + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop55; + } + + } + _loop55:; + } // ( ... )* + match(RCURLY); + constructorBody_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_20); + } else { + throw; + } + } + returnAST = constructorBody_AST; +} + +void JavaRecognizer::parameterDeclarationList() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST parameterDeclarationList_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case FINAL: + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + { + parameterDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + parameterDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop80; + } + + } + _loop80:; + } // ( ... )* + break; + } + case RPAREN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + parameterDeclarationList_AST = RefJavaAST(currentAST.root); +#line 508 "java.g" + parameterDeclarationList_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(PARAMETERS,"PARAMETERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(parameterDeclarationList_AST)))); +#line 1872 "JavaRecognizer.cpp" + currentAST.root = parameterDeclarationList_AST; + if ( parameterDeclarationList_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + parameterDeclarationList_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = parameterDeclarationList_AST->getFirstChild(); + else + currentAST.child = parameterDeclarationList_AST; + currentAST.advanceChildToEnd(); + } + parameterDeclarationList_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_24); + } else { + throw; + } + } + returnAST = parameterDeclarationList_AST; +} + +void JavaRecognizer::declaratorBrackets( + RefJavaAST typ +) { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST declaratorBrackets_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lb = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lb_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + if ( inputState->guessing==0 ) { + declaratorBrackets_AST = RefJavaAST(currentAST.root); +#line 452 "java.g" + declaratorBrackets_AST=typ; +#line 1908 "JavaRecognizer.cpp" + currentAST.root = declaratorBrackets_AST; + if ( declaratorBrackets_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + declaratorBrackets_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = declaratorBrackets_AST->getFirstChild(); + else + currentAST.child = declaratorBrackets_AST; + currentAST.advanceChildToEnd(); + } + { // ( ... )* + for (;;) { + if ((LA(1) == LBRACK)) { + lb = LT(1); + if ( inputState->guessing == 0 ) { + lb_AST = astFactory->create(lb); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lb_AST)); + } + match(LBRACK); + if ( inputState->guessing==0 ) { +#line 453 "java.g" + lb_AST->setType(ARRAY_DECLARATOR); +#line 1929 "JavaRecognizer.cpp" + } + match(RBRACK); + } + else { + goto _loop63; + } + + } + _loop63:; + } // ( ... )* + declaratorBrackets_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_25); + } else { + throw; + } + } + returnAST = declaratorBrackets_AST; +} + +void JavaRecognizer::throwsClause() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST throwsClause_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefJavaAST tmp59_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp59_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp59_AST)); + } + match(LITERAL_throws); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop76; + } + + } + _loop76:; + } // ( ... )* + throwsClause_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_26); + } else { + throw; + } + } + returnAST = throwsClause_AST; +} + +void JavaRecognizer::compoundStatement() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST compoundStatement_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lc = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lc_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + lc = LT(1); + if ( inputState->guessing == 0 ) { + lc_AST = astFactory->create(lc); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lc_AST)); + } + match(LCURLY); + if ( inputState->guessing==0 ) { +#line 535 "java.g" + lc_AST->setType(SLIST); +#line 2015 "JavaRecognizer.cpp" + } + { // ( ... )* + for (;;) { + if ((_tokenSet_23.member(LA(1)))) { + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop86; + } + + } + _loop86:; + } // ( ... )* + match(RCURLY); + compoundStatement_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_27); + } else { + throw; + } + } + returnAST = compoundStatement_AST; +} + +/** Catch obvious constructor calls, but not the expr.super(...) calls */ +void JavaRecognizer::explicitConstructorInvocation() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST explicitConstructorInvocation_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lp1 = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lp1_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lp2 = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lp2_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case LITERAL_this: + { + match(LITERAL_this); + lp1 = LT(1); + if ( inputState->guessing == 0 ) { + lp1_AST = astFactory->create(lp1); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lp1_AST)); + } + match(LPAREN); + argList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + match(SEMI); + if ( inputState->guessing==0 ) { +#line 428 "java.g" + lp1_AST->setType(CTOR_CALL); +#line 2076 "JavaRecognizer.cpp" + } + explicitConstructorInvocation_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_super: + { + match(LITERAL_super); + lp2 = LT(1); + if ( inputState->guessing == 0 ) { + lp2_AST = astFactory->create(lp2); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lp2_AST)); + } + match(LPAREN); + argList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + match(SEMI); + if ( inputState->guessing==0 ) { +#line 430 "java.g" + lp2_AST->setType(SUPER_CTOR_CALL); +#line 2099 "JavaRecognizer.cpp" + } + explicitConstructorInvocation_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_21); + } else { + throw; + } + } + returnAST = explicitConstructorInvocation_AST; +} + +void JavaRecognizer::statement() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST statement_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST m_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken c = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST c_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST s_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case LCURLY: + { + compoundStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + statement_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_if: + { + RefJavaAST tmp68_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp68_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp68_AST)); + } + match(LITERAL_if); + match(LPAREN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + if ((LA(1) == LITERAL_else) && (_tokenSet_23.member(LA(2)))) { + match(LITERAL_else); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((_tokenSet_28.member(LA(1))) && (_tokenSet_29.member(LA(2)))) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + statement_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_for: + { + RefJavaAST tmp72_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp72_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp72_AST)); + } + match(LITERAL_for); + match(LPAREN); + forInit(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + forCond(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + forIter(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + statement_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_while: + { + RefJavaAST tmp77_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp77_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp77_AST)); + } + match(LITERAL_while); + match(LPAREN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + statement_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_do: + { + RefJavaAST tmp80_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp80_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp80_AST)); + } + match(LITERAL_do); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(LITERAL_while); + match(LPAREN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + match(SEMI); + statement_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_break: + { + RefJavaAST tmp85_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp85_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp85_AST)); + } + match(LITERAL_break); + { + switch ( LA(1)) { + case IDENT: + { + RefJavaAST tmp86_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp86_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp86_AST)); + } + match(IDENT); + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + statement_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_continue: + { + RefJavaAST tmp88_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp88_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp88_AST)); + } + match(LITERAL_continue); + { + switch ( LA(1)) { + case IDENT: + { + RefJavaAST tmp89_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp89_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp89_AST)); + } + match(IDENT); + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + statement_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_return: + { + RefJavaAST tmp91_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp91_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp91_AST)); + } + match(LITERAL_return); + { + switch ( LA(1)) { + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LPAREN: + case LITERAL_this: + case LITERAL_super: + case PLUS: + case MINUS: + case INC: + case DEC: + case BNOT: + case LNOT: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + statement_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_switch: + { + RefJavaAST tmp93_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp93_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp93_AST)); + } + match(LITERAL_switch); + match(LPAREN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + match(LCURLY); + { // ( ... )* + for (;;) { + if ((LA(1) == LITERAL_case || LA(1) == LITERAL_default)) { + casesGroup(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop95; + } + + } + _loop95:; + } // ( ... )* + match(RCURLY); + statement_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_try: + { + tryBlock(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + statement_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_throw: + { + RefJavaAST tmp98_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp98_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp98_AST)); + } + match(LITERAL_throw); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + statement_AST = RefJavaAST(currentAST.root); + break; + } + case SEMI: + { + s = LT(1); + if ( inputState->guessing == 0 ) { + s_AST = astFactory->create(s); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST)); + } + match(SEMI); + if ( inputState->guessing==0 ) { +#line 617 "java.g" + s_AST->setType(EMPTY_STAT); +#line 2451 "JavaRecognizer.cpp" + } + statement_AST = RefJavaAST(currentAST.root); + break; + } + default: + bool synPredMatched89 = false; + if (((_tokenSet_30.member(LA(1))) && (_tokenSet_31.member(LA(2))))) { + int _m89 = mark(); + synPredMatched89 = true; + inputState->guessing++; + try { + { + declaration(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched89 = false; + } + rewind(_m89); + inputState->guessing--; + } + if ( synPredMatched89 ) { + declaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + statement_AST = RefJavaAST(currentAST.root); + } + else if ((_tokenSet_32.member(LA(1))) && (_tokenSet_33.member(LA(2)))) { + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + statement_AST = RefJavaAST(currentAST.root); + } + else if ((_tokenSet_34.member(LA(1))) && (_tokenSet_35.member(LA(2)))) { + modifiers(); + if (inputState->guessing==0) { + m_AST = returnAST; + } + classDefinition(m_AST); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + statement_AST = RefJavaAST(currentAST.root); + } + else if ((LA(1) == IDENT) && (LA(2) == COLON)) { + RefJavaAST tmp102_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp102_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp102_AST)); + } + match(IDENT); + c = LT(1); + if ( inputState->guessing == 0 ) { + c_AST = astFactory->create(c); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(c_AST)); + } + match(COLON); + if ( inputState->guessing==0 ) { +#line 560 "java.g" + c_AST->setType(LABELED_STAT); +#line 2516 "JavaRecognizer.cpp" + } + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + statement_AST = RefJavaAST(currentAST.root); + } + else if ((LA(1) == LITERAL_synchronized) && (LA(2) == LPAREN)) { + RefJavaAST tmp103_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp103_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp103_AST)); + } + match(LITERAL_synchronized); + match(LPAREN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + compoundStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + statement_AST = RefJavaAST(currentAST.root); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_28); + } else { + throw; + } + } + returnAST = statement_AST; +} + +void JavaRecognizer::argList() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST argList_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LPAREN: + case LITERAL_this: + case LITERAL_super: + case PLUS: + case MINUS: + case INC: + case DEC: + case BNOT: + case LNOT: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + expressionList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case RPAREN: + { + if ( inputState->guessing==0 ) { + argList_AST = RefJavaAST(currentAST.root); +#line 1008 "java.g" + argList_AST = astFactory->create(ELIST,"ELIST"); +#line 2609 "JavaRecognizer.cpp" + currentAST.root = argList_AST; + if ( argList_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + argList_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = argList_AST->getFirstChild(); + else + currentAST.child = argList_AST; + currentAST.advanceChildToEnd(); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + argList_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_24); + } else { + throw; + } + } + returnAST = argList_AST; +} + +/** Declaration of a variable. This can be a class/instance variable, + * or a local variable in a method + * It can also include possible initialization. + */ +void JavaRecognizer::variableDeclarator( + RefJavaAST mods, RefJavaAST t +) { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST variableDeclarator_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken id = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST id_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST d_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST v_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + id = LT(1); + if ( inputState->guessing == 0 ) { + id_AST = astFactory->create(id); + } + match(IDENT); + declaratorBrackets(t); + if (inputState->guessing==0) { + d_AST = returnAST; + } + varInitializer(); + if (inputState->guessing==0) { + v_AST = returnAST; + } + if ( inputState->guessing==0 ) { + variableDeclarator_AST = RefJavaAST(currentAST.root); +#line 448 "java.g" + variableDeclarator_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(5))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(VARIABLE_DEF,"VARIABLE_DEF")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(mods))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(TYPE,"TYPE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(d_AST))))))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(id_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(v_AST)))); +#line 2672 "JavaRecognizer.cpp" + currentAST.root = variableDeclarator_AST; + if ( variableDeclarator_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + variableDeclarator_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = variableDeclarator_AST->getFirstChild(); + else + currentAST.child = variableDeclarator_AST; + currentAST.advanceChildToEnd(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_36); + } else { + throw; + } + } + returnAST = variableDeclarator_AST; +} + +void JavaRecognizer::varInitializer() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST varInitializer_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case ASSIGN: + { + RefJavaAST tmp106_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp106_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp106_AST)); + } + match(ASSIGN); + initializer(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case COMMA: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + varInitializer_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_36); + } else { + throw; + } + } + returnAST = varInitializer_AST; +} + +void JavaRecognizer::initializer() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST initializer_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LPAREN: + case LITERAL_this: + case LITERAL_super: + case PLUS: + case MINUS: + case INC: + case DEC: + case BNOT: + case LNOT: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + initializer_AST = RefJavaAST(currentAST.root); + break; + } + case LCURLY: + { + arrayInitializer(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + initializer_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_37); + } else { + throw; + } + } + returnAST = initializer_AST; +} + +void JavaRecognizer::arrayInitializer() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST arrayInitializer_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lc = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lc_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + lc = LT(1); + if ( inputState->guessing == 0 ) { + lc_AST = astFactory->create(lc); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lc_AST)); + } + match(LCURLY); + if ( inputState->guessing==0 ) { +#line 462 "java.g" + lc_AST->setType(ARRAY_INIT); +#line 2826 "JavaRecognizer.cpp" + } + { + switch ( LA(1)) { + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LCURLY: + case LPAREN: + case LITERAL_this: + case LITERAL_super: + case PLUS: + case MINUS: + case INC: + case DEC: + case BNOT: + case LNOT: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + initializer(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA) && (_tokenSet_38.member(LA(2)))) { + match(COMMA); + initializer(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop69; + } + + } + _loop69:; + } // ( ... )* + { + switch ( LA(1)) { + case COMMA: + { + match(COMMA); + break; + } + case RCURLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case RCURLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(RCURLY); + arrayInitializer_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_39); + } else { + throw; + } + } + returnAST = arrayInitializer_AST; +} + +void JavaRecognizer::expression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST expression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + assignmentExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + expression_AST = RefJavaAST(currentAST.root); +#line 715 "java.g" + expression_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(EXPR,"EXPR")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(expression_AST)))); +#line 2938 "JavaRecognizer.cpp" + currentAST.root = expression_AST; + if ( expression_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + expression_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = expression_AST->getFirstChild(); + else + currentAST.child = expression_AST; + currentAST.advanceChildToEnd(); + } + expression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_40); + } else { + throw; + } + } + returnAST = expression_AST; +} + +void JavaRecognizer::parameterDeclaration() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST parameterDeclaration_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST pm_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST t_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken id = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST id_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefJavaAST pd_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + parameterModifier(); + if (inputState->guessing==0) { + pm_AST = returnAST; + } + typeSpec(false); + if (inputState->guessing==0) { + t_AST = returnAST; + } + id = LT(1); + if ( inputState->guessing == 0 ) { + id_AST = astFactory->create(id); + } + match(IDENT); + declaratorBrackets(t_AST); + if (inputState->guessing==0) { + pd_AST = returnAST; + } + if ( inputState->guessing==0 ) { + parameterDeclaration_AST = RefJavaAST(currentAST.root); +#line 516 "java.g" + parameterDeclaration_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(4))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(PARAMETER_DEF,"PARAMETER_DEF")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(pm_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(TYPE,"TYPE")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(pd_AST))))))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(id_AST)))); +#line 2992 "JavaRecognizer.cpp" + currentAST.root = parameterDeclaration_AST; + if ( parameterDeclaration_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + parameterDeclaration_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = parameterDeclaration_AST->getFirstChild(); + else + currentAST.child = parameterDeclaration_AST; + currentAST.advanceChildToEnd(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_41); + } else { + throw; + } + } + returnAST = parameterDeclaration_AST; +} + +void JavaRecognizer::parameterModifier() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST parameterModifier_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken f = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST f_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case FINAL: + { + f = LT(1); + if ( inputState->guessing == 0 ) { + f_AST = astFactory->create(f); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(f_AST)); + } + match(FINAL); + break; + } + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + parameterModifier_AST = RefJavaAST(currentAST.root); +#line 522 "java.g" + parameterModifier_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(MODIFIERS,"MODIFIERS")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(f_AST)))); +#line 3056 "JavaRecognizer.cpp" + currentAST.root = parameterModifier_AST; + if ( parameterModifier_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + parameterModifier_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = parameterModifier_AST->getFirstChild(); + else + currentAST.child = parameterModifier_AST; + currentAST.advanceChildToEnd(); + } + parameterModifier_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_42); + } else { + throw; + } + } + returnAST = parameterModifier_AST; +} + +void JavaRecognizer::forInit() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST forInit_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + bool synPredMatched107 = false; + if (((_tokenSet_30.member(LA(1))) && (_tokenSet_31.member(LA(2))))) { + int _m107 = mark(); + synPredMatched107 = true; + inputState->guessing++; + try { + { + declaration(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched107 = false; + } + rewind(_m107); + inputState->guessing--; + } + if ( synPredMatched107 ) { + declaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((_tokenSet_32.member(LA(1))) && (_tokenSet_43.member(LA(2)))) { + expressionList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((LA(1) == SEMI)) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + if ( inputState->guessing==0 ) { + forInit_AST = RefJavaAST(currentAST.root); +#line 651 "java.g" + forInit_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(FOR_INIT,"FOR_INIT")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(forInit_AST)))); +#line 3124 "JavaRecognizer.cpp" + currentAST.root = forInit_AST; + if ( forInit_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + forInit_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = forInit_AST->getFirstChild(); + else + currentAST.child = forInit_AST; + currentAST.advanceChildToEnd(); + } + forInit_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_5); + } else { + throw; + } + } + returnAST = forInit_AST; +} + +void JavaRecognizer::forCond() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST forCond_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LPAREN: + case LITERAL_this: + case LITERAL_super: + case PLUS: + case MINUS: + case INC: + case DEC: + case BNOT: + case LNOT: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + forCond_AST = RefJavaAST(currentAST.root); +#line 656 "java.g" + forCond_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(FOR_CONDITION,"FOR_CONDITION")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(forCond_AST)))); +#line 3204 "JavaRecognizer.cpp" + currentAST.root = forCond_AST; + if ( forCond_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + forCond_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = forCond_AST->getFirstChild(); + else + currentAST.child = forCond_AST; + currentAST.advanceChildToEnd(); + } + forCond_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_5); + } else { + throw; + } + } + returnAST = forCond_AST; +} + +void JavaRecognizer::forIter() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST forIter_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LPAREN: + case LITERAL_this: + case LITERAL_super: + case PLUS: + case MINUS: + case INC: + case DEC: + case BNOT: + case LNOT: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + expressionList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case RPAREN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { + forIter_AST = RefJavaAST(currentAST.root); +#line 661 "java.g" + forIter_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(FOR_ITERATOR,"FOR_ITERATOR")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(forIter_AST)))); +#line 3284 "JavaRecognizer.cpp" + currentAST.root = forIter_AST; + if ( forIter_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + forIter_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = forIter_AST->getFirstChild(); + else + currentAST.child = forIter_AST; + currentAST.advanceChildToEnd(); + } + forIter_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_24); + } else { + throw; + } + } + returnAST = forIter_AST; +} + +void JavaRecognizer::casesGroup() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST casesGroup_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { // ( ... )+ + int _cnt98=0; + for (;;) { + if ((LA(1) == LITERAL_case || LA(1) == LITERAL_default) && (_tokenSet_44.member(LA(2)))) { + aCase(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + if ( _cnt98>=1 ) { goto _loop98; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt98++; + } + _loop98:; + } // ( ... )+ + caseSList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + if ( inputState->guessing==0 ) { + casesGroup_AST = RefJavaAST(currentAST.root); +#line 632 "java.g" + casesGroup_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(CASE_GROUP,"CASE_GROUP")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(casesGroup_AST)))); +#line 3337 "JavaRecognizer.cpp" + currentAST.root = casesGroup_AST; + if ( casesGroup_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + casesGroup_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = casesGroup_AST->getFirstChild(); + else + currentAST.child = casesGroup_AST; + currentAST.advanceChildToEnd(); + } + casesGroup_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_45); + } else { + throw; + } + } + returnAST = casesGroup_AST; +} + +void JavaRecognizer::tryBlock() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST tryBlock_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefJavaAST tmp110_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp110_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp110_AST)); + } + match(LITERAL_try); + compoundStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == LITERAL_catch)) { + handler(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop114; + } + + } + _loop114:; + } // ( ... )* + { + switch ( LA(1)) { + case LITERAL_finally: + { + finallyClause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case FINAL: + case ABSTRACT: + case STRICTFP: + case SEMI: + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LITERAL_private: + case LITERAL_public: + case LITERAL_protected: + case LITERAL_static: + case LITERAL_transient: + case LITERAL_native: + case LITERAL_threadsafe: + case LITERAL_synchronized: + case LITERAL_volatile: + case LITERAL_class: + case LCURLY: + case RCURLY: + case LPAREN: + case LITERAL_this: + case LITERAL_super: + case LITERAL_if: + case LITERAL_else: + case LITERAL_for: + case LITERAL_while: + case LITERAL_do: + case LITERAL_break: + case LITERAL_continue: + case LITERAL_return: + case LITERAL_switch: + case LITERAL_throw: + case LITERAL_case: + case LITERAL_default: + case LITERAL_try: + case PLUS: + case MINUS: + case INC: + case DEC: + case BNOT: + case LNOT: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + tryBlock_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_28); + } else { + throw; + } + } + returnAST = tryBlock_AST; +} + +void JavaRecognizer::aCase() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST aCase_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case LITERAL_case: + { + RefJavaAST tmp111_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp111_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp111_AST)); + } + match(LITERAL_case); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case LITERAL_default: + { + RefJavaAST tmp112_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp112_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp112_AST)); + } + match(LITERAL_default); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(COLON); + aCase_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_46); + } else { + throw; + } + } + returnAST = aCase_AST; +} + +void JavaRecognizer::caseSList() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST caseSList_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { // ( ... )* + for (;;) { + if ((_tokenSet_23.member(LA(1)))) { + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop103; + } + + } + _loop103:; + } // ( ... )* + if ( inputState->guessing==0 ) { + caseSList_AST = RefJavaAST(currentAST.root); +#line 641 "java.g" + caseSList_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(SLIST,"SLIST")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(caseSList_AST)))); +#line 3557 "JavaRecognizer.cpp" + currentAST.root = caseSList_AST; + if ( caseSList_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + caseSList_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = caseSList_AST->getFirstChild(); + else + currentAST.child = caseSList_AST; + currentAST.advanceChildToEnd(); + } + caseSList_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_45); + } else { + throw; + } + } + returnAST = caseSList_AST; +} + +void JavaRecognizer::expressionList() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST expressionList_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop121; + } + + } + _loop121:; + } // ( ... )* + if ( inputState->guessing==0 ) { + expressionList_AST = RefJavaAST(currentAST.root); +#line 721 "java.g" + expressionList_AST = RefJavaAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(ELIST,"ELIST")))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(expressionList_AST)))); +#line 3609 "JavaRecognizer.cpp" + currentAST.root = expressionList_AST; + if ( expressionList_AST!=RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + expressionList_AST->getFirstChild() != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = expressionList_AST->getFirstChild(); + else + currentAST.child = expressionList_AST; + currentAST.advanceChildToEnd(); + } + expressionList_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_47); + } else { + throw; + } + } + returnAST = expressionList_AST; +} + +void JavaRecognizer::handler() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST handler_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefJavaAST tmp115_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp115_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp115_AST)); + } + match(LITERAL_catch); + match(LPAREN); + parameterDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + compoundStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + handler_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_48); + } else { + throw; + } + } + returnAST = handler_AST; +} + +void JavaRecognizer::finallyClause() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST finallyClause_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefJavaAST tmp118_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp118_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp118_AST)); + } + match(LITERAL_finally); + compoundStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + finallyClause_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_28); + } else { + throw; + } + } + returnAST = finallyClause_AST; +} + +void JavaRecognizer::assignmentExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST assignmentExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + conditionalExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case ASSIGN: + case PLUS_ASSIGN: + case MINUS_ASSIGN: + case STAR_ASSIGN: + case DIV_ASSIGN: + case MOD_ASSIGN: + case SR_ASSIGN: + case BSR_ASSIGN: + case SL_ASSIGN: + case BAND_ASSIGN: + case BXOR_ASSIGN: + case BOR_ASSIGN: + { + { + switch ( LA(1)) { + case ASSIGN: + { + RefJavaAST tmp119_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp119_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp119_AST)); + } + match(ASSIGN); + break; + } + case PLUS_ASSIGN: + { + RefJavaAST tmp120_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp120_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp120_AST)); + } + match(PLUS_ASSIGN); + break; + } + case MINUS_ASSIGN: + { + RefJavaAST tmp121_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp121_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp121_AST)); + } + match(MINUS_ASSIGN); + break; + } + case STAR_ASSIGN: + { + RefJavaAST tmp122_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp122_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp122_AST)); + } + match(STAR_ASSIGN); + break; + } + case DIV_ASSIGN: + { + RefJavaAST tmp123_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp123_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp123_AST)); + } + match(DIV_ASSIGN); + break; + } + case MOD_ASSIGN: + { + RefJavaAST tmp124_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp124_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp124_AST)); + } + match(MOD_ASSIGN); + break; + } + case SR_ASSIGN: + { + RefJavaAST tmp125_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp125_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp125_AST)); + } + match(SR_ASSIGN); + break; + } + case BSR_ASSIGN: + { + RefJavaAST tmp126_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp126_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp126_AST)); + } + match(BSR_ASSIGN); + break; + } + case SL_ASSIGN: + { + RefJavaAST tmp127_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp127_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp127_AST)); + } + match(SL_ASSIGN); + break; + } + case BAND_ASSIGN: + { + RefJavaAST tmp128_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp128_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp128_AST)); + } + match(BAND_ASSIGN); + break; + } + case BXOR_ASSIGN: + { + RefJavaAST tmp129_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp129_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp129_AST)); + } + match(BXOR_ASSIGN); + break; + } + case BOR_ASSIGN: + { + RefJavaAST tmp130_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp130_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp130_AST)); + } + match(BOR_ASSIGN); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + assignmentExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case RBRACK: + case RCURLY: + case COMMA: + case RPAREN: + case COLON: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + assignmentExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_40); + } else { + throw; + } + } + returnAST = assignmentExpression_AST; +} + +void JavaRecognizer::conditionalExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST conditionalExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + logicalOrExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case QUESTION: + { + RefJavaAST tmp131_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp131_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp131_AST)); + } + match(QUESTION); + assignmentExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + conditionalExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case RBRACK: + case RCURLY: + case COMMA: + case RPAREN: + case ASSIGN: + case COLON: + case PLUS_ASSIGN: + case MINUS_ASSIGN: + case STAR_ASSIGN: + case DIV_ASSIGN: + case MOD_ASSIGN: + case SR_ASSIGN: + case BSR_ASSIGN: + case SL_ASSIGN: + case BAND_ASSIGN: + case BXOR_ASSIGN: + case BOR_ASSIGN: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + conditionalExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_49); + } else { + throw; + } + } + returnAST = conditionalExpression_AST; +} + +void JavaRecognizer::logicalOrExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST logicalOrExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + logicalAndExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == LOR)) { + RefJavaAST tmp133_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp133_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp133_AST)); + } + match(LOR); + logicalAndExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop129; + } + + } + _loop129:; + } // ( ... )* + logicalOrExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_50); + } else { + throw; + } + } + returnAST = logicalOrExpression_AST; +} + +void JavaRecognizer::logicalAndExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST logicalAndExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + inclusiveOrExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == LAND)) { + RefJavaAST tmp134_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp134_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp134_AST)); + } + match(LAND); + inclusiveOrExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop132; + } + + } + _loop132:; + } // ( ... )* + logicalAndExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_51); + } else { + throw; + } + } + returnAST = logicalAndExpression_AST; +} + +void JavaRecognizer::inclusiveOrExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST inclusiveOrExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + exclusiveOrExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == BOR)) { + RefJavaAST tmp135_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp135_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp135_AST)); + } + match(BOR); + exclusiveOrExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop135; + } + + } + _loop135:; + } // ( ... )* + inclusiveOrExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_52); + } else { + throw; + } + } + returnAST = inclusiveOrExpression_AST; +} + +void JavaRecognizer::exclusiveOrExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST exclusiveOrExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + andExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == BXOR)) { + RefJavaAST tmp136_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp136_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp136_AST)); + } + match(BXOR); + andExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop138; + } + + } + _loop138:; + } // ( ... )* + exclusiveOrExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_53); + } else { + throw; + } + } + returnAST = exclusiveOrExpression_AST; +} + +void JavaRecognizer::andExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST andExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + equalityExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == BAND)) { + RefJavaAST tmp137_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp137_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp137_AST)); + } + match(BAND); + equalityExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop141; + } + + } + _loop141:; + } // ( ... )* + andExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_54); + } else { + throw; + } + } + returnAST = andExpression_AST; +} + +void JavaRecognizer::equalityExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST equalityExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + relationalExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == NOT_EQUAL || LA(1) == EQUAL)) { + { + switch ( LA(1)) { + case NOT_EQUAL: + { + RefJavaAST tmp138_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp138_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp138_AST)); + } + match(NOT_EQUAL); + break; + } + case EQUAL: + { + RefJavaAST tmp139_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp139_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp139_AST)); + } + match(EQUAL); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + relationalExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop145; + } + + } + _loop145:; + } // ( ... )* + equalityExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_55); + } else { + throw; + } + } + returnAST = equalityExpression_AST; +} + +void JavaRecognizer::relationalExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST relationalExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + shiftExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case SEMI: + case RBRACK: + case RCURLY: + case COMMA: + case RPAREN: + case ASSIGN: + case COLON: + case PLUS_ASSIGN: + case MINUS_ASSIGN: + case STAR_ASSIGN: + case DIV_ASSIGN: + case MOD_ASSIGN: + case SR_ASSIGN: + case BSR_ASSIGN: + case SL_ASSIGN: + case BAND_ASSIGN: + case BXOR_ASSIGN: + case BOR_ASSIGN: + case QUESTION: + case LOR: + case LAND: + case BOR: + case BXOR: + case BAND: + case NOT_EQUAL: + case EQUAL: + case LT_: + case GT: + case LE: + case GE: + { + { // ( ... )* + for (;;) { + if (((LA(1) >= LT_ && LA(1) <= GE))) { + { + switch ( LA(1)) { + case LT_: + { + RefJavaAST tmp140_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp140_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp140_AST)); + } + match(LT_); + break; + } + case GT: + { + RefJavaAST tmp141_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp141_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp141_AST)); + } + match(GT); + break; + } + case LE: + { + RefJavaAST tmp142_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp142_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp142_AST)); + } + match(LE); + break; + } + case GE: + { + RefJavaAST tmp143_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp143_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp143_AST)); + } + match(GE); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + shiftExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop150; + } + + } + _loop150:; + } // ( ... )* + break; + } + case LITERAL_instanceof: + { + RefJavaAST tmp144_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp144_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp144_AST)); + } + match(LITERAL_instanceof); + typeSpec(true); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + relationalExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_56); + } else { + throw; + } + } + returnAST = relationalExpression_AST; +} + +void JavaRecognizer::shiftExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST shiftExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + additiveExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if (((LA(1) >= SL && LA(1) <= BSR))) { + { + switch ( LA(1)) { + case SL: + { + RefJavaAST tmp145_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp145_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp145_AST)); + } + match(SL); + break; + } + case SR: + { + RefJavaAST tmp146_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp146_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp146_AST)); + } + match(SR); + break; + } + case BSR: + { + RefJavaAST tmp147_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp147_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp147_AST)); + } + match(BSR); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + additiveExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop154; + } + + } + _loop154:; + } // ( ... )* + shiftExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_57); + } else { + throw; + } + } + returnAST = shiftExpression_AST; +} + +void JavaRecognizer::additiveExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST additiveExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + multiplicativeExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == PLUS || LA(1) == MINUS)) { + { + switch ( LA(1)) { + case PLUS: + { + RefJavaAST tmp148_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp148_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp148_AST)); + } + match(PLUS); + break; + } + case MINUS: + { + RefJavaAST tmp149_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp149_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp149_AST)); + } + match(MINUS); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + multiplicativeExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop158; + } + + } + _loop158:; + } // ( ... )* + additiveExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_58); + } else { + throw; + } + } + returnAST = additiveExpression_AST; +} + +void JavaRecognizer::multiplicativeExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST multiplicativeExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + unaryExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((_tokenSet_59.member(LA(1)))) { + { + switch ( LA(1)) { + case STAR: + { + RefJavaAST tmp150_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp150_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp150_AST)); + } + match(STAR); + break; + } + case DIV: + { + RefJavaAST tmp151_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp151_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp151_AST)); + } + match(DIV); + break; + } + case MOD: + { + RefJavaAST tmp152_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp152_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp152_AST)); + } + match(MOD); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + unaryExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop162; + } + + } + _loop162:; + } // ( ... )* + multiplicativeExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_60); + } else { + throw; + } + } + returnAST = multiplicativeExpression_AST; +} + +void JavaRecognizer::unaryExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST unaryExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case INC: + { + RefJavaAST tmp153_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp153_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp153_AST)); + } + match(INC); + unaryExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case DEC: + { + RefJavaAST tmp154_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp154_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp154_AST)); + } + match(DEC); + unaryExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case MINUS: + { + RefJavaAST tmp155_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp155_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp155_AST)); + } + match(MINUS); + if ( inputState->guessing==0 ) { +#line 812 "java.g" + tmp155_AST->setType(UNARY_MINUS); +#line 4646 "JavaRecognizer.cpp" + } + unaryExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case PLUS: + { + RefJavaAST tmp156_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp156_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp156_AST)); + } + match(PLUS); + if ( inputState->guessing==0 ) { +#line 813 "java.g" + tmp156_AST->setType(UNARY_PLUS); +#line 4666 "JavaRecognizer.cpp" + } + unaryExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LPAREN: + case LITERAL_this: + case LITERAL_super: + case BNOT: + case LNOT: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + unaryExpressionNotPlusMinus(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_61); + } else { + throw; + } + } + returnAST = unaryExpression_AST; +} + +void JavaRecognizer::unaryExpressionNotPlusMinus() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST unaryExpressionNotPlusMinus_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lpb = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lpb_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lp = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lp_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case BNOT: + { + RefJavaAST tmp157_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp157_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp157_AST)); + } + match(BNOT); + unaryExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unaryExpressionNotPlusMinus_AST = RefJavaAST(currentAST.root); + break; + } + case LNOT: + { + RefJavaAST tmp158_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp158_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp158_AST)); + } + match(LNOT); + unaryExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unaryExpressionNotPlusMinus_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LPAREN: + case LITERAL_this: + case LITERAL_super: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + { + if ((LA(1) == LPAREN) && ((LA(2) >= LITERAL_void && LA(2) <= LITERAL_double))) { + lpb = LT(1); + if ( inputState->guessing == 0 ) { + lpb_AST = astFactory->create(lpb); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lpb_AST)); + } + match(LPAREN); + if ( inputState->guessing==0 ) { +#line 829 "java.g" + lpb_AST->setType(TYPECAST); +#line 4801 "JavaRecognizer.cpp" + } + builtInTypeSpec(true); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + unaryExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + bool synPredMatched167 = false; + if (((LA(1) == LPAREN) && (LA(2) == IDENT))) { + int _m167 = mark(); + synPredMatched167 = true; + inputState->guessing++; + try { + { + match(LPAREN); + classTypeSpec(true); + match(RPAREN); + unaryExpressionNotPlusMinus(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched167 = false; + } + rewind(_m167); + inputState->guessing--; + } + if ( synPredMatched167 ) { + lp = LT(1); + if ( inputState->guessing == 0 ) { + lp_AST = astFactory->create(lp); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lp_AST)); + } + match(LPAREN); + if ( inputState->guessing==0 ) { +#line 836 "java.g" + lp_AST->setType(TYPECAST); +#line 4843 "JavaRecognizer.cpp" + } + classTypeSpec(true); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + unaryExpressionNotPlusMinus(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((_tokenSet_62.member(LA(1))) && (_tokenSet_63.member(LA(2)))) { + postfixExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + unaryExpressionNotPlusMinus_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_61); + } else { + throw; + } + } + returnAST = unaryExpressionNotPlusMinus_AST; +} + +void JavaRecognizer::postfixExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST postfixExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lp = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lp_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lp3 = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lp3_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lps = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lps_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lb = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lb_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken in = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST in_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken de = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST de_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + primaryExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == DOT) && (LA(2) == IDENT)) { + RefJavaAST tmp161_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp161_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp161_AST)); + } + match(DOT); + RefJavaAST tmp162_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp162_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp162_AST)); + } + match(IDENT); + { + switch ( LA(1)) { + case LPAREN: + { + lp = LT(1); + if ( inputState->guessing == 0 ) { + lp_AST = astFactory->create(lp); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lp_AST)); + } + match(LPAREN); + if ( inputState->guessing==0 ) { +#line 867 "java.g" + lp_AST->setType(METHOD_CALL); +#line 4936 "JavaRecognizer.cpp" + } + argList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + break; + } + case SEMI: + case LBRACK: + case RBRACK: + case DOT: + case STAR: + case RCURLY: + case COMMA: + case RPAREN: + case ASSIGN: + case COLON: + case PLUS_ASSIGN: + case MINUS_ASSIGN: + case STAR_ASSIGN: + case DIV_ASSIGN: + case MOD_ASSIGN: + case SR_ASSIGN: + case BSR_ASSIGN: + case SL_ASSIGN: + case BAND_ASSIGN: + case BXOR_ASSIGN: + case BOR_ASSIGN: + case QUESTION: + case LOR: + case LAND: + case BOR: + case BXOR: + case BAND: + case NOT_EQUAL: + case EQUAL: + case LT_: + case GT: + case LE: + case GE: + case LITERAL_instanceof: + case SL: + case SR: + case BSR: + case PLUS: + case MINUS: + case DIV: + case MOD: + case INC: + case DEC: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + else if ((LA(1) == DOT) && (LA(2) == LITERAL_this)) { + RefJavaAST tmp164_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp164_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp164_AST)); + } + match(DOT); + RefJavaAST tmp165_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp165_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp165_AST)); + } + match(LITERAL_this); + } + else if ((LA(1) == DOT) && (LA(2) == LITERAL_super)) { + RefJavaAST tmp166_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp166_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp166_AST)); + } + match(DOT); + RefJavaAST tmp167_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp167_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp167_AST)); + } + match(LITERAL_super); + { + switch ( LA(1)) { + case LPAREN: + { + lp3 = LT(1); + if ( inputState->guessing == 0 ) { + lp3_AST = astFactory->create(lp3); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lp3_AST)); + } + match(LPAREN); + argList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + if ( inputState->guessing==0 ) { +#line 876 "java.g" + lp3_AST->setType(SUPER_CTOR_CALL); +#line 5043 "JavaRecognizer.cpp" + } + break; + } + case DOT: + { + RefJavaAST tmp169_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp169_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp169_AST)); + } + match(DOT); + RefJavaAST tmp170_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp170_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp170_AST)); + } + match(IDENT); + { + switch ( LA(1)) { + case LPAREN: + { + lps = LT(1); + if ( inputState->guessing == 0 ) { + lps_AST = astFactory->create(lps); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lps_AST)); + } + match(LPAREN); + if ( inputState->guessing==0 ) { +#line 878 "java.g" + lps_AST->setType(METHOD_CALL); +#line 5074 "JavaRecognizer.cpp" + } + argList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + break; + } + case SEMI: + case LBRACK: + case RBRACK: + case DOT: + case STAR: + case RCURLY: + case COMMA: + case RPAREN: + case ASSIGN: + case COLON: + case PLUS_ASSIGN: + case MINUS_ASSIGN: + case STAR_ASSIGN: + case DIV_ASSIGN: + case MOD_ASSIGN: + case SR_ASSIGN: + case BSR_ASSIGN: + case SL_ASSIGN: + case BAND_ASSIGN: + case BXOR_ASSIGN: + case BOR_ASSIGN: + case QUESTION: + case LOR: + case LAND: + case BOR: + case BXOR: + case BAND: + case NOT_EQUAL: + case EQUAL: + case LT_: + case GT: + case LE: + case GE: + case LITERAL_instanceof: + case SL: + case SR: + case BSR: + case PLUS: + case MINUS: + case DIV: + case MOD: + case INC: + case DEC: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + else if ((LA(1) == DOT) && (LA(2) == LITERAL_new)) { + RefJavaAST tmp172_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp172_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp172_AST)); + } + match(DOT); + newExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((LA(1) == LBRACK)) { + lb = LT(1); + if ( inputState->guessing == 0 ) { + lb_AST = astFactory->create(lb); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lb_AST)); + } + match(LBRACK); + if ( inputState->guessing==0 ) { +#line 884 "java.g" + lb_AST->setType(INDEX_OP); +#line 5166 "JavaRecognizer.cpp" + } + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RBRACK); + } + else { + goto _loop173; + } + + } + _loop173:; + } // ( ... )* + { + switch ( LA(1)) { + case INC: + { + in = LT(1); + if ( inputState->guessing == 0 ) { + in_AST = astFactory->create(in); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(in_AST)); + } + match(INC); + if ( inputState->guessing==0 ) { +#line 889 "java.g" + in_AST->setType(POST_INC); +#line 5194 "JavaRecognizer.cpp" + } + break; + } + case DEC: + { + de = LT(1); + if ( inputState->guessing == 0 ) { + de_AST = astFactory->create(de); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(de_AST)); + } + match(DEC); + if ( inputState->guessing==0 ) { +#line 890 "java.g" + de_AST->setType(POST_DEC); +#line 5209 "JavaRecognizer.cpp" + } + break; + } + case SEMI: + case RBRACK: + case STAR: + case RCURLY: + case COMMA: + case RPAREN: + case ASSIGN: + case COLON: + case PLUS_ASSIGN: + case MINUS_ASSIGN: + case STAR_ASSIGN: + case DIV_ASSIGN: + case MOD_ASSIGN: + case SR_ASSIGN: + case BSR_ASSIGN: + case SL_ASSIGN: + case BAND_ASSIGN: + case BXOR_ASSIGN: + case BOR_ASSIGN: + case QUESTION: + case LOR: + case LAND: + case BOR: + case BXOR: + case BAND: + case NOT_EQUAL: + case EQUAL: + case LT_: + case GT: + case LE: + case GE: + case LITERAL_instanceof: + case SL: + case SR: + case BSR: + case PLUS: + case MINUS: + case DIV: + case MOD: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + postfixExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_61); + } else { + throw; + } + } + returnAST = postfixExpression_AST; +} + +void JavaRecognizer::primaryExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST primaryExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lbt = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lbt_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case IDENT: + { + identPrimary(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + if ((LA(1) == DOT) && (LA(2) == LITERAL_class)) { + RefJavaAST tmp174_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp174_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp174_AST)); + } + match(DOT); + RefJavaAST tmp175_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp175_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp175_AST)); + } + match(LITERAL_class); + } + else if ((_tokenSet_39.member(LA(1))) && (_tokenSet_64.member(LA(2)))) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + primaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + primaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_true: + { + RefJavaAST tmp176_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp176_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp176_AST)); + } + match(LITERAL_true); + primaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_false: + { + RefJavaAST tmp177_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp177_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp177_AST)); + } + match(LITERAL_false); + primaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_null: + { + RefJavaAST tmp178_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp178_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp178_AST)); + } + match(LITERAL_null); + primaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_new: + { + newExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + primaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_this: + { + RefJavaAST tmp179_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp179_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp179_AST)); + } + match(LITERAL_this); + primaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_super: + { + RefJavaAST tmp180_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp180_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp180_AST)); + } + match(LITERAL_super); + primaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case LPAREN: + { + match(LPAREN); + assignmentExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + primaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + { + builtInType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == LBRACK)) { + lbt = LT(1); + if ( inputState->guessing == 0 ) { + lbt_AST = astFactory->create(lbt); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lbt_AST)); + } + match(LBRACK); + if ( inputState->guessing==0 ) { +#line 907 "java.g" + lbt_AST->setType(ARRAY_DECLARATOR); +#line 5429 "JavaRecognizer.cpp" + } + match(RBRACK); + } + else { + goto _loop178; + } + + } + _loop178:; + } // ( ... )* + RefJavaAST tmp184_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp184_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp184_AST)); + } + match(DOT); + RefJavaAST tmp185_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp185_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp185_AST)); + } + match(LITERAL_class); + primaryExpression_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_39); + } else { + throw; + } + } + returnAST = primaryExpression_AST; +} + +/** object instantiation. + * Trees are built as illustrated by the following input/tree pairs: + * + * new T() + * + * new + * | + * T -- ELIST + * | + * arg1 -- arg2 -- .. -- argn + * + * new int[] + * + * new + * | + * int -- ARRAY_DECLARATOR + * + * new int[] {1,2} + * + * new + * | + * int -- ARRAY_DECLARATOR -- ARRAY_INIT + * | + * EXPR -- EXPR + * | | + * 1 2 + * + * new int[3] + * new + * | + * int -- ARRAY_DECLARATOR + * | + * EXPR + * | + * 3 + * + * new int[1][2] + * + * new + * | + * int -- ARRAY_DECLARATOR + * | + * ARRAY_DECLARATOR -- EXPR + * | | + * EXPR 1 + * | + * 2 + * + */ +void JavaRecognizer::newExpression() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST newExpression_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefJavaAST tmp186_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp186_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp186_AST)); + } + match(LITERAL_new); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case LPAREN: + { + match(LPAREN); + argList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + { + switch ( LA(1)) { + case LCURLY: + { + classBlock(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case LBRACK: + case RBRACK: + case DOT: + case STAR: + case RCURLY: + case COMMA: + case RPAREN: + case ASSIGN: + case COLON: + case PLUS_ASSIGN: + case MINUS_ASSIGN: + case STAR_ASSIGN: + case DIV_ASSIGN: + case MOD_ASSIGN: + case SR_ASSIGN: + case BSR_ASSIGN: + case SL_ASSIGN: + case BAND_ASSIGN: + case BXOR_ASSIGN: + case BOR_ASSIGN: + case QUESTION: + case LOR: + case LAND: + case BOR: + case BXOR: + case BAND: + case NOT_EQUAL: + case EQUAL: + case LT_: + case GT: + case LE: + case GE: + case LITERAL_instanceof: + case SL: + case SR: + case BSR: + case PLUS: + case MINUS: + case DIV: + case MOD: + case INC: + case DEC: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case LBRACK: + { + newArrayDeclarator(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case LCURLY: + { + arrayInitializer(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case LBRACK: + case RBRACK: + case DOT: + case STAR: + case RCURLY: + case COMMA: + case RPAREN: + case ASSIGN: + case COLON: + case PLUS_ASSIGN: + case MINUS_ASSIGN: + case STAR_ASSIGN: + case DIV_ASSIGN: + case MOD_ASSIGN: + case SR_ASSIGN: + case BSR_ASSIGN: + case SL_ASSIGN: + case BAND_ASSIGN: + case BXOR_ASSIGN: + case BOR_ASSIGN: + case QUESTION: + case LOR: + case LAND: + case BOR: + case BXOR: + case BAND: + case NOT_EQUAL: + case EQUAL: + case LT_: + case GT: + case LE: + case GE: + case LITERAL_instanceof: + case SL: + case SR: + case BSR: + case PLUS: + case MINUS: + case DIV: + case MOD: + case INC: + case DEC: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + newExpression_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_39); + } else { + throw; + } + } + returnAST = newExpression_AST; +} + +/** Match a, a.b.c refs, a.b.c(...) refs, a.b.c[], a.b.c[].class, + * and a.b.c.class refs. Also this(...) and super(...). Match + * this or super. + */ +void JavaRecognizer::identPrimary() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST identPrimary_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lp = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lp_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lbc = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lbc_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefJavaAST tmp189_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp189_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp189_AST)); + } + match(IDENT); + { // ( ... )* + for (;;) { + if ((LA(1) == DOT) && (LA(2) == IDENT)) { + RefJavaAST tmp190_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp190_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp190_AST)); + } + match(DOT); + RefJavaAST tmp191_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp191_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp191_AST)); + } + match(IDENT); + } + else { + goto _loop181; + } + + } + _loop181:; + } // ( ... )* + { + if ((LA(1) == LPAREN)) { + { + lp = LT(1); + if ( inputState->guessing == 0 ) { + lp_AST = astFactory->create(lp); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lp_AST)); + } + match(LPAREN); + if ( inputState->guessing==0 ) { +#line 933 "java.g" + lp_AST->setType(METHOD_CALL); +#line 5755 "JavaRecognizer.cpp" + } + argList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + } + } + else if ((LA(1) == LBRACK) && (LA(2) == RBRACK)) { + { // ( ... )+ + int _cnt185=0; + for (;;) { + if ((LA(1) == LBRACK) && (LA(2) == RBRACK)) { + lbc = LT(1); + if ( inputState->guessing == 0 ) { + lbc_AST = astFactory->create(lbc); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lbc_AST)); + } + match(LBRACK); + if ( inputState->guessing==0 ) { +#line 935 "java.g" + lbc_AST->setType(ARRAY_DECLARATOR); +#line 5778 "JavaRecognizer.cpp" + } + match(RBRACK); + } + else { + if ( _cnt185>=1 ) { goto _loop185; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt185++; + } + _loop185:; + } // ( ... )+ + } + else if ((_tokenSet_39.member(LA(1))) && (_tokenSet_64.member(LA(2)))) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + identPrimary_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_39); + } else { + throw; + } + } + returnAST = identPrimary_AST; +} + +void JavaRecognizer::constant() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST constant_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case NUM_INT: + { + RefJavaAST tmp194_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp194_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp194_AST)); + } + match(NUM_INT); + constant_AST = RefJavaAST(currentAST.root); + break; + } + case CHAR_LITERAL: + { + RefJavaAST tmp195_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp195_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp195_AST)); + } + match(CHAR_LITERAL); + constant_AST = RefJavaAST(currentAST.root); + break; + } + case STRING_LITERAL: + { + RefJavaAST tmp196_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp196_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp196_AST)); + } + match(STRING_LITERAL); + constant_AST = RefJavaAST(currentAST.root); + break; + } + case NUM_FLOAT: + { + RefJavaAST tmp197_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp197_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp197_AST)); + } + match(NUM_FLOAT); + constant_AST = RefJavaAST(currentAST.root); + break; + } + case NUM_LONG: + { + RefJavaAST tmp198_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp198_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp198_AST)); + } + match(NUM_LONG); + constant_AST = RefJavaAST(currentAST.root); + break; + } + case NUM_DOUBLE: + { + RefJavaAST tmp199_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp199_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp199_AST)); + } + match(NUM_DOUBLE); + constant_AST = RefJavaAST(currentAST.root); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_39); + } else { + throw; + } + } + returnAST = constant_AST; +} + +void JavaRecognizer::newArrayDeclarator() { + returnAST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefJavaAST newArrayDeclarator_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken lb = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefJavaAST lb_AST = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { // ( ... )+ + int _cnt195=0; + for (;;) { + if ((LA(1) == LBRACK) && (_tokenSet_65.member(LA(2)))) { + lb = LT(1); + if ( inputState->guessing == 0 ) { + lb_AST = astFactory->create(lb); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(lb_AST)); + } + match(LBRACK); + if ( inputState->guessing==0 ) { +#line 1023 "java.g" + lb_AST->setType(ARRAY_DECLARATOR); +#line 5922 "JavaRecognizer.cpp" + } + { + switch ( LA(1)) { + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case LPAREN: + case LITERAL_this: + case LITERAL_super: + case PLUS: + case MINUS: + case INC: + case DEC: + case BNOT: + case LNOT: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + case NUM_LONG: + case NUM_DOUBLE: + { + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case RBRACK: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(RBRACK); + } + else { + if ( _cnt195>=1 ) { goto _loop195; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt195++; + } + _loop195:; + } // ( ... )+ + newArrayDeclarator_AST = RefJavaAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_66); + } else { + throw; + } + } + returnAST = newArrayDeclarator_AST; +} + +void JavaRecognizer::initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ) +{ + factory.setMaxNodeType(151); +} +const char* JavaRecognizer::tokenNames[] = { + "<0>", + "EOF", + "<2>", + "NULL_TREE_LOOKAHEAD", + "BLOCK", + "MODIFIERS", + "OBJBLOCK", + "SLIST", + "CTOR_DEF", + "METHOD_DEF", + "VARIABLE_DEF", + "INSTANCE_INIT", + "STATIC_INIT", + "TYPE", + "CLASS_DEF", + "INTERFACE_DEF", + "PACKAGE_DEF", + "ARRAY_DECLARATOR", + "EXTENDS_CLAUSE", + "IMPLEMENTS_CLAUSE", + "PARAMETERS", + "PARAMETER_DEF", + "LABELED_STAT", + "TYPECAST", + "INDEX_OP", + "POST_INC", + "POST_DEC", + "METHOD_CALL", + "EXPR", + "ARRAY_INIT", + "IMPORT", + "UNARY_MINUS", + "UNARY_PLUS", + "CASE_GROUP", + "ELIST", + "FOR_INIT", + "FOR_CONDITION", + "FOR_ITERATOR", + "EMPTY_STAT", + "\"final\"", + "\"abstract\"", + "\"strictfp\"", + "SUPER_CTOR_CALL", + "CTOR_CALL", + "\"package\"", + "SEMI", + "\"import\"", + "LBRACK", + "RBRACK", + "\"void\"", + "\"boolean\"", + "\"byte\"", + "\"char\"", + "\"short\"", + "\"int\"", + "\"float\"", + "\"long\"", + "\"double\"", + "IDENT", + "DOT", + "STAR", + "\"private\"", + "\"public\"", + "\"protected\"", + "\"static\"", + "\"transient\"", + "\"native\"", + "\"threadsafe\"", + "\"synchronized\"", + "\"volatile\"", + "\"class\"", + "\"extends\"", + "\"interface\"", + "LCURLY", + "RCURLY", + "COMMA", + "\"implements\"", + "LPAREN", + "RPAREN", + "\"this\"", + "\"super\"", + "ASSIGN", + "\"throws\"", + "COLON", + "\"if\"", + "\"else\"", + "\"for\"", + "\"while\"", + "\"do\"", + "\"break\"", + "\"continue\"", + "\"return\"", + "\"switch\"", + "\"throw\"", + "\"case\"", + "\"default\"", + "\"try\"", + "\"finally\"", + "\"catch\"", + "PLUS_ASSIGN", + "MINUS_ASSIGN", + "STAR_ASSIGN", + "DIV_ASSIGN", + "MOD_ASSIGN", + "SR_ASSIGN", + "BSR_ASSIGN", + "SL_ASSIGN", + "BAND_ASSIGN", + "BXOR_ASSIGN", + "BOR_ASSIGN", + "QUESTION", + "LOR", + "LAND", + "BOR", + "BXOR", + "BAND", + "NOT_EQUAL", + "EQUAL", + "LT_", + "GT", + "LE", + "GE", + "\"instanceof\"", + "SL", + "SR", + "BSR", + "PLUS", + "MINUS", + "DIV", + "MOD", + "INC", + "DEC", + "BNOT", + "LNOT", + "\"true\"", + "\"false\"", + "\"null\"", + "\"new\"", + "NUM_INT", + "CHAR_LITERAL", + "STRING_LITERAL", + "NUM_FLOAT", + "NUM_LONG", + "NUM_DOUBLE", + "WS", + "SL_COMMENT", + "ML_COMMENT", + "ESC", + "HEX_DIGIT", + "VOCAB", + "EXPONENT", + "FLOAT_SUFFIX", + 0 +}; + +const unsigned long JavaRecognizer::_tokenSet_0_data_[] = { 0UL, 3758105472UL, 383UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +// "interface" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_0(_tokenSet_0_data_,8); +const unsigned long JavaRecognizer::_tokenSet_1_data_[] = { 2UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_1(_tokenSet_1_data_,6); +const unsigned long JavaRecognizer::_tokenSet_2_data_[] = { 2UL, 3758121856UL, 383UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF "final" "abstract" "strictfp" SEMI "import" "private" "public" "protected" +// "static" "transient" "native" "threadsafe" "synchronized" "volatile" +// "class" "interface" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_2(_tokenSet_2_data_,8); +const unsigned long JavaRecognizer::_tokenSet_3_data_[] = { 2UL, 3758105472UL, 383UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF "final" "abstract" "strictfp" SEMI "private" "public" "protected" +// "static" "transient" "native" "threadsafe" "synchronized" "volatile" +// "class" "interface" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_3(_tokenSet_3_data_,8); +const unsigned long JavaRecognizer::_tokenSet_4_data_[] = { 0UL, 67215360UL, 687616UL, 4194296UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LBRACK RBRACK IDENT LCURLY RCURLY COMMA "implements" LPAREN RPAREN +// ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN +// SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN BXOR_ASSIGN BOR_ASSIGN QUESTION +// LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_4(_tokenSet_4_data_,8); +const unsigned long JavaRecognizer::_tokenSet_5_data_[] = { 0UL, 8192UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_5(_tokenSet_5_data_,6); +const unsigned long JavaRecognizer::_tokenSet_6_data_[] = { 0UL, 3758097280UL, 63UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_6(_tokenSet_6_data_,8); +const unsigned long JavaRecognizer::_tokenSet_7_data_[] = { 0UL, 134086656UL, 320UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "void" "boolean" "byte" "char" "short" "int" "float" "long" "double" +// IDENT "class" "interface" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_7(_tokenSet_7_data_,8); +const unsigned long JavaRecognizer::_tokenSet_8_data_[] = { 2UL, 3892192128UL, 4294027135UL, 3221225473UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF "final" "abstract" "strictfp" SEMI "void" "boolean" "byte" "char" +// "short" "int" "float" "long" "double" IDENT "private" "public" "protected" +// "static" "transient" "native" "threadsafe" "synchronized" "volatile" +// "class" "interface" LCURLY RCURLY LPAREN "this" "super" "if" "else" +// "for" "while" "do" "break" "continue" "return" "switch" "throw" "case" +// "default" "try" PLUS MINUS INC DEC BNOT LNOT "true" "false" "null" "new" +// NUM_INT CHAR_LITERAL STRING_LITERAL NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_8(_tokenSet_8_data_,12); +const unsigned long JavaRecognizer::_tokenSet_9_data_[] = { 2UL, 3892192128UL, 1919UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF "final" "abstract" "strictfp" SEMI "void" "boolean" "byte" "char" +// "short" "int" "float" "long" "double" IDENT "private" "public" "protected" +// "static" "transient" "native" "threadsafe" "synchronized" "volatile" +// "class" "interface" LCURLY RCURLY +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_9(_tokenSet_9_data_,8); +const unsigned long JavaRecognizer::_tokenSet_10_data_[] = { 0UL, 67182592UL, 674816UL, 4194296UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK IDENT RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_10(_tokenSet_10_data_,8); +const unsigned long JavaRecognizer::_tokenSet_11_data_[] = { 0UL, 201433088UL, 683008UL, 4194296UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LBRACK RBRACK IDENT DOT RCURLY COMMA LPAREN RPAREN ASSIGN COLON +// PLUS_ASSIGN MINUS_ASSIGN STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN +// BSR_ASSIGN SL_ASSIGN BAND_ASSIGN BXOR_ASSIGN BOR_ASSIGN QUESTION LOR +// LAND BOR BXOR BAND NOT_EQUAL EQUAL +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_11(_tokenSet_11_data_,8); +const unsigned long JavaRecognizer::_tokenSet_12_data_[] = { 0UL, 32768UL, 8192UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// LBRACK LPAREN +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_12(_tokenSet_12_data_,8); +const unsigned long JavaRecognizer::_tokenSet_13_data_[] = { 0UL, 3892183936UL, 383UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" "void" "boolean" "byte" "char" "short" +// "int" "float" "long" "double" IDENT "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +// "interface" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_13(_tokenSet_13_data_,8); +const unsigned long JavaRecognizer::_tokenSet_14_data_[] = { 0UL, 0UL, 4608UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// LCURLY "implements" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_14(_tokenSet_14_data_,8); +const unsigned long JavaRecognizer::_tokenSet_15_data_[] = { 0UL, 0UL, 512UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// LCURLY +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_15(_tokenSet_15_data_,8); +const unsigned long JavaRecognizer::_tokenSet_16_data_[] = { 2UL, 4294943616UL, 4294700927UL, 4294967289UL, 65535UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF "final" "abstract" "strictfp" SEMI LBRACK RBRACK "void" "boolean" +// "byte" "char" "short" "int" "float" "long" "double" IDENT DOT STAR "private" +// "public" "protected" "static" "transient" "native" "threadsafe" "synchronized" +// "volatile" "class" "interface" LCURLY RCURLY COMMA LPAREN RPAREN "this" +// "super" ASSIGN COLON "if" "else" "for" "while" "do" "break" "continue" +// "return" "switch" "throw" "case" "default" "try" PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +// LT_ GT LE GE "instanceof" SL SR BSR PLUS MINUS DIV MOD INC DEC BNOT +// LNOT "true" "false" "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL +// NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_16(_tokenSet_16_data_,12); +const unsigned long JavaRecognizer::_tokenSet_17_data_[] = { 0UL, 4026434432UL, 8575UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" LBRACK "void" "boolean" "byte" "char" +// "short" "int" "float" "long" "double" IDENT DOT "private" "public" "protected" +// "static" "transient" "native" "threadsafe" "synchronized" "volatile" +// "class" "interface" LPAREN +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_17(_tokenSet_17_data_,8); +const unsigned long JavaRecognizer::_tokenSet_18_data_[] = { 0UL, 201359360UL, 0UL, 0UL, 0UL, 0UL }; +// LBRACK IDENT DOT +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_18(_tokenSet_18_data_,6); +const unsigned long JavaRecognizer::_tokenSet_19_data_[] = { 0UL, 40960UL, 133120UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LBRACK COMMA ASSIGN +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_19(_tokenSet_19_data_,8); +const unsigned long JavaRecognizer::_tokenSet_20_data_[] = { 0UL, 3892192128UL, 1919UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI "void" "boolean" "byte" "char" "short" +// "int" "float" "long" "double" IDENT "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +// "interface" LCURLY RCURLY +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_20(_tokenSet_20_data_,8); +const unsigned long JavaRecognizer::_tokenSet_21_data_[] = { 0UL, 3892192128UL, 1070704255UL, 3221225473UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI "void" "boolean" "byte" "char" "short" +// "int" "float" "long" "double" IDENT "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +// LCURLY RCURLY LPAREN "this" "super" "if" "for" "while" "do" "break" +// "continue" "return" "switch" "throw" "try" PLUS MINUS INC DEC BNOT LNOT +// "true" "false" "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL NUM_FLOAT +// NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_21(_tokenSet_21_data_,12); +const unsigned long JavaRecognizer::_tokenSet_22_data_[] = { 0UL, 4294878080UL, 1071359871UL, 4294967289UL, 65535UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI LBRACK "void" "boolean" "byte" "char" +// "short" "int" "float" "long" "double" IDENT DOT STAR "private" "public" +// "protected" "static" "transient" "native" "threadsafe" "synchronized" +// "volatile" "class" "interface" LCURLY RCURLY LPAREN "this" "super" ASSIGN +// COLON "if" "for" "while" "do" "break" "continue" "return" "switch" "throw" +// "try" PLUS_ASSIGN MINUS_ASSIGN STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN +// BSR_ASSIGN SL_ASSIGN BAND_ASSIGN BXOR_ASSIGN BOR_ASSIGN QUESTION LOR +// LAND BOR BXOR BAND NOT_EQUAL EQUAL LT_ GT LE GE "instanceof" SL SR BSR +// PLUS MINUS DIV MOD INC DEC BNOT LNOT "true" "false" "null" "new" NUM_INT +// CHAR_LITERAL STRING_LITERAL NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_22(_tokenSet_22_data_,12); +const unsigned long JavaRecognizer::_tokenSet_23_data_[] = { 0UL, 3892192128UL, 1070703231UL, 3221225473UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI "void" "boolean" "byte" "char" "short" +// "int" "float" "long" "double" IDENT "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +// LCURLY LPAREN "this" "super" "if" "for" "while" "do" "break" "continue" +// "return" "switch" "throw" "try" PLUS MINUS INC DEC BNOT LNOT "true" +// "false" "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL NUM_FLOAT NUM_LONG +// NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_23(_tokenSet_23_data_,12); +const unsigned long JavaRecognizer::_tokenSet_24_data_[] = { 0UL, 0UL, 16384UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// RPAREN +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_24(_tokenSet_24_data_,8); +const unsigned long JavaRecognizer::_tokenSet_25_data_[] = { 0UL, 8192UL, 412160UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LCURLY COMMA RPAREN ASSIGN "throws" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_25(_tokenSet_25_data_,8); +const unsigned long JavaRecognizer::_tokenSet_26_data_[] = { 0UL, 8192UL, 512UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LCURLY +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_26(_tokenSet_26_data_,8); +const unsigned long JavaRecognizer::_tokenSet_27_data_[] = { 0UL, 3892192128UL, 4294027135UL, 3221225479UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI "void" "boolean" "byte" "char" "short" +// "int" "float" "long" "double" IDENT "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +// "interface" LCURLY RCURLY LPAREN "this" "super" "if" "else" "for" "while" +// "do" "break" "continue" "return" "switch" "throw" "case" "default" "try" +// "finally" "catch" PLUS MINUS INC DEC BNOT LNOT "true" "false" "null" +// "new" NUM_INT CHAR_LITERAL STRING_LITERAL NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_27(_tokenSet_27_data_,12); +const unsigned long JavaRecognizer::_tokenSet_28_data_[] = { 0UL, 3892192128UL, 4294026879UL, 3221225473UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI "void" "boolean" "byte" "char" "short" +// "int" "float" "long" "double" IDENT "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +// LCURLY RCURLY LPAREN "this" "super" "if" "else" "for" "while" "do" "break" +// "continue" "return" "switch" "throw" "case" "default" "try" PLUS MINUS +// INC DEC BNOT LNOT "true" "false" "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL +// NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_28(_tokenSet_28_data_,12); +const unsigned long JavaRecognizer::_tokenSet_29_data_[] = { 0UL, 4294878080UL, 4294682495UL, 4294967295UL, 65535UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI LBRACK "void" "boolean" "byte" "char" +// "short" "int" "float" "long" "double" IDENT DOT STAR "private" "public" +// "protected" "static" "transient" "native" "threadsafe" "synchronized" +// "volatile" "class" "interface" LCURLY RCURLY LPAREN "this" "super" ASSIGN +// COLON "if" "else" "for" "while" "do" "break" "continue" "return" "switch" +// "throw" "case" "default" "try" "finally" "catch" PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +// LT_ GT LE GE "instanceof" SL SR BSR PLUS MINUS DIV MOD INC DEC BNOT +// LNOT "true" "false" "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL +// NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_29(_tokenSet_29_data_,12); +const unsigned long JavaRecognizer::_tokenSet_30_data_[] = { 0UL, 3892183936UL, 63UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" "void" "boolean" "byte" "char" "short" +// "int" "float" "long" "double" IDENT "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_30(_tokenSet_30_data_,8); +const unsigned long JavaRecognizer::_tokenSet_31_data_[] = { 0UL, 4026434432UL, 63UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" LBRACK "void" "boolean" "byte" "char" +// "short" "int" "float" "long" "double" IDENT DOT "private" "public" "protected" +// "static" "transient" "native" "threadsafe" "synchronized" "volatile" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_31(_tokenSet_31_data_,8); +const unsigned long JavaRecognizer::_tokenSet_32_data_[] = { 0UL, 134086656UL, 106496UL, 3221225472UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "void" "boolean" "byte" "char" "short" "int" "float" "long" "double" +// IDENT LPAREN "this" "super" PLUS MINUS INC DEC BNOT LNOT "true" "false" +// "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL NUM_FLOAT NUM_LONG +// NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_32(_tokenSet_32_data_,12); +const unsigned long JavaRecognizer::_tokenSet_33_data_[] = { 0UL, 536780800UL, 237568UL, 4294967288UL, 65535UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LBRACK "void" "boolean" "byte" "char" "short" "int" "float" "long" +// "double" IDENT DOT STAR LPAREN "this" "super" ASSIGN PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +// LT_ GT LE GE "instanceof" SL SR BSR PLUS MINUS DIV MOD INC DEC BNOT +// LNOT "true" "false" "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL +// NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_33(_tokenSet_33_data_,12); +const unsigned long JavaRecognizer::_tokenSet_34_data_[] = { 0UL, 3758097280UL, 127UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_34(_tokenSet_34_data_,8); +const unsigned long JavaRecognizer::_tokenSet_35_data_[] = { 0UL, 3825206144UL, 127UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" IDENT "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_35(_tokenSet_35_data_,8); +const unsigned long JavaRecognizer::_tokenSet_36_data_[] = { 0UL, 8192UL, 2048UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI COMMA +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_36(_tokenSet_36_data_,8); +const unsigned long JavaRecognizer::_tokenSet_37_data_[] = { 0UL, 8192UL, 3072UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RCURLY COMMA +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_37(_tokenSet_37_data_,8); +const unsigned long JavaRecognizer::_tokenSet_38_data_[] = { 0UL, 134086656UL, 107008UL, 3221225472UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "void" "boolean" "byte" "char" "short" "int" "float" "long" "double" +// IDENT LCURLY LPAREN "this" "super" PLUS MINUS INC DEC BNOT LNOT "true" +// "false" "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL NUM_FLOAT NUM_LONG +// NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_38(_tokenSet_38_data_,12); +const unsigned long JavaRecognizer::_tokenSet_39_data_[] = { 0UL, 402759680UL, 674816UL, 4294967288UL, 15UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LBRACK RBRACK DOT STAR RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN +// MINUS_ASSIGN STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN +// SL_ASSIGN BAND_ASSIGN BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR +// BAND NOT_EQUAL EQUAL LT_ GT LE GE "instanceof" SL SR BSR PLUS MINUS +// DIV MOD INC DEC +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_39(_tokenSet_39_data_,12); +const unsigned long JavaRecognizer::_tokenSet_40_data_[] = { 0UL, 73728UL, 543744UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN COLON +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_40(_tokenSet_40_data_,8); +const unsigned long JavaRecognizer::_tokenSet_41_data_[] = { 0UL, 0UL, 18432UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// COMMA RPAREN +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_41(_tokenSet_41_data_,8); +const unsigned long JavaRecognizer::_tokenSet_42_data_[] = { 0UL, 134086656UL, 0UL, 0UL, 0UL, 0UL }; +// "void" "boolean" "byte" "char" "short" "int" "float" "long" "double" +// IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_42(_tokenSet_42_data_,6); +const unsigned long JavaRecognizer::_tokenSet_43_data_[] = { 0UL, 536780800UL, 239616UL, 4294967288UL, 65535UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LBRACK "void" "boolean" "byte" "char" "short" "int" "float" "long" +// "double" IDENT DOT STAR COMMA LPAREN "this" "super" ASSIGN PLUS_ASSIGN +// MINUS_ASSIGN STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN +// SL_ASSIGN BAND_ASSIGN BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR +// BAND NOT_EQUAL EQUAL LT_ GT LE GE "instanceof" SL SR BSR PLUS MINUS +// DIV MOD INC DEC BNOT LNOT "true" "false" "null" "new" NUM_INT CHAR_LITERAL +// STRING_LITERAL NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_43(_tokenSet_43_data_,12); +const unsigned long JavaRecognizer::_tokenSet_44_data_[] = { 0UL, 134086656UL, 630784UL, 3221225472UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "void" "boolean" "byte" "char" "short" "int" "float" "long" "double" +// IDENT LPAREN "this" "super" COLON PLUS MINUS INC DEC BNOT LNOT "true" +// "false" "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL NUM_FLOAT NUM_LONG +// NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_44(_tokenSet_44_data_,12); +const unsigned long JavaRecognizer::_tokenSet_45_data_[] = { 0UL, 0UL, 3221226496UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// RCURLY "case" "default" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_45(_tokenSet_45_data_,8); +const unsigned long JavaRecognizer::_tokenSet_46_data_[] = { 0UL, 3892192128UL, 4291929727UL, 3221225473UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI "void" "boolean" "byte" "char" "short" +// "int" "float" "long" "double" IDENT "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +// LCURLY RCURLY LPAREN "this" "super" "if" "for" "while" "do" "break" +// "continue" "return" "switch" "throw" "case" "default" "try" PLUS MINUS +// INC DEC BNOT LNOT "true" "false" "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL +// NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_46(_tokenSet_46_data_,12); +const unsigned long JavaRecognizer::_tokenSet_47_data_[] = { 0UL, 8192UL, 16384UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RPAREN +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_47(_tokenSet_47_data_,8); +const unsigned long JavaRecognizer::_tokenSet_48_data_[] = { 0UL, 3892192128UL, 4294026879UL, 3221225479UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI "void" "boolean" "byte" "char" "short" +// "int" "float" "long" "double" IDENT "private" "public" "protected" "static" +// "transient" "native" "threadsafe" "synchronized" "volatile" "class" +// LCURLY RCURLY LPAREN "this" "super" "if" "else" "for" "while" "do" "break" +// "continue" "return" "switch" "throw" "case" "default" "try" "finally" +// "catch" PLUS MINUS INC DEC BNOT LNOT "true" "false" "null" "new" NUM_INT +// CHAR_LITERAL STRING_LITERAL NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_48(_tokenSet_48_data_,12); +const unsigned long JavaRecognizer::_tokenSet_49_data_[] = { 0UL, 73728UL, 674816UL, 16376UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_49(_tokenSet_49_data_,8); +const unsigned long JavaRecognizer::_tokenSet_50_data_[] = { 0UL, 73728UL, 674816UL, 32760UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_50(_tokenSet_50_data_,8); +const unsigned long JavaRecognizer::_tokenSet_51_data_[] = { 0UL, 73728UL, 674816UL, 65528UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_51(_tokenSet_51_data_,8); +const unsigned long JavaRecognizer::_tokenSet_52_data_[] = { 0UL, 73728UL, 674816UL, 131064UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_52(_tokenSet_52_data_,8); +const unsigned long JavaRecognizer::_tokenSet_53_data_[] = { 0UL, 73728UL, 674816UL, 262136UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_53(_tokenSet_53_data_,8); +const unsigned long JavaRecognizer::_tokenSet_54_data_[] = { 0UL, 73728UL, 674816UL, 524280UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_54(_tokenSet_54_data_,8); +const unsigned long JavaRecognizer::_tokenSet_55_data_[] = { 0UL, 73728UL, 674816UL, 1048568UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_55(_tokenSet_55_data_,8); +const unsigned long JavaRecognizer::_tokenSet_56_data_[] = { 0UL, 73728UL, 674816UL, 4194296UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_56(_tokenSet_56_data_,8); +const unsigned long JavaRecognizer::_tokenSet_57_data_[] = { 0UL, 73728UL, 674816UL, 134217720UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +// LT_ GT LE GE "instanceof" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_57(_tokenSet_57_data_,8); +const unsigned long JavaRecognizer::_tokenSet_58_data_[] = { 0UL, 73728UL, 674816UL, 1073741816UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +// LT_ GT LE GE "instanceof" SL SR BSR +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_58(_tokenSet_58_data_,8); +const unsigned long JavaRecognizer::_tokenSet_59_data_[] = { 0UL, 268435456UL, 0UL, 0UL, 3UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// STAR DIV MOD +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_59(_tokenSet_59_data_,12); +const unsigned long JavaRecognizer::_tokenSet_60_data_[] = { 0UL, 73728UL, 674816UL, 4294967288UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +// LT_ GT LE GE "instanceof" SL SR BSR PLUS MINUS +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_60(_tokenSet_60_data_,8); +const unsigned long JavaRecognizer::_tokenSet_61_data_[] = { 0UL, 268509184UL, 674816UL, 4294967288UL, 3UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RBRACK STAR RCURLY COMMA RPAREN ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +// LT_ GT LE GE "instanceof" SL SR BSR PLUS MINUS DIV MOD +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_61(_tokenSet_61_data_,12); +const unsigned long JavaRecognizer::_tokenSet_62_data_[] = { 0UL, 134086656UL, 106496UL, 0UL, 65472UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "void" "boolean" "byte" "char" "short" "int" "float" "long" "double" +// IDENT LPAREN "this" "super" "true" "false" "null" "new" NUM_INT CHAR_LITERAL +// STRING_LITERAL NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_62(_tokenSet_62_data_,12); +const unsigned long JavaRecognizer::_tokenSet_63_data_[] = { 0UL, 536846336UL, 781312UL, 4294967288UL, 65535UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LBRACK RBRACK "void" "boolean" "byte" "char" "short" "int" "float" +// "long" "double" IDENT DOT STAR RCURLY COMMA LPAREN RPAREN "this" "super" +// ASSIGN COLON PLUS_ASSIGN MINUS_ASSIGN STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN +// SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN BXOR_ASSIGN BOR_ASSIGN QUESTION +// LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL LT_ GT LE GE "instanceof" SL +// SR BSR PLUS MINUS DIV MOD INC DEC BNOT LNOT "true" "false" "null" "new" +// NUM_INT CHAR_LITERAL STRING_LITERAL NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_63(_tokenSet_63_data_,12); +const unsigned long JavaRecognizer::_tokenSet_64_data_[] = { 0UL, 4294943616UL, 4294700927UL, 4294967289UL, 65535UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "strictfp" SEMI LBRACK RBRACK "void" "boolean" "byte" +// "char" "short" "int" "float" "long" "double" IDENT DOT STAR "private" +// "public" "protected" "static" "transient" "native" "threadsafe" "synchronized" +// "volatile" "class" "interface" LCURLY RCURLY COMMA LPAREN RPAREN "this" +// "super" ASSIGN COLON "if" "else" "for" "while" "do" "break" "continue" +// "return" "switch" "throw" "case" "default" "try" PLUS_ASSIGN MINUS_ASSIGN +// STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN BSR_ASSIGN SL_ASSIGN BAND_ASSIGN +// BXOR_ASSIGN BOR_ASSIGN QUESTION LOR LAND BOR BXOR BAND NOT_EQUAL EQUAL +// LT_ GT LE GE "instanceof" SL SR BSR PLUS MINUS DIV MOD INC DEC BNOT +// LNOT "true" "false" "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL +// NUM_FLOAT NUM_LONG NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_64(_tokenSet_64_data_,12); +const unsigned long JavaRecognizer::_tokenSet_65_data_[] = { 0UL, 134152192UL, 106496UL, 3221225472UL, 65532UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// RBRACK "void" "boolean" "byte" "char" "short" "int" "float" "long" "double" +// IDENT LPAREN "this" "super" PLUS MINUS INC DEC BNOT LNOT "true" "false" +// "null" "new" NUM_INT CHAR_LITERAL STRING_LITERAL NUM_FLOAT NUM_LONG +// NUM_DOUBLE +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_65(_tokenSet_65_data_,12); +const unsigned long JavaRecognizer::_tokenSet_66_data_[] = { 0UL, 402759680UL, 675328UL, 4294967288UL, 15UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LBRACK RBRACK DOT STAR LCURLY RCURLY COMMA RPAREN ASSIGN COLON +// PLUS_ASSIGN MINUS_ASSIGN STAR_ASSIGN DIV_ASSIGN MOD_ASSIGN SR_ASSIGN +// BSR_ASSIGN SL_ASSIGN BAND_ASSIGN BXOR_ASSIGN BOR_ASSIGN QUESTION LOR +// LAND BOR BXOR BAND NOT_EQUAL EQUAL LT_ GT LE GE "instanceof" SL SR BSR +// PLUS MINUS DIV MOD INC DEC +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaRecognizer::_tokenSet_66(_tokenSet_66_data_,12); + + diff --git a/languages/java/JavaRecognizer.hpp b/languages/java/JavaRecognizer.hpp new file mode 100644 index 00000000..e9e426b7 --- /dev/null +++ b/languages/java/JavaRecognizer.hpp @@ -0,0 +1,423 @@ +#ifndef INC_JavaRecognizer_hpp_ +#define INC_JavaRecognizer_hpp_ + +#line 2 "java.g" + + #include "driver.h" + #include "JavaAST.hpp" + + #include <qlistview.h> + #include <kdebug.h> + + #define SET_POSITION(ast,t)\ + { \ + RefJavaAST(ast)->setLine( t->getLine() );\ + RefJavaAST(ast)->setColumn( t->getColumn() ); \ + } + +#line 19 "JavaRecognizer.hpp" +#include <antlr/config.hpp> +/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaRecognizer.hpp"$ */ +#include <antlr/TokenStream.hpp> +#include <antlr/TokenBuffer.hpp> +#include "JavaTokenTypes.hpp" +#include <antlr/LLkParser.hpp> + +/** Java 1.3 Recognizer + * + * Run 'java Main [-showtree] directory-full-of-java-files' + * + * [The -showtree option pops up a Swing frame that shows + * the AST constructed from the parser.] + * + * Run 'java Main <directory full of java files>' + * + * Contributing authors: + * John Mitchell johnm@non.net + * Terence Parr parrt@magelang.com + * John Lilley jlilley@empathy.com + * Scott Stanchfield thetick@magelang.com + * Markus Mohnen mohnen@informatik.rwth-aachen.de + * Peter Williams pete.williams@sun.com + * Allan Jacobs Allan.Jacobs@eng.sun.com + * Steve Messick messick@redhills.com + * John Pybus john@pybus.org + * + * Version 1.00 December 9, 1997 -- initial release + * Version 1.01 December 10, 1997 + * fixed bug in octal def (0..7 not 0..8) + * Version 1.10 August 1998 (parrt) + * added tree construction + * fixed definition of WS,comments for mac,pc,unix newlines + * added unary plus + * Version 1.11 (Nov 20, 1998) + * Added "shutup" option to turn off last ambig warning. + * Fixed inner class def to allow named class defs as statements + * synchronized requires compound not simple statement + * add [] after builtInType DOT class in primaryExpression + * "const" is reserved but not valid..removed from modifiers + * Version 1.12 (Feb 2, 1999) + * Changed LITERAL_xxx to xxx in tree grammar. + * Updated java.g to use tokens {...} now for 2.6.0 (new feature). + * + * Version 1.13 (Apr 23, 1999) + * Didn't have (stat)? for else clause in tree parser. + * Didn't gen ASTs for interface extends. Updated tree parser too. + * Updated to 2.6.0. + * Version 1.14 (Jun 20, 1999) + * Allowed final/abstract on local classes. + * Removed local interfaces from methods + * Put instanceof precedence where it belongs...in relationalExpr + * It also had expr not type as arg; fixed it. + * Missing ! on SEMI in classBlock + * fixed: (expr) + "string" was parsed incorrectly (+ as unary plus). + * fixed: didn't like Object[].class in parser or tree parser + * Version 1.15 (Jun 26, 1999) + * Screwed up rule with instanceof in it. :( Fixed. + * Tree parser didn't like (expr).something; fixed. + * Allowed multiple inheritance in tree grammar. oops. + * Version 1.16 (August 22, 1999) + * Extending an interface built a wacky tree: had extra EXTENDS. + * Tree grammar didn't allow multiple superinterfaces. + * Tree grammar didn't allow empty var initializer: {} + * Version 1.17 (October 12, 1999) + * ESC lexer rule allowed 399 max not 377 max. + * java.tree.g didn't handle the expression of synchronized + * statements. + * Version 1.18 (August 12, 2001) + * Terence updated to Java 2 Version 1.3 by + * observing/combining work of Allan Jacobs and Steve + * Messick. Handles 1.3 src. Summary: + * o primary didn't include boolean.class kind of thing + * o constructor calls parsed explicitly now: + * see explicitConstructorInvocation + * o add strictfp modifier + * o missing objBlock after new expression in tree grammar + * o merged local class definition alternatives, moved after declaration + * o fixed problem with ClassName.super.field + * o reordered some alternatives to make things more efficient + * o long and double constants were not differentiated from int/float + * o whitespace rule was inefficient: matched only one char + * o add an examples directory with some nasty 1.3 cases + * o made Main.java use buffered IO and a Reader for Unicode support + * o supports UNICODE? + * Using Unicode charVocabulay makes code file big, but only + * in the bitsets at the end. I need to make ANTLR generate + * unicode bitsets more efficiently. + * Version 1.19 (April 25, 2002) + * Terence added in nice fixes by John Pybus concerning floating + * constants and problems with super() calls. John did a nice + * reorg of the primary/postfix expression stuff to read better + * and makes f.g.super() parse properly (it was METHOD_CALL not + * a SUPER_CTOR_CALL). Also: + * + * o "finally" clause was a root...made it a child of "try" + * o Added stuff for asserts too for Java 1.4, but *commented out* + * as it is not backward compatible. + * + * Version 1.20 (October 27, 2002) + * + * Terence ended up reorging John Pybus' stuff to + * remove some nondeterminisms and some syntactic predicates. + * Note that the grammar is stricter now; e.g., this(...) must + * be the first statement. + * + * Trinary ?: operator wasn't working as array name: + * (isBig ? bigDigits : digits)[i]; + * + * Checked parser/tree parser on source for + * Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4, + * and the 110k-line jGuru server source. + * + * Version tracking now done with following ID: + * + * $Id$ + * + * This grammar is in the PUBLIC DOMAIN + */ +class CUSTOM_API JavaRecognizer : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public JavaTokenTypes +{ +#line 154 "java.g" + +private: + Driver* m_driver; + +public: + void setDriver( Driver* d ) { m_driver = d; } + void setFileName( const QString& fileName ) { m_driver->currentFileName() = fileName; } + + void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(ex.getMessage().c_str()), ex.getLine(), ex.getColumn()) ); + } + + void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(errorMessage.c_str()), LT(1)->getLine(), LT(1)->getColumn()) ); + } + + void reportMessage( const ANTLR_USE_NAMESPACE(std)string& message ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(message.c_str()), LT(1)->getLine(), LT(1)->getColumn()) ); + } +#line 142 "JavaRecognizer.hpp" +public: + void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); +protected: + JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); +public: + JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); +protected: + JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); +public: + JavaRecognizer(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); + JavaRecognizer(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); + int getNumTokens() const + { + return JavaRecognizer::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return JavaRecognizer::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return JavaRecognizer::tokenNames; + } + public: void compilationUnit(); + public: void packageDefinition(); + public: void importDefinition(); + public: void typeDefinition(); + public: void identifier(); + public: void identifierStar(); + public: void modifiers(); + public: void classDefinition( + RefJavaAST modifiers + ); + public: void interfaceDefinition( + RefJavaAST modifiers + ); + public: void declaration(); + public: void typeSpec( + bool addImagNode + ); + public: void variableDefinitions( + RefJavaAST mods, RefJavaAST t + ); + public: void classTypeSpec( + bool addImagNode + ); + public: void builtInTypeSpec( + bool addImagNode + ); + public: void builtInType(); + public: void type(); + public: void modifier(); + public: void superClassClause(); + public: void implementsClause(); + public: void classBlock(); + public: void interfaceExtends(); + public: void field(); + public: void ctorHead(); + public: void constructorBody(); + public: void parameterDeclarationList(); + public: void declaratorBrackets( + RefJavaAST typ + ); + public: void throwsClause(); + public: void compoundStatement(); + public: void explicitConstructorInvocation(); + public: void statement(); + public: void argList(); + public: void variableDeclarator( + RefJavaAST mods, RefJavaAST t + ); + public: void varInitializer(); + public: void initializer(); + public: void arrayInitializer(); + public: void expression(); + public: void parameterDeclaration(); + public: void parameterModifier(); + public: void forInit(); + public: void forCond(); + public: void forIter(); + public: void casesGroup(); + public: void tryBlock(); + public: void aCase(); + public: void caseSList(); + public: void expressionList(); + public: void handler(); + public: void finallyClause(); + public: void assignmentExpression(); + public: void conditionalExpression(); + public: void logicalOrExpression(); + public: void logicalAndExpression(); + public: void inclusiveOrExpression(); + public: void exclusiveOrExpression(); + public: void andExpression(); + public: void equalityExpression(); + public: void relationalExpression(); + public: void shiftExpression(); + public: void additiveExpression(); + public: void multiplicativeExpression(); + public: void unaryExpression(); + public: void unaryExpressionNotPlusMinus(); + public: void postfixExpression(); + public: void primaryExpression(); + public: void newExpression(); + public: void identPrimary(); + public: void constant(); + public: void newArrayDeclarator(); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefJavaAST returnAST; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 152; +#else + enum { + NUM_TOKENS = 152 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; + static const unsigned long _tokenSet_5_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; + static const unsigned long _tokenSet_6_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; + static const unsigned long _tokenSet_7_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; + static const unsigned long _tokenSet_8_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; + static const unsigned long _tokenSet_9_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; + static const unsigned long _tokenSet_10_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10; + static const unsigned long _tokenSet_11_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11; + static const unsigned long _tokenSet_12_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12; + static const unsigned long _tokenSet_13_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13; + static const unsigned long _tokenSet_14_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14; + static const unsigned long _tokenSet_15_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_15; + static const unsigned long _tokenSet_16_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_16; + static const unsigned long _tokenSet_17_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_17; + static const unsigned long _tokenSet_18_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_18; + static const unsigned long _tokenSet_19_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_19; + static const unsigned long _tokenSet_20_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_20; + static const unsigned long _tokenSet_21_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_21; + static const unsigned long _tokenSet_22_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_22; + static const unsigned long _tokenSet_23_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_23; + static const unsigned long _tokenSet_24_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_24; + static const unsigned long _tokenSet_25_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_25; + static const unsigned long _tokenSet_26_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_26; + static const unsigned long _tokenSet_27_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_27; + static const unsigned long _tokenSet_28_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_28; + static const unsigned long _tokenSet_29_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_29; + static const unsigned long _tokenSet_30_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_30; + static const unsigned long _tokenSet_31_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_31; + static const unsigned long _tokenSet_32_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_32; + static const unsigned long _tokenSet_33_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_33; + static const unsigned long _tokenSet_34_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_34; + static const unsigned long _tokenSet_35_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_35; + static const unsigned long _tokenSet_36_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_36; + static const unsigned long _tokenSet_37_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_37; + static const unsigned long _tokenSet_38_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_38; + static const unsigned long _tokenSet_39_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_39; + static const unsigned long _tokenSet_40_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_40; + static const unsigned long _tokenSet_41_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_41; + static const unsigned long _tokenSet_42_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_42; + static const unsigned long _tokenSet_43_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_43; + static const unsigned long _tokenSet_44_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_44; + static const unsigned long _tokenSet_45_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_45; + static const unsigned long _tokenSet_46_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_46; + static const unsigned long _tokenSet_47_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_47; + static const unsigned long _tokenSet_48_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_48; + static const unsigned long _tokenSet_49_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_49; + static const unsigned long _tokenSet_50_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_50; + static const unsigned long _tokenSet_51_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_51; + static const unsigned long _tokenSet_52_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_52; + static const unsigned long _tokenSet_53_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_53; + static const unsigned long _tokenSet_54_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_54; + static const unsigned long _tokenSet_55_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_55; + static const unsigned long _tokenSet_56_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_56; + static const unsigned long _tokenSet_57_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_57; + static const unsigned long _tokenSet_58_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_58; + static const unsigned long _tokenSet_59_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_59; + static const unsigned long _tokenSet_60_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_60; + static const unsigned long _tokenSet_61_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_61; + static const unsigned long _tokenSet_62_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_62; + static const unsigned long _tokenSet_63_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_63; + static const unsigned long _tokenSet_64_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_64; + static const unsigned long _tokenSet_65_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_65; + static const unsigned long _tokenSet_66_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_66; +}; + +#endif /*INC_JavaRecognizer_hpp_*/ diff --git a/languages/java/JavaStoreWalker.cpp b/languages/java/JavaStoreWalker.cpp new file mode 100644 index 00000000..b442aafd --- /dev/null +++ b/languages/java/JavaStoreWalker.cpp @@ -0,0 +1,3441 @@ +/* $ANTLR 2.7.7 (20061129): "java.store.g" -> "JavaStoreWalker.cpp"$ */ +#include "JavaStoreWalker.hpp" +#include <antlr/Token.hpp> +#include <antlr/AST.hpp> +#include <antlr/NoViableAltException.hpp> +#include <antlr/MismatchedTokenException.hpp> +#include <antlr/SemanticException.hpp> +#include <antlr/BitSet.hpp> +#line 1 "java.store.g" +#line 11 "JavaStoreWalker.cpp" +JavaStoreWalker::JavaStoreWalker() + : ANTLR_USE_NAMESPACE(antlr)TreeParser() { +} + +void JavaStoreWalker::compilationUnit(RefJavaAST _t) { + RefJavaAST compilationUnit_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 75 "java.store.g" + QString package; QString imp; QStringList imports; +#line 20 "JavaStoreWalker.cpp" + + try { // for error handling +#line 76 "java.store.g" + init(); +#line 25 "JavaStoreWalker.cpp" + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PACKAGE_DEF: + { + package=packageDefinition(_t); + _t = _retTree; + break; + } + case 3: + case CLASS_DEF: + case INTERFACE_DEF: + case IMPORT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IMPORT)) { + imp=importDefinition(_t); + _t = _retTree; +#line 78 "java.store.g" + imports << imp; +#line 58 "JavaStoreWalker.cpp" + } + else { + goto _loop4; + } + + } + _loop4:; + } // ( ... )* + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == CLASS_DEF || _t->getType() == INTERFACE_DEF)) { + typeDefinition(_t); + _t = _retTree; + } + else { + goto _loop6; + } + + } + _loop6:; + } // ( ... )* + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + + QString JavaStoreWalker::packageDefinition(RefJavaAST _t) { +#line 82 "java.store.g" + QString id ; +#line 94 "JavaStoreWalker.cpp" + RefJavaAST packageDefinition_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t8 = _t; + RefJavaAST tmp1_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PACKAGE_DEF); + _t = _t->getFirstChild(); + id=identifier(_t); + _t = _retTree; + _t = __t8; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return id ; +} + + QString JavaStoreWalker::importDefinition(RefJavaAST _t) { +#line 86 "java.store.g" + QString id ; +#line 119 "JavaStoreWalker.cpp" + RefJavaAST importDefinition_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t10 = _t; + RefJavaAST tmp2_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IMPORT); + _t = _t->getFirstChild(); + id=identifierStar(_t); + _t = _retTree; + _t = __t10; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return id ; +} + +void JavaStoreWalker::typeDefinition(RefJavaAST _t) { + RefJavaAST typeDefinition_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 90 "java.store.g" + QStringList bases; QString className; ClassDom klass; QStringList m; +#line 145 "JavaStoreWalker.cpp" + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case CLASS_DEF: + { + RefJavaAST __t12 = _t; + RefJavaAST tmp3_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CLASS_DEF); + _t = _t->getFirstChild(); + m=modifiers(_t); + _t = _retTree; + RefJavaAST tmp4_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); +#line 92 "java.store.g" + + klass = m_model->create<ClassModel>(); + QString name = QString::fromUtf8( tmp4_AST_in->getText().c_str(), tmp4_AST_in->getText().length() ); + QStringList path = QStringList::split( ".", name ); + className = path.back(); + + klass->setName( path.back() ); + klass->setScope( m_currentScope ); + klass->setStartPosition( tmp4_AST_in->getLine(), tmp4_AST_in->getColumn() ); + /// @todo klass->setEndPositon() + + klass->setFileName( m_file->name() ); + if( m_currentClass.top() ) + m_currentClass.top()->addClass( klass ); + else + m_file->addClass( klass ); + +#line 180 "JavaStoreWalker.cpp" + bases=extendsClause(_t); + _t = _retTree; +#line 110 "java.store.g" + + for( QStringList::Iterator it = bases.begin(); it != bases.end(); ++it ) + klass->addBaseClass( *it ); + +#line 188 "JavaStoreWalker.cpp" + implementsClause(_t); + _t = _retTree; +#line 115 "java.store.g" + + m_currentClass.push( klass ); + m_currentScope.push_back( className ); + +#line 196 "JavaStoreWalker.cpp" + objBlock(_t,klass); + _t = _retTree; +#line 120 "java.store.g" + + m_currentClass.pop(); + m_currentScope.pop_back(); + +#line 204 "JavaStoreWalker.cpp" + _t = __t12; + _t = _t->getNextSibling(); + break; + } + case INTERFACE_DEF: + { + RefJavaAST __t13 = _t; + RefJavaAST tmp5_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INTERFACE_DEF); + _t = _t->getFirstChild(); + m=modifiers(_t); + _t = _retTree; + RefJavaAST tmp6_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); +#line 126 "java.store.g" + + klass = m_model->create<ClassModel>(); + QString name = QString::fromUtf8( tmp6_AST_in->getText().c_str(), tmp6_AST_in->getText().length() ); + QStringList path = QStringList::split( ".", name ); + className = path.back(); + + klass->setName( path.back() ); + klass->setScope( m_currentScope ); + klass->setStartPosition( tmp6_AST_in->getLine(), tmp6_AST_in->getColumn() ); + /// @todo klass->setEndPositon() + + klass->setFileName( m_file->name() ); + + if( m_currentClass.top() ) + m_currentClass.top()->addClass( klass ); + else + m_file->addClass( klass ); + +#line 239 "JavaStoreWalker.cpp" + bases=extendsClause(_t); + _t = _retTree; +#line 145 "java.store.g" + + m_currentClass.push( klass ); + m_currentScope.push_back( className ); + +#line 247 "JavaStoreWalker.cpp" + interfaceBlock(_t,klass); + _t = _retTree; +#line 150 "java.store.g" + + m_currentClass.pop(); + m_currentScope.pop_back(); + +#line 255 "JavaStoreWalker.cpp" + _t = __t13; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + + QString JavaStoreWalker::identifier(RefJavaAST _t) { +#line 363 "java.store.g" + QString id ; +#line 277 "JavaStoreWalker.cpp" + RefJavaAST identifier_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENT: + { + RefJavaAST tmp7_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); +#line 364 "java.store.g" + + id = tmp7_AST_in->getText().c_str(); + +#line 293 "JavaStoreWalker.cpp" + break; + } + case DOT: + { + RefJavaAST __t74 = _t; + RefJavaAST tmp8_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT); + _t = _t->getFirstChild(); + id=identifier(_t); + _t = _retTree; + RefJavaAST tmp9_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + _t = __t74; + _t = _t->getNextSibling(); +#line 367 "java.store.g" + + id += QString(".") + tmp9_AST_in->getText().c_str(); + +#line 313 "JavaStoreWalker.cpp" + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return id ; +} + + QString JavaStoreWalker::identifierStar(RefJavaAST _t) { +#line 372 "java.store.g" + QString id ; +#line 334 "JavaStoreWalker.cpp" + RefJavaAST identifierStar_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENT: + { + RefJavaAST tmp10_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); +#line 373 "java.store.g" + + id = tmp10_AST_in->getText().c_str(); + +#line 350 "JavaStoreWalker.cpp" + break; + } + case DOT: + { + RefJavaAST __t76 = _t; + RefJavaAST tmp11_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT); + _t = _t->getFirstChild(); + id=identifier(_t); + _t = _retTree; + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case STAR: + { + RefJavaAST tmp12_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STAR); + _t = _t->getNextSibling(); +#line 376 "java.store.g" + id += QString(".") + tmp12_AST_in->getText().c_str(); +#line 372 "JavaStoreWalker.cpp" + break; + } + case IDENT: + { + RefJavaAST tmp13_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); +#line 377 "java.store.g" + id += QString(".") + tmp13_AST_in->getText().c_str(); +#line 382 "JavaStoreWalker.cpp" + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t76; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return id ; +} + + QStringList JavaStoreWalker::modifiers(RefJavaAST _t) { +#line 183 "java.store.g" + QStringList l ; +#line 413 "JavaStoreWalker.cpp" + RefJavaAST modifiers_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + RefJavaAST m = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefJavaAST __t21 = _t; + RefJavaAST tmp14_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MODIFIERS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_0.member(_t->getType()))) { + m = (_t == ASTNULL) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + modifier(_t); + _t = _retTree; +#line 184 "java.store.g" + l << m->getText().c_str(); +#line 432 "JavaStoreWalker.cpp" + } + else { + goto _loop23; + } + + } + _loop23:; + } // ( ... )* + _t = __t21; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return l ; +} + + QStringList JavaStoreWalker::extendsClause(RefJavaAST _t) { +#line 202 "java.store.g" + QStringList l ; +#line 456 "JavaStoreWalker.cpp" + RefJavaAST extendsClause_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 202 "java.store.g" + QString id; +#line 460 "JavaStoreWalker.cpp" + + try { // for error handling + RefJavaAST __t26 = _t; + RefJavaAST tmp15_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EXTENDS_CLAUSE); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IDENT || _t->getType() == DOT)) { + id=identifier(_t); + _t = _retTree; +#line 203 "java.store.g" + l << id; +#line 476 "JavaStoreWalker.cpp" + } + else { + goto _loop28; + } + + } + _loop28:; + } // ( ... )* + _t = __t26; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return l ; +} + + QStringList JavaStoreWalker::implementsClause(RefJavaAST _t) { +#line 206 "java.store.g" + QStringList l ; +#line 500 "JavaStoreWalker.cpp" + RefJavaAST implementsClause_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 206 "java.store.g" + QString id; +#line 504 "JavaStoreWalker.cpp" + + try { // for error handling + RefJavaAST __t30 = _t; + RefJavaAST tmp16_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IMPLEMENTS_CLAUSE); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IDENT || _t->getType() == DOT)) { + id=identifier(_t); + _t = _retTree; +#line 207 "java.store.g" + l << id; +#line 520 "JavaStoreWalker.cpp" + } + else { + goto _loop32; + } + + } + _loop32:; + } // ( ... )* + _t = __t30; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return l ; +} + +void JavaStoreWalker::objBlock(RefJavaAST _t, + ClassDom klass +) { + RefJavaAST objBlock_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 221 "java.store.g" + FunctionDom meth; VariableDom attr; +#line 547 "JavaStoreWalker.cpp" + + try { // for error handling + RefJavaAST __t38 = _t; + RefJavaAST tmp17_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OBJBLOCK); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case CTOR_DEF: + { + meth=ctorDef(_t); + _t = _retTree; +#line 223 "java.store.g" + + klass->addFunction( meth ); + +#line 567 "JavaStoreWalker.cpp" + break; + } + case METHOD_DEF: + { + meth=methodDef(_t); + _t = _retTree; +#line 226 "java.store.g" + + klass->addFunction( meth ); + +#line 578 "JavaStoreWalker.cpp" + break; + } + case VARIABLE_DEF: + { + attr=variableDef(_t); + _t = _retTree; +#line 229 "java.store.g" + + klass->addVariable( attr ); + +#line 589 "JavaStoreWalker.cpp" + break; + } + case CLASS_DEF: + case INTERFACE_DEF: + { + typeDefinition(_t); + _t = _retTree; + break; + } + case STATIC_INIT: + { + RefJavaAST __t40 = _t; + RefJavaAST tmp18_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STATIC_INIT); + _t = _t->getFirstChild(); + slist(_t); + _t = _retTree; + _t = __t40; + _t = _t->getNextSibling(); + break; + } + case INSTANCE_INIT: + { + RefJavaAST __t41 = _t; + RefJavaAST tmp19_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INSTANCE_INIT); + _t = _t->getFirstChild(); + slist(_t); + _t = _retTree; + _t = __t41; + _t = _t->getNextSibling(); + break; + } + default: + { + goto _loop42; + } + } + } + _loop42:; + } // ( ... )* + _t = __t38; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::interfaceBlock(RefJavaAST _t, + ClassDom klass +) { + RefJavaAST interfaceBlock_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 210 "java.store.g" + FunctionDom meth; VariableDom attr; +#line 648 "JavaStoreWalker.cpp" + + try { // for error handling + RefJavaAST __t34 = _t; + RefJavaAST tmp20_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OBJBLOCK); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case METHOD_DEF: + { + meth=methodDecl(_t); + _t = _retTree; +#line 212 "java.store.g" + + +#line 667 "JavaStoreWalker.cpp" + break; + } + case VARIABLE_DEF: + { + attr=variableDef(_t); + _t = _retTree; +#line 215 "java.store.g" + + +#line 677 "JavaStoreWalker.cpp" + break; + } + default: + { + goto _loop36; + } + } + } + _loop36:; + } // ( ... )* + _t = __t34; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + + QString JavaStoreWalker::typeSpec(RefJavaAST _t) { +#line 157 "java.store.g" + QString tp ; +#line 702 "JavaStoreWalker.cpp" + RefJavaAST typeSpec_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t15 = _t; + RefJavaAST tmp21_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TYPE); + _t = _t->getFirstChild(); + tp=typeSpecArray(_t); + _t = _retTree; + _t = __t15; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return tp ; +} + + QString JavaStoreWalker::typeSpecArray(RefJavaAST _t) { +#line 161 "java.store.g" + QString tp ; +#line 727 "JavaStoreWalker.cpp" + RefJavaAST typeSpecArray_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARRAY_DECLARATOR: + { + RefJavaAST __t17 = _t; + RefJavaAST tmp22_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ARRAY_DECLARATOR); + _t = _t->getFirstChild(); + tp=typeSpecArray(_t); + _t = _retTree; + _t = __t17; + _t = _t->getNextSibling(); +#line 162 "java.store.g" + tp += "[]"; +#line 746 "JavaStoreWalker.cpp" + break; + } + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + case IDENT: + case DOT: + { + tp=type(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return tp ; +} + + QString JavaStoreWalker::type(RefJavaAST _t) { +#line 166 "java.store.g" + QString tp ; +#line 783 "JavaStoreWalker.cpp" + RefJavaAST type_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + RefJavaAST b = RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENT: + case DOT: + { + tp=identifier(_t); + _t = _retTree; + break; + } + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + { + b = (_t == ASTNULL) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + builtInType(_t); + _t = _retTree; +#line 168 "java.store.g" + tp = b->getText().c_str(); +#line 813 "JavaStoreWalker.cpp" + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return tp ; +} + +void JavaStoreWalker::builtInType(RefJavaAST _t) { + RefJavaAST builtInType_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case LITERAL_void: + { + RefJavaAST tmp23_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_void); + _t = _t->getNextSibling(); + break; + } + case LITERAL_boolean: + { + RefJavaAST tmp24_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_boolean); + _t = _t->getNextSibling(); + break; + } + case LITERAL_byte: + { + RefJavaAST tmp25_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_byte); + _t = _t->getNextSibling(); + break; + } + case LITERAL_char: + { + RefJavaAST tmp26_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_char); + _t = _t->getNextSibling(); + break; + } + case LITERAL_short: + { + RefJavaAST tmp27_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_short); + _t = _t->getNextSibling(); + break; + } + case LITERAL_int: + { + RefJavaAST tmp28_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_int); + _t = _t->getNextSibling(); + break; + } + case LITERAL_float: + { + RefJavaAST tmp29_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_float); + _t = _t->getNextSibling(); + break; + } + case LITERAL_long: + { + RefJavaAST tmp30_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_long); + _t = _t->getNextSibling(); + break; + } + case LITERAL_double: + { + RefJavaAST tmp31_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_double); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::modifier(RefJavaAST _t) { + RefJavaAST modifier_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case LITERAL_private: + { + RefJavaAST tmp32_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_private); + _t = _t->getNextSibling(); + break; + } + case LITERAL_public: + { + RefJavaAST tmp33_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_public); + _t = _t->getNextSibling(); + break; + } + case LITERAL_protected: + { + RefJavaAST tmp34_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_protected); + _t = _t->getNextSibling(); + break; + } + case LITERAL_static: + { + RefJavaAST tmp35_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_static); + _t = _t->getNextSibling(); + break; + } + case LITERAL_transient: + { + RefJavaAST tmp36_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_transient); + _t = _t->getNextSibling(); + break; + } + case FINAL: + { + RefJavaAST tmp37_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FINAL); + _t = _t->getNextSibling(); + break; + } + case ABSTRACT: + { + RefJavaAST tmp38_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ABSTRACT); + _t = _t->getNextSibling(); + break; + } + case LITERAL_native: + { + RefJavaAST tmp39_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_native); + _t = _t->getNextSibling(); + break; + } + case LITERAL_threadsafe: + { + RefJavaAST tmp40_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_threadsafe); + _t = _t->getNextSibling(); + break; + } + case LITERAL_synchronized: + { + RefJavaAST tmp41_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_synchronized); + _t = _t->getNextSibling(); + break; + } + case LITERAL_const: + { + RefJavaAST tmp42_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_const); + _t = _t->getNextSibling(); + break; + } + case LITERAL_volatile: + { + RefJavaAST tmp43_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_volatile); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + + FunctionDom JavaStoreWalker::methodDecl(RefJavaAST _t) { +#line 257 "java.store.g" + FunctionDom meth ; +#line 1023 "JavaStoreWalker.cpp" + RefJavaAST methodDecl_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 257 "java.store.g" + + QStringList m; + QString tp; + meth = m_model->create<FunctionModel>(); + meth->setFileName( m_file->name() ); + +#line 1032 "JavaStoreWalker.cpp" + + try { // for error handling + RefJavaAST __t46 = _t; + RefJavaAST tmp44_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),METHOD_DEF); + _t = _t->getFirstChild(); + m=modifiers(_t); + _t = _retTree; + tp=typeSpec(_t); + _t = _retTree; + methodHead(_t,meth); + _t = _retTree; + _t = __t46; + _t = _t->getNextSibling(); +#line 264 "java.store.g" + + meth->setResultType( tp ); + if( m.contains("public") ) + meth->setAccess( CodeModelItem::Public ); + else if( m.contains("protected") ) + meth->setAccess( CodeModelItem::Protected ); + else + meth->setAccess( CodeModelItem::Private ); + +#line 1057 "JavaStoreWalker.cpp" + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return meth ; +} + + VariableDom JavaStoreWalker::variableDef(RefJavaAST _t) { +#line 293 "java.store.g" + VariableDom attr ; +#line 1071 "JavaStoreWalker.cpp" + RefJavaAST variableDef_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 293 "java.store.g" + + QStringList m; + QString tp; + attr = m_model->create<VariableModel>(); + attr->setFileName( m_file->name() ); + +#line 1080 "JavaStoreWalker.cpp" + + try { // for error handling + RefJavaAST __t51 = _t; + RefJavaAST tmp45_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VARIABLE_DEF); + _t = _t->getFirstChild(); + m=modifiers(_t); + _t = _retTree; + tp=typeSpec(_t); + _t = _retTree; + variableDeclarator(_t,attr); + _t = _retTree; + varInitializer(_t); + _t = _retTree; + _t = __t51; + _t = _t->getNextSibling(); +#line 300 "java.store.g" + + attr->setType( tp ); + if( m.contains("public") ) + attr->setAccess( CodeModelItem::Public ); + else if( m.contains("protected") ) + attr->setAccess( CodeModelItem::Protected ); + else + attr->setAccess( CodeModelItem::Private ); + + attr->setStatic( m.contains("static") ); + +#line 1109 "JavaStoreWalker.cpp" + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return attr ; +} + + FunctionDom JavaStoreWalker::ctorDef(RefJavaAST _t) { +#line 239 "java.store.g" + FunctionDom meth ; +#line 1123 "JavaStoreWalker.cpp" + RefJavaAST ctorDef_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 239 "java.store.g" + + QStringList m; + meth = m_model->create<FunctionModel>(); + meth->setFileName( m_file->name() ); + +#line 1131 "JavaStoreWalker.cpp" + + try { // for error handling + RefJavaAST __t44 = _t; + RefJavaAST tmp46_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CTOR_DEF); + _t = _t->getFirstChild(); + m=modifiers(_t); + _t = _retTree; + methodHead(_t,meth); + _t = _retTree; + slist(_t); + _t = _retTree; + _t = __t44; + _t = _t->getNextSibling(); +#line 247 "java.store.g" + + if( m.contains("public") ) + meth->setAccess( CodeModelItem::Public ); + else if( m.contains("protected") ) + meth->setAccess( CodeModelItem::Protected ); + else + meth->setAccess( CodeModelItem::Private ); + +#line 1155 "JavaStoreWalker.cpp" + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return meth ; +} + + FunctionDom JavaStoreWalker::methodDef(RefJavaAST _t) { +#line 275 "java.store.g" + FunctionDom meth ; +#line 1169 "JavaStoreWalker.cpp" + RefJavaAST methodDef_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 275 "java.store.g" + + QStringList m; + QString tp; + meth = m_model->create<FunctionModel>(); + meth->setFileName( m_file->name() ); + +#line 1178 "JavaStoreWalker.cpp" + + try { // for error handling + RefJavaAST __t48 = _t; + RefJavaAST tmp47_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),METHOD_DEF); + _t = _t->getFirstChild(); + m=modifiers(_t); + _t = _retTree; + tp=typeSpec(_t); + _t = _retTree; + methodHead(_t,meth); + _t = _retTree; + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case SLIST: + { + slist(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t48; + _t = _t->getNextSibling(); +#line 282 "java.store.g" + + meth->setResultType( tp ); + if( m.contains("public") ) + meth->setAccess( CodeModelItem::Public ); + else if( m.contains("protected") ) + meth->setAccess( CodeModelItem::Protected ); + else + meth->setAccess( CodeModelItem::Private ); + +#line 1223 "JavaStoreWalker.cpp" + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return meth ; +} + +void JavaStoreWalker::slist(RefJavaAST _t) { + RefJavaAST slist_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t79 = _t; + RefJavaAST tmp48_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SLIST); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_1.member(_t->getType()))) { + stat(_t); + _t = _retTree; + } + else { + goto _loop81; + } + + } + _loop81:; + } // ( ... )* + _t = __t79; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::methodHead(RefJavaAST _t, + FunctionDom meth +) { + RefJavaAST methodHead_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 350 "java.store.g" + ArgumentDom arg; +#line 1274 "JavaStoreWalker.cpp" + + try { // for error handling + RefJavaAST tmp49_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + RefJavaAST __t65 = _t; + RefJavaAST tmp50_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PARAMETERS); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == PARAMETER_DEF)) { + arg=parameterDef(_t); + _t = _retTree; +#line 351 "java.store.g" + meth->addArgument(arg); +#line 1293 "JavaStoreWalker.cpp" + } + else { + goto _loop67; + } + + } + _loop67:; + } // ( ... )* + _t = __t65; + _t = _t->getNextSibling(); + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case LITERAL_throws: + { + throwsClause(_t); + _t = _retTree; + break; + } + case 3: + case SLIST: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } +#line 352 "java.store.g" + + meth->setName( tmp49_AST_in->getText().c_str() ); + meth->setScope( m_currentScope ); + meth->setStartPosition( tmp49_AST_in->getLine(), tmp49_AST_in->getColumn() ); + +#line 1331 "JavaStoreWalker.cpp" + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::variableDeclarator(RefJavaAST _t, + VariableDom attr +) { + RefJavaAST variableDeclarator_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENT: + { + RefJavaAST tmp51_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); +#line 329 "java.store.g" + + attr->setName( tmp51_AST_in->getText().c_str() ); + attr->setStartPosition( tmp51_AST_in->getLine(), tmp51_AST_in->getColumn() ); + +#line 1360 "JavaStoreWalker.cpp" + break; + } + case LBRACK: + { + RefJavaAST tmp52_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LBRACK); + _t = _t->getNextSibling(); + variableDeclarator(_t,attr); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::varInitializer(RefJavaAST _t) { + RefJavaAST varInitializer_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ASSIGN: + { + RefJavaAST __t58 = _t; + RefJavaAST tmp53_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ASSIGN); + _t = _t->getFirstChild(); + initializer(_t); + _t = _retTree; + _t = __t58; + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + + ArgumentDom JavaStoreWalker::parameterDef(RefJavaAST _t) { +#line 313 "java.store.g" + ArgumentDom arg ; +#line 1426 "JavaStoreWalker.cpp" + RefJavaAST parameterDef_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; +#line 313 "java.store.g" + + QString tp; + arg = m_model->create<ArgumentModel>(); + +#line 1433 "JavaStoreWalker.cpp" + + try { // for error handling + RefJavaAST __t53 = _t; + RefJavaAST tmp54_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PARAMETER_DEF); + _t = _t->getFirstChild(); + modifiers(_t); + _t = _retTree; + tp=typeSpec(_t); + _t = _retTree; + RefJavaAST tmp55_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + _t = __t53; + _t = _t->getNextSibling(); +#line 318 "java.store.g" + + arg->setType( tp ); + arg->setName( tmp55_AST_in->getText().c_str() ); + +#line 1454 "JavaStoreWalker.cpp" + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; + return arg ; +} + +void JavaStoreWalker::objectinitializer(RefJavaAST _t) { + RefJavaAST objectinitializer_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t55 = _t; + RefJavaAST tmp56_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INSTANCE_INIT); + _t = _t->getFirstChild(); + slist(_t); + _t = _retTree; + _t = __t55; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::initializer(RefJavaAST _t) { + RefJavaAST initializer_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case EXPR: + { + expression(_t); + _t = _retTree; + break; + } + case ARRAY_INIT: + { + arrayInitializer(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::expression(RefJavaAST _t) { + RefJavaAST expression_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t124 = _t; + RefJavaAST tmp57_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EXPR); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + _t = __t124; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::arrayInitializer(RefJavaAST _t) { + RefJavaAST arrayInitializer_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t61 = _t; + RefJavaAST tmp58_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ARRAY_INIT); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == EXPR || _t->getType() == ARRAY_INIT)) { + initializer(_t); + _t = _retTree; + } + else { + goto _loop63; + } + + } + _loop63:; + } // ( ... )* + _t = __t61; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::throwsClause(RefJavaAST _t) { + RefJavaAST throwsClause_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t70 = _t; + RefJavaAST tmp59_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_throws); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IDENT || _t->getType() == DOT)) { + identifier(_t); + _t = _retTree; + } + else { + goto _loop72; + } + + } + _loop72:; + } // ( ... )* + _t = __t70; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::stat(RefJavaAST _t) { + RefJavaAST stat_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case CLASS_DEF: + case INTERFACE_DEF: + { + typeDefinition(_t); + _t = _retTree; + break; + } + case VARIABLE_DEF: + { + variableDef(_t); + _t = _retTree; + break; + } + case EXPR: + { + expression(_t); + _t = _retTree; + break; + } + case LABELED_STAT: + { + RefJavaAST __t83 = _t; + RefJavaAST tmp60_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LABELED_STAT); + _t = _t->getFirstChild(); + RefJavaAST tmp61_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + stat(_t); + _t = _retTree; + _t = __t83; + _t = _t->getNextSibling(); + break; + } + case LITERAL_if: + { + RefJavaAST __t84 = _t; + RefJavaAST tmp62_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_if); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + stat(_t); + _t = _retTree; + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case SLIST: + case VARIABLE_DEF: + case CLASS_DEF: + case INTERFACE_DEF: + case LABELED_STAT: + case EXPR: + case EMPTY_STAT: + case LITERAL_synchronized: + case LITERAL_if: + case LITERAL_for: + case LITERAL_while: + case LITERAL_do: + case LITERAL_break: + case LITERAL_continue: + case LITERAL_return: + case LITERAL_switch: + case LITERAL_throw: + case LITERAL_try: + { + stat(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t84; + _t = _t->getNextSibling(); + break; + } + case LITERAL_for: + { + RefJavaAST __t86 = _t; + RefJavaAST tmp63_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_for); + _t = _t->getFirstChild(); + RefJavaAST __t87 = _t; + RefJavaAST tmp64_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FOR_INIT); + _t = _t->getFirstChild(); + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case VARIABLE_DEF: + { + variableDef(_t); + _t = _retTree; + break; + } + case ELIST: + { + elist(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t87; + _t = _t->getNextSibling(); + RefJavaAST __t89 = _t; + RefJavaAST tmp65_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FOR_CONDITION); + _t = _t->getFirstChild(); + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case EXPR: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t89; + _t = _t->getNextSibling(); + RefJavaAST __t91 = _t; + RefJavaAST tmp66_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FOR_ITERATOR); + _t = _t->getFirstChild(); + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ELIST: + { + elist(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t91; + _t = _t->getNextSibling(); + stat(_t); + _t = _retTree; + _t = __t86; + _t = _t->getNextSibling(); + break; + } + case LITERAL_while: + { + RefJavaAST __t93 = _t; + RefJavaAST tmp67_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_while); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + stat(_t); + _t = _retTree; + _t = __t93; + _t = _t->getNextSibling(); + break; + } + case LITERAL_do: + { + RefJavaAST __t94 = _t; + RefJavaAST tmp68_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_do); + _t = _t->getFirstChild(); + stat(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t94; + _t = _t->getNextSibling(); + break; + } + case LITERAL_break: + { + RefJavaAST __t95 = _t; + RefJavaAST tmp69_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_break); + _t = _t->getFirstChild(); + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENT: + { + RefJavaAST tmp70_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t95; + _t = _t->getNextSibling(); + break; + } + case LITERAL_continue: + { + RefJavaAST __t97 = _t; + RefJavaAST tmp71_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_continue); + _t = _t->getFirstChild(); + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENT: + { + RefJavaAST tmp72_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t97; + _t = _t->getNextSibling(); + break; + } + case LITERAL_return: + { + RefJavaAST __t99 = _t; + RefJavaAST tmp73_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_return); + _t = _t->getFirstChild(); + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case EXPR: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t99; + _t = _t->getNextSibling(); + break; + } + case LITERAL_switch: + { + RefJavaAST __t101 = _t; + RefJavaAST tmp74_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_switch); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == CASE_GROUP)) { + caseGroup(_t); + _t = _retTree; + } + else { + goto _loop103; + } + + } + _loop103:; + } // ( ... )* + _t = __t101; + _t = _t->getNextSibling(); + break; + } + case LITERAL_throw: + { + RefJavaAST __t104 = _t; + RefJavaAST tmp75_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_throw); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + _t = __t104; + _t = _t->getNextSibling(); + break; + } + case LITERAL_synchronized: + { + RefJavaAST __t105 = _t; + RefJavaAST tmp76_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_synchronized); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + stat(_t); + _t = _retTree; + _t = __t105; + _t = _t->getNextSibling(); + break; + } + case LITERAL_try: + { + tryBlock(_t); + _t = _retTree; + break; + } + case SLIST: + { + slist(_t); + _t = _retTree; + break; + } + case EMPTY_STAT: + { + RefJavaAST tmp77_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EMPTY_STAT); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::elist(RefJavaAST _t) { + RefJavaAST elist_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t120 = _t; + RefJavaAST tmp78_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ELIST); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == EXPR)) { + expression(_t); + _t = _retTree; + } + else { + goto _loop122; + } + + } + _loop122:; + } // ( ... )* + _t = __t120; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::caseGroup(RefJavaAST _t) { + RefJavaAST caseGroup_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t107 = _t; + RefJavaAST tmp79_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CASE_GROUP); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt110=0; + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case LITERAL_case: + { + RefJavaAST __t109 = _t; + RefJavaAST tmp80_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_case); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + _t = __t109; + _t = _t->getNextSibling(); + break; + } + case LITERAL_default: + { + RefJavaAST tmp81_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_default); + _t = _t->getNextSibling(); + break; + } + default: + { + if ( _cnt110>=1 ) { goto _loop110; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + } + _cnt110++; + } + _loop110:; + } // ( ... )+ + slist(_t); + _t = _retTree; + _t = __t107; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::tryBlock(RefJavaAST _t) { + RefJavaAST tryBlock_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t112 = _t; + RefJavaAST tmp82_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_try); + _t = _t->getFirstChild(); + slist(_t); + _t = _retTree; + { // ( ... )* + for (;;) { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == LITERAL_catch)) { + handler(_t); + _t = _retTree; + } + else { + goto _loop114; + } + + } + _loop114:; + } // ( ... )* + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case LITERAL_finally: + { + RefJavaAST __t116 = _t; + RefJavaAST tmp83_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_finally); + _t = _t->getFirstChild(); + slist(_t); + _t = _retTree; + _t = __t116; + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t112; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::handler(RefJavaAST _t) { + RefJavaAST handler_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t118 = _t; + RefJavaAST tmp84_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_catch); + _t = _t->getFirstChild(); + parameterDef(_t); + _t = _retTree; + slist(_t); + _t = _retTree; + _t = __t118; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::expr(RefJavaAST _t) { + RefJavaAST expr_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case QUESTION: + { + RefJavaAST __t126 = _t; + RefJavaAST tmp85_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),QUESTION); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t126; + _t = _t->getNextSibling(); + break; + } + case ASSIGN: + { + RefJavaAST __t127 = _t; + RefJavaAST tmp86_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t127; + _t = _t->getNextSibling(); + break; + } + case PLUS_ASSIGN: + { + RefJavaAST __t128 = _t; + RefJavaAST tmp87_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PLUS_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t128; + _t = _t->getNextSibling(); + break; + } + case MINUS_ASSIGN: + { + RefJavaAST __t129 = _t; + RefJavaAST tmp88_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MINUS_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t129; + _t = _t->getNextSibling(); + break; + } + case STAR_ASSIGN: + { + RefJavaAST __t130 = _t; + RefJavaAST tmp89_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STAR_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t130; + _t = _t->getNextSibling(); + break; + } + case DIV_ASSIGN: + { + RefJavaAST __t131 = _t; + RefJavaAST tmp90_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DIV_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t131; + _t = _t->getNextSibling(); + break; + } + case MOD_ASSIGN: + { + RefJavaAST __t132 = _t; + RefJavaAST tmp91_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MOD_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t132; + _t = _t->getNextSibling(); + break; + } + case SR_ASSIGN: + { + RefJavaAST __t133 = _t; + RefJavaAST tmp92_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SR_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t133; + _t = _t->getNextSibling(); + break; + } + case BSR_ASSIGN: + { + RefJavaAST __t134 = _t; + RefJavaAST tmp93_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BSR_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t134; + _t = _t->getNextSibling(); + break; + } + case SL_ASSIGN: + { + RefJavaAST __t135 = _t; + RefJavaAST tmp94_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SL_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t135; + _t = _t->getNextSibling(); + break; + } + case BAND_ASSIGN: + { + RefJavaAST __t136 = _t; + RefJavaAST tmp95_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BAND_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t136; + _t = _t->getNextSibling(); + break; + } + case BXOR_ASSIGN: + { + RefJavaAST __t137 = _t; + RefJavaAST tmp96_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BXOR_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t137; + _t = _t->getNextSibling(); + break; + } + case BOR_ASSIGN: + { + RefJavaAST __t138 = _t; + RefJavaAST tmp97_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BOR_ASSIGN); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t138; + _t = _t->getNextSibling(); + break; + } + case LOR: + { + RefJavaAST __t139 = _t; + RefJavaAST tmp98_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LOR); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t139; + _t = _t->getNextSibling(); + break; + } + case LAND: + { + RefJavaAST __t140 = _t; + RefJavaAST tmp99_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LAND); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t140; + _t = _t->getNextSibling(); + break; + } + case BOR: + { + RefJavaAST __t141 = _t; + RefJavaAST tmp100_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BOR); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t141; + _t = _t->getNextSibling(); + break; + } + case BXOR: + { + RefJavaAST __t142 = _t; + RefJavaAST tmp101_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BXOR); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t142; + _t = _t->getNextSibling(); + break; + } + case BAND: + { + RefJavaAST __t143 = _t; + RefJavaAST tmp102_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BAND); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t143; + _t = _t->getNextSibling(); + break; + } + case NOT_EQUAL: + { + RefJavaAST __t144 = _t; + RefJavaAST tmp103_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NOT_EQUAL); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t144; + _t = _t->getNextSibling(); + break; + } + case EQUAL: + { + RefJavaAST __t145 = _t; + RefJavaAST tmp104_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EQUAL); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t145; + _t = _t->getNextSibling(); + break; + } + case LT_: + { + RefJavaAST __t146 = _t; + RefJavaAST tmp105_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LT_); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t146; + _t = _t->getNextSibling(); + break; + } + case GT: + { + RefJavaAST __t147 = _t; + RefJavaAST tmp106_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GT); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t147; + _t = _t->getNextSibling(); + break; + } + case LE: + { + RefJavaAST __t148 = _t; + RefJavaAST tmp107_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LE); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t148; + _t = _t->getNextSibling(); + break; + } + case GE: + { + RefJavaAST __t149 = _t; + RefJavaAST tmp108_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GE); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t149; + _t = _t->getNextSibling(); + break; + } + case SL: + { + RefJavaAST __t150 = _t; + RefJavaAST tmp109_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SL); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t150; + _t = _t->getNextSibling(); + break; + } + case SR: + { + RefJavaAST __t151 = _t; + RefJavaAST tmp110_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SR); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t151; + _t = _t->getNextSibling(); + break; + } + case BSR: + { + RefJavaAST __t152 = _t; + RefJavaAST tmp111_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BSR); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t152; + _t = _t->getNextSibling(); + break; + } + case PLUS: + { + RefJavaAST __t153 = _t; + RefJavaAST tmp112_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PLUS); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t153; + _t = _t->getNextSibling(); + break; + } + case MINUS: + { + RefJavaAST __t154 = _t; + RefJavaAST tmp113_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MINUS); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t154; + _t = _t->getNextSibling(); + break; + } + case DIV: + { + RefJavaAST __t155 = _t; + RefJavaAST tmp114_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DIV); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t155; + _t = _t->getNextSibling(); + break; + } + case MOD: + { + RefJavaAST __t156 = _t; + RefJavaAST tmp115_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MOD); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t156; + _t = _t->getNextSibling(); + break; + } + case STAR: + { + RefJavaAST __t157 = _t; + RefJavaAST tmp116_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STAR); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t157; + _t = _t->getNextSibling(); + break; + } + case INC: + { + RefJavaAST __t158 = _t; + RefJavaAST tmp117_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INC); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + _t = __t158; + _t = _t->getNextSibling(); + break; + } + case DEC: + { + RefJavaAST __t159 = _t; + RefJavaAST tmp118_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DEC); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + _t = __t159; + _t = _t->getNextSibling(); + break; + } + case POST_INC: + { + RefJavaAST __t160 = _t; + RefJavaAST tmp119_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),POST_INC); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + _t = __t160; + _t = _t->getNextSibling(); + break; + } + case POST_DEC: + { + RefJavaAST __t161 = _t; + RefJavaAST tmp120_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),POST_DEC); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + _t = __t161; + _t = _t->getNextSibling(); + break; + } + case BNOT: + { + RefJavaAST __t162 = _t; + RefJavaAST tmp121_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BNOT); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + _t = __t162; + _t = _t->getNextSibling(); + break; + } + case LNOT: + { + RefJavaAST __t163 = _t; + RefJavaAST tmp122_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LNOT); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + _t = __t163; + _t = _t->getNextSibling(); + break; + } + case LITERAL_instanceof: + { + RefJavaAST __t164 = _t; + RefJavaAST tmp123_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_instanceof); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t164; + _t = _t->getNextSibling(); + break; + } + case UNARY_MINUS: + { + RefJavaAST __t165 = _t; + RefJavaAST tmp124_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),UNARY_MINUS); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + _t = __t165; + _t = _t->getNextSibling(); + break; + } + case UNARY_PLUS: + { + RefJavaAST __t166 = _t; + RefJavaAST tmp125_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),UNARY_PLUS); + _t = _t->getFirstChild(); + expr(_t); + _t = _retTree; + _t = __t166; + _t = _t->getNextSibling(); + break; + } + case TYPE: + case TYPECAST: + case INDEX_OP: + case METHOD_CALL: + case IDENT: + case DOT: + case LITERAL_this: + case LITERAL_super: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + { + primaryExpression(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::primaryExpression(RefJavaAST _t) { + RefJavaAST primaryExpression_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENT: + { + RefJavaAST tmp126_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + break; + } + case DOT: + { + RefJavaAST __t168 = _t; + RefJavaAST tmp127_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT); + _t = _t->getFirstChild(); + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case TYPE: + case TYPECAST: + case INDEX_OP: + case POST_INC: + case POST_DEC: + case METHOD_CALL: + case UNARY_MINUS: + case UNARY_PLUS: + case IDENT: + case DOT: + case STAR: + case LITERAL_this: + case LITERAL_super: + case ASSIGN: + case PLUS_ASSIGN: + case MINUS_ASSIGN: + case STAR_ASSIGN: + case DIV_ASSIGN: + case MOD_ASSIGN: + case SR_ASSIGN: + case BSR_ASSIGN: + case SL_ASSIGN: + case BAND_ASSIGN: + case BXOR_ASSIGN: + case BOR_ASSIGN: + case QUESTION: + case LOR: + case LAND: + case BOR: + case BXOR: + case BAND: + case NOT_EQUAL: + case EQUAL: + case LT_: + case GT: + case LE: + case GE: + case LITERAL_instanceof: + case SL: + case SR: + case BSR: + case PLUS: + case MINUS: + case DIV: + case MOD: + case INC: + case DEC: + case BNOT: + case LNOT: + case LITERAL_true: + case LITERAL_false: + case LITERAL_null: + case LITERAL_new: + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + { + expr(_t); + _t = _retTree; + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENT: + { + RefJavaAST tmp128_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + break; + } + case INDEX_OP: + { + arrayIndex(_t); + _t = _retTree; + break; + } + case LITERAL_this: + { + RefJavaAST tmp129_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_this); + _t = _t->getNextSibling(); + break; + } + case LITERAL_class: + { + RefJavaAST tmp130_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_class); + _t = _t->getNextSibling(); + break; + } + case LITERAL_new: + { + RefJavaAST __t171 = _t; + RefJavaAST tmp131_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_new); + _t = _t->getFirstChild(); + RefJavaAST tmp132_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + elist(_t); + _t = _retTree; + _t = __t171; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + break; + } + case ARRAY_DECLARATOR: + { + RefJavaAST __t172 = _t; + RefJavaAST tmp133_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ARRAY_DECLARATOR); + _t = _t->getFirstChild(); + type(_t); + _t = _retTree; + _t = __t172; + _t = _t->getNextSibling(); + break; + } + case LITERAL_void: + case LITERAL_boolean: + case LITERAL_byte: + case LITERAL_char: + case LITERAL_short: + case LITERAL_int: + case LITERAL_float: + case LITERAL_long: + case LITERAL_double: + { + builtInType(_t); + _t = _retTree; + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case LITERAL_class: + { + RefJavaAST tmp134_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_class); + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t168; + _t = _t->getNextSibling(); + break; + } + case INDEX_OP: + { + arrayIndex(_t); + _t = _retTree; + break; + } + case METHOD_CALL: + { + RefJavaAST __t174 = _t; + RefJavaAST tmp135_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),METHOD_CALL); + _t = _t->getFirstChild(); + primaryExpression(_t); + _t = _retTree; + elist(_t); + _t = _retTree; + _t = __t174; + _t = _t->getNextSibling(); + break; + } + case TYPECAST: + { + RefJavaAST __t175 = _t; + RefJavaAST tmp136_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TYPECAST); + _t = _t->getFirstChild(); + typeSpec(_t); + _t = _retTree; + expr(_t); + _t = _retTree; + _t = __t175; + _t = _t->getNextSibling(); + break; + } + case LITERAL_new: + { + newExpression(_t); + _t = _retTree; + break; + } + case NUM_INT: + case CHAR_LITERAL: + case STRING_LITERAL: + case NUM_FLOAT: + { + constant(_t); + _t = _retTree; + break; + } + case LITERAL_super: + { + RefJavaAST tmp137_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_super); + _t = _t->getNextSibling(); + break; + } + case LITERAL_true: + { + RefJavaAST tmp138_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_true); + _t = _t->getNextSibling(); + break; + } + case LITERAL_false: + { + RefJavaAST tmp139_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_false); + _t = _t->getNextSibling(); + break; + } + case LITERAL_this: + { + RefJavaAST tmp140_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_this); + _t = _t->getNextSibling(); + break; + } + case LITERAL_null: + { + RefJavaAST tmp141_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_null); + _t = _t->getNextSibling(); + break; + } + case TYPE: + { + typeSpec(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::arrayIndex(RefJavaAST _t) { + RefJavaAST arrayIndex_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t177 = _t; + RefJavaAST tmp142_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INDEX_OP); + _t = _t->getFirstChild(); + primaryExpression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t177; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::newExpression(RefJavaAST _t) { + RefJavaAST newExpression_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t180 = _t; + RefJavaAST tmp143_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LITERAL_new); + _t = _t->getFirstChild(); + type(_t); + _t = _retTree; + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARRAY_DECLARATOR: + { + newArrayDeclarator(_t); + _t = _retTree; + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARRAY_INIT: + { + arrayInitializer(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + break; + } + case ELIST: + { + elist(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t180; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::constant(RefJavaAST _t) { + RefJavaAST constant_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case NUM_INT: + { + RefJavaAST tmp144_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_INT); + _t = _t->getNextSibling(); + break; + } + case CHAR_LITERAL: + { + RefJavaAST tmp145_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CHAR_LITERAL); + _t = _t->getNextSibling(); + break; + } + case STRING_LITERAL: + { + RefJavaAST tmp146_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STRING_LITERAL); + _t = _t->getNextSibling(); + break; + } + case NUM_FLOAT: + { + RefJavaAST tmp147_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_FLOAT); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::newArrayDeclarator(RefJavaAST _t) { + RefJavaAST newArrayDeclarator_AST_in = (_t == RefJavaAST(ASTNULL)) ? RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefJavaAST __t184 = _t; + RefJavaAST tmp148_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ARRAY_DECLARATOR); + _t = _t->getFirstChild(); + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARRAY_DECLARATOR: + { + newArrayDeclarator(_t); + _t = _retTree; + break; + } + case 3: + case EXPR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + { + if (_t == RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case EXPR: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t184; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefJavaAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void JavaStoreWalker::initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& ) +{ +} +const char* JavaStoreWalker::tokenNames[] = { + "<0>", + "EOF", + "<2>", + "NULL_TREE_LOOKAHEAD", + "BLOCK", + "MODIFIERS", + "OBJBLOCK", + "SLIST", + "CTOR_DEF", + "METHOD_DEF", + "VARIABLE_DEF", + "INSTANCE_INIT", + "STATIC_INIT", + "TYPE", + "CLASS_DEF", + "INTERFACE_DEF", + "PACKAGE_DEF", + "ARRAY_DECLARATOR", + "EXTENDS_CLAUSE", + "IMPLEMENTS_CLAUSE", + "PARAMETERS", + "PARAMETER_DEF", + "LABELED_STAT", + "TYPECAST", + "INDEX_OP", + "POST_INC", + "POST_DEC", + "METHOD_CALL", + "EXPR", + "ARRAY_INIT", + "IMPORT", + "UNARY_MINUS", + "UNARY_PLUS", + "CASE_GROUP", + "ELIST", + "FOR_INIT", + "FOR_CONDITION", + "FOR_ITERATOR", + "EMPTY_STAT", + "\"final\"", + "\"abstract\"", + "\"strictfp\"", + "SUPER_CTOR_CALL", + "CTOR_CALL", + "\"package\"", + "SEMI", + "\"import\"", + "LBRACK", + "RBRACK", + "\"void\"", + "\"boolean\"", + "\"byte\"", + "\"char\"", + "\"short\"", + "\"int\"", + "\"float\"", + "\"long\"", + "\"double\"", + "IDENT", + "DOT", + "STAR", + "\"private\"", + "\"public\"", + "\"protected\"", + "\"static\"", + "\"transient\"", + "\"native\"", + "\"threadsafe\"", + "\"synchronized\"", + "\"volatile\"", + "\"class\"", + "\"extends\"", + "\"interface\"", + "LCURLY", + "RCURLY", + "COMMA", + "\"implements\"", + "LPAREN", + "RPAREN", + "\"this\"", + "\"super\"", + "ASSIGN", + "\"throws\"", + "COLON", + "\"if\"", + "\"else\"", + "\"for\"", + "\"while\"", + "\"do\"", + "\"break\"", + "\"continue\"", + "\"return\"", + "\"switch\"", + "\"throw\"", + "\"case\"", + "\"default\"", + "\"try\"", + "\"finally\"", + "\"catch\"", + "PLUS_ASSIGN", + "MINUS_ASSIGN", + "STAR_ASSIGN", + "DIV_ASSIGN", + "MOD_ASSIGN", + "SR_ASSIGN", + "BSR_ASSIGN", + "SL_ASSIGN", + "BAND_ASSIGN", + "BXOR_ASSIGN", + "BOR_ASSIGN", + "QUESTION", + "LOR", + "LAND", + "BOR", + "BXOR", + "BAND", + "NOT_EQUAL", + "EQUAL", + "LT_", + "GT", + "LE", + "GE", + "\"instanceof\"", + "SL", + "SR", + "BSR", + "PLUS", + "MINUS", + "DIV", + "MOD", + "INC", + "DEC", + "BNOT", + "LNOT", + "\"true\"", + "\"false\"", + "\"null\"", + "\"new\"", + "NUM_INT", + "CHAR_LITERAL", + "STRING_LITERAL", + "NUM_FLOAT", + "NUM_LONG", + "NUM_DOUBLE", + "WS", + "SL_COMMENT", + "ML_COMMENT", + "ESC", + "HEX_DIGIT", + "VOCAB", + "EXPONENT", + "FLOAT_SUFFIX", + "\"const\"", + 0 +}; + +const unsigned long JavaStoreWalker::_tokenSet_0_data_[] = { 0UL, 3758096768UL, 63UL, 0UL, 16777216UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "final" "abstract" "private" "public" "protected" "static" "transient" +// "native" "threadsafe" "synchronized" "volatile" "const" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaStoreWalker::_tokenSet_0(_tokenSet_0_data_,12); +const unsigned long JavaStoreWalker::_tokenSet_1_data_[] = { 272680064UL, 64UL, 1070596112UL, 1UL, 0UL, 0UL, 0UL, 0UL }; +// SLIST VARIABLE_DEF CLASS_DEF INTERFACE_DEF LABELED_STAT EXPR EMPTY_STAT +// "synchronized" "if" "for" "while" "do" "break" "continue" "return" "switch" +// "throw" "try" +const ANTLR_USE_NAMESPACE(antlr)BitSet JavaStoreWalker::_tokenSet_1(_tokenSet_1_data_,8); + + diff --git a/languages/java/JavaStoreWalker.hpp b/languages/java/JavaStoreWalker.hpp new file mode 100644 index 00000000..ed43efcc --- /dev/null +++ b/languages/java/JavaStoreWalker.hpp @@ -0,0 +1,164 @@ +#ifndef INC_JavaStoreWalker_hpp_ +#define INC_JavaStoreWalker_hpp_ + +#line 3 "java.store.g" + + #include <codemodel.h> + #include "JavaAST.hpp" + + #include <qstring.h> + #include <qstringlist.h> + #include <qvaluestack.h> + #include <qfileinfo.h> + +#line 15 "JavaStoreWalker.hpp" +#include <antlr/config.hpp> +#include "JavaStoreWalkerTokenTypes.hpp" +/* $ANTLR 2.7.7 (20061129): "java.store.g" -> "JavaStoreWalker.hpp"$ */ +#include <antlr/TreeParser.hpp> + +#line 13 "java.store.g" + + #include <codemodel.h> + + #include <kdebug.h> + +#line 27 "JavaStoreWalker.hpp" +/** Java 1.2 AST Recognizer Grammar + * + * Author: + * Terence Parr parrt@magelang.com + * + * Version tracking now done with following ID: + * + * $Id$ + * + * This grammar is in the PUBLIC DOMAIN + * + * BUGS + */ +class CUSTOM_API JavaStoreWalker : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public JavaStoreWalkerTokenTypes +{ +#line 43 "java.store.g" + +private: + QStringList m_currentScope; + CodeModel* m_model; + FileDom m_file; + QValueStack<ClassDom> m_currentClass; + int m_currentAccess; + int m_anon; + ANTLR_USE_NAMESPACE(antlr)JavaASTFactory ast_factory; + +public: + void setCodeModel( CodeModel* model ) + { + m_model = model; + } + + void setFile( FileDom file ) + { + m_file = file; + } + + void init() + { + m_currentScope.clear(); + m_currentAccess = CodeModelItem::Public; + m_anon = 0; + + initializeASTFactory (ast_factory); + setASTFactory (&ast_factory); + } +#line 44 "JavaStoreWalker.hpp" +public: + JavaStoreWalker(); + static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); + int getNumTokens() const + { + return JavaStoreWalker::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return JavaStoreWalker::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return JavaStoreWalker::tokenNames; + } + public: void compilationUnit(RefJavaAST _t); + public: QString packageDefinition(RefJavaAST _t); + public: QString importDefinition(RefJavaAST _t); + public: void typeDefinition(RefJavaAST _t); + public: QString identifier(RefJavaAST _t); + public: QString identifierStar(RefJavaAST _t); + public: QStringList modifiers(RefJavaAST _t); + public: QStringList extendsClause(RefJavaAST _t); + public: QStringList implementsClause(RefJavaAST _t); + public: void objBlock(RefJavaAST _t, + ClassDom klass + ); + public: void interfaceBlock(RefJavaAST _t, + ClassDom klass + ); + public: QString typeSpec(RefJavaAST _t); + public: QString typeSpecArray(RefJavaAST _t); + public: QString type(RefJavaAST _t); + public: void builtInType(RefJavaAST _t); + public: void modifier(RefJavaAST _t); + public: FunctionDom methodDecl(RefJavaAST _t); + public: VariableDom variableDef(RefJavaAST _t); + public: FunctionDom ctorDef(RefJavaAST _t); + public: FunctionDom methodDef(RefJavaAST _t); + public: void slist(RefJavaAST _t); + public: void methodHead(RefJavaAST _t, + FunctionDom meth + ); + public: void variableDeclarator(RefJavaAST _t, + VariableDom attr + ); + public: void varInitializer(RefJavaAST _t); + public: ArgumentDom parameterDef(RefJavaAST _t); + public: void objectinitializer(RefJavaAST _t); + public: void initializer(RefJavaAST _t); + public: void expression(RefJavaAST _t); + public: void arrayInitializer(RefJavaAST _t); + public: void throwsClause(RefJavaAST _t); + public: void stat(RefJavaAST _t); + public: void elist(RefJavaAST _t); + public: void caseGroup(RefJavaAST _t); + public: void tryBlock(RefJavaAST _t); + public: void handler(RefJavaAST _t); + public: void expr(RefJavaAST _t); + public: void primaryExpression(RefJavaAST _t); + public: void arrayIndex(RefJavaAST _t); + public: void newExpression(RefJavaAST _t); + public: void constant(RefJavaAST _t); + public: void newArrayDeclarator(RefJavaAST _t); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefJavaAST returnAST; + RefJavaAST _retTree; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 153; +#else + enum { + NUM_TOKENS = 153 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; +}; + +#endif /*INC_JavaStoreWalker_hpp_*/ diff --git a/languages/java/JavaStoreWalkerTokenTypes.hpp b/languages/java/JavaStoreWalkerTokenTypes.hpp new file mode 100644 index 00000000..44322944 --- /dev/null +++ b/languages/java/JavaStoreWalkerTokenTypes.hpp @@ -0,0 +1,169 @@ +#ifndef INC_JavaStoreWalkerTokenTypes_hpp_ +#define INC_JavaStoreWalkerTokenTypes_hpp_ + +/* $ANTLR 2.7.7 (20061129): "java.store.g" -> "JavaStoreWalkerTokenTypes.hpp"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API JavaStoreWalkerTokenTypes { +#endif + enum { + EOF_ = 1, + BLOCK = 4, + MODIFIERS = 5, + OBJBLOCK = 6, + SLIST = 7, + CTOR_DEF = 8, + METHOD_DEF = 9, + VARIABLE_DEF = 10, + INSTANCE_INIT = 11, + STATIC_INIT = 12, + TYPE = 13, + CLASS_DEF = 14, + INTERFACE_DEF = 15, + PACKAGE_DEF = 16, + ARRAY_DECLARATOR = 17, + EXTENDS_CLAUSE = 18, + IMPLEMENTS_CLAUSE = 19, + PARAMETERS = 20, + PARAMETER_DEF = 21, + LABELED_STAT = 22, + TYPECAST = 23, + INDEX_OP = 24, + POST_INC = 25, + POST_DEC = 26, + METHOD_CALL = 27, + EXPR = 28, + ARRAY_INIT = 29, + IMPORT = 30, + UNARY_MINUS = 31, + UNARY_PLUS = 32, + CASE_GROUP = 33, + ELIST = 34, + FOR_INIT = 35, + FOR_CONDITION = 36, + FOR_ITERATOR = 37, + EMPTY_STAT = 38, + FINAL = 39, + ABSTRACT = 40, + STRICTFP = 41, + SUPER_CTOR_CALL = 42, + CTOR_CALL = 43, + LITERAL_package = 44, + SEMI = 45, + LITERAL_import = 46, + LBRACK = 47, + RBRACK = 48, + LITERAL_void = 49, + LITERAL_boolean = 50, + LITERAL_byte = 51, + LITERAL_char = 52, + LITERAL_short = 53, + LITERAL_int = 54, + LITERAL_float = 55, + LITERAL_long = 56, + LITERAL_double = 57, + IDENT = 58, + DOT = 59, + STAR = 60, + LITERAL_private = 61, + LITERAL_public = 62, + LITERAL_protected = 63, + LITERAL_static = 64, + LITERAL_transient = 65, + LITERAL_native = 66, + LITERAL_threadsafe = 67, + LITERAL_synchronized = 68, + LITERAL_volatile = 69, + LITERAL_class = 70, + LITERAL_extends = 71, + LITERAL_interface = 72, + LCURLY = 73, + RCURLY = 74, + COMMA = 75, + LITERAL_implements = 76, + LPAREN = 77, + RPAREN = 78, + LITERAL_this = 79, + LITERAL_super = 80, + ASSIGN = 81, + LITERAL_throws = 82, + COLON = 83, + LITERAL_if = 84, + LITERAL_else = 85, + LITERAL_for = 86, + LITERAL_while = 87, + LITERAL_do = 88, + LITERAL_break = 89, + LITERAL_continue = 90, + LITERAL_return = 91, + LITERAL_switch = 92, + LITERAL_throw = 93, + LITERAL_case = 94, + LITERAL_default = 95, + LITERAL_try = 96, + LITERAL_finally = 97, + LITERAL_catch = 98, + PLUS_ASSIGN = 99, + MINUS_ASSIGN = 100, + STAR_ASSIGN = 101, + DIV_ASSIGN = 102, + MOD_ASSIGN = 103, + SR_ASSIGN = 104, + BSR_ASSIGN = 105, + SL_ASSIGN = 106, + BAND_ASSIGN = 107, + BXOR_ASSIGN = 108, + BOR_ASSIGN = 109, + QUESTION = 110, + LOR = 111, + LAND = 112, + BOR = 113, + BXOR = 114, + BAND = 115, + NOT_EQUAL = 116, + EQUAL = 117, + LT_ = 118, + GT = 119, + LE = 120, + GE = 121, + LITERAL_instanceof = 122, + SL = 123, + SR = 124, + BSR = 125, + PLUS = 126, + MINUS = 127, + DIV = 128, + MOD = 129, + INC = 130, + DEC = 131, + BNOT = 132, + LNOT = 133, + LITERAL_true = 134, + LITERAL_false = 135, + LITERAL_null = 136, + LITERAL_new = 137, + NUM_INT = 138, + CHAR_LITERAL = 139, + STRING_LITERAL = 140, + NUM_FLOAT = 141, + NUM_LONG = 142, + NUM_DOUBLE = 143, + WS = 144, + SL_COMMENT = 145, + ML_COMMENT = 146, + ESC = 147, + HEX_DIGIT = 148, + VOCAB = 149, + EXPONENT = 150, + FLOAT_SUFFIX = 151, + LITERAL_const = 152, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_JavaStoreWalkerTokenTypes_hpp_*/ diff --git a/languages/java/JavaStoreWalkerTokenTypes.txt b/languages/java/JavaStoreWalkerTokenTypes.txt new file mode 100644 index 00000000..c81c4b44 --- /dev/null +++ b/languages/java/JavaStoreWalkerTokenTypes.txt @@ -0,0 +1,151 @@ +// $ANTLR 2.7.7 (20061129): java.store.g -> JavaStoreWalkerTokenTypes.txt$ +JavaStoreWalker // output token vocab name +BLOCK=4 +MODIFIERS=5 +OBJBLOCK=6 +SLIST=7 +CTOR_DEF=8 +METHOD_DEF=9 +VARIABLE_DEF=10 +INSTANCE_INIT=11 +STATIC_INIT=12 +TYPE=13 +CLASS_DEF=14 +INTERFACE_DEF=15 +PACKAGE_DEF=16 +ARRAY_DECLARATOR=17 +EXTENDS_CLAUSE=18 +IMPLEMENTS_CLAUSE=19 +PARAMETERS=20 +PARAMETER_DEF=21 +LABELED_STAT=22 +TYPECAST=23 +INDEX_OP=24 +POST_INC=25 +POST_DEC=26 +METHOD_CALL=27 +EXPR=28 +ARRAY_INIT=29 +IMPORT=30 +UNARY_MINUS=31 +UNARY_PLUS=32 +CASE_GROUP=33 +ELIST=34 +FOR_INIT=35 +FOR_CONDITION=36 +FOR_ITERATOR=37 +EMPTY_STAT=38 +FINAL="final"=39 +ABSTRACT="abstract"=40 +STRICTFP="strictfp"=41 +SUPER_CTOR_CALL=42 +CTOR_CALL=43 +LITERAL_package="package"=44 +SEMI=45 +LITERAL_import="import"=46 +LBRACK=47 +RBRACK=48 +LITERAL_void="void"=49 +LITERAL_boolean="boolean"=50 +LITERAL_byte="byte"=51 +LITERAL_char="char"=52 +LITERAL_short="short"=53 +LITERAL_int="int"=54 +LITERAL_float="float"=55 +LITERAL_long="long"=56 +LITERAL_double="double"=57 +IDENT=58 +DOT=59 +STAR=60 +LITERAL_private="private"=61 +LITERAL_public="public"=62 +LITERAL_protected="protected"=63 +LITERAL_static="static"=64 +LITERAL_transient="transient"=65 +LITERAL_native="native"=66 +LITERAL_threadsafe="threadsafe"=67 +LITERAL_synchronized="synchronized"=68 +LITERAL_volatile="volatile"=69 +LITERAL_class="class"=70 +LITERAL_extends="extends"=71 +LITERAL_interface="interface"=72 +LCURLY=73 +RCURLY=74 +COMMA=75 +LITERAL_implements="implements"=76 +LPAREN=77 +RPAREN=78 +LITERAL_this="this"=79 +LITERAL_super="super"=80 +ASSIGN=81 +LITERAL_throws="throws"=82 +COLON=83 +LITERAL_if="if"=84 +LITERAL_else="else"=85 +LITERAL_for="for"=86 +LITERAL_while="while"=87 +LITERAL_do="do"=88 +LITERAL_break="break"=89 +LITERAL_continue="continue"=90 +LITERAL_return="return"=91 +LITERAL_switch="switch"=92 +LITERAL_throw="throw"=93 +LITERAL_case="case"=94 +LITERAL_default="default"=95 +LITERAL_try="try"=96 +LITERAL_finally="finally"=97 +LITERAL_catch="catch"=98 +PLUS_ASSIGN=99 +MINUS_ASSIGN=100 +STAR_ASSIGN=101 +DIV_ASSIGN=102 +MOD_ASSIGN=103 +SR_ASSIGN=104 +BSR_ASSIGN=105 +SL_ASSIGN=106 +BAND_ASSIGN=107 +BXOR_ASSIGN=108 +BOR_ASSIGN=109 +QUESTION=110 +LOR=111 +LAND=112 +BOR=113 +BXOR=114 +BAND=115 +NOT_EQUAL=116 +EQUAL=117 +LT_=118 +GT=119 +LE=120 +GE=121 +LITERAL_instanceof="instanceof"=122 +SL=123 +SR=124 +BSR=125 +PLUS=126 +MINUS=127 +DIV=128 +MOD=129 +INC=130 +DEC=131 +BNOT=132 +LNOT=133 +LITERAL_true="true"=134 +LITERAL_false="false"=135 +LITERAL_null="null"=136 +LITERAL_new="new"=137 +NUM_INT=138 +CHAR_LITERAL=139 +STRING_LITERAL=140 +NUM_FLOAT=141 +NUM_LONG=142 +NUM_DOUBLE=143 +WS=144 +SL_COMMENT=145 +ML_COMMENT=146 +ESC=147 +HEX_DIGIT=148 +VOCAB=149 +EXPONENT=150 +FLOAT_SUFFIX=151 +LITERAL_const="const"=152 diff --git a/languages/java/JavaTokenTypes.hpp b/languages/java/JavaTokenTypes.hpp new file mode 100644 index 00000000..e36fa54c --- /dev/null +++ b/languages/java/JavaTokenTypes.hpp @@ -0,0 +1,168 @@ +#ifndef INC_JavaTokenTypes_hpp_ +#define INC_JavaTokenTypes_hpp_ + +/* $ANTLR 2.7.7 (20061129): "java.g" -> "JavaTokenTypes.hpp"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API JavaTokenTypes { +#endif + enum { + EOF_ = 1, + BLOCK = 4, + MODIFIERS = 5, + OBJBLOCK = 6, + SLIST = 7, + CTOR_DEF = 8, + METHOD_DEF = 9, + VARIABLE_DEF = 10, + INSTANCE_INIT = 11, + STATIC_INIT = 12, + TYPE = 13, + CLASS_DEF = 14, + INTERFACE_DEF = 15, + PACKAGE_DEF = 16, + ARRAY_DECLARATOR = 17, + EXTENDS_CLAUSE = 18, + IMPLEMENTS_CLAUSE = 19, + PARAMETERS = 20, + PARAMETER_DEF = 21, + LABELED_STAT = 22, + TYPECAST = 23, + INDEX_OP = 24, + POST_INC = 25, + POST_DEC = 26, + METHOD_CALL = 27, + EXPR = 28, + ARRAY_INIT = 29, + IMPORT = 30, + UNARY_MINUS = 31, + UNARY_PLUS = 32, + CASE_GROUP = 33, + ELIST = 34, + FOR_INIT = 35, + FOR_CONDITION = 36, + FOR_ITERATOR = 37, + EMPTY_STAT = 38, + FINAL = 39, + ABSTRACT = 40, + STRICTFP = 41, + SUPER_CTOR_CALL = 42, + CTOR_CALL = 43, + LITERAL_package = 44, + SEMI = 45, + LITERAL_import = 46, + LBRACK = 47, + RBRACK = 48, + LITERAL_void = 49, + LITERAL_boolean = 50, + LITERAL_byte = 51, + LITERAL_char = 52, + LITERAL_short = 53, + LITERAL_int = 54, + LITERAL_float = 55, + LITERAL_long = 56, + LITERAL_double = 57, + IDENT = 58, + DOT = 59, + STAR = 60, + LITERAL_private = 61, + LITERAL_public = 62, + LITERAL_protected = 63, + LITERAL_static = 64, + LITERAL_transient = 65, + LITERAL_native = 66, + LITERAL_threadsafe = 67, + LITERAL_synchronized = 68, + LITERAL_volatile = 69, + LITERAL_class = 70, + LITERAL_extends = 71, + LITERAL_interface = 72, + LCURLY = 73, + RCURLY = 74, + COMMA = 75, + LITERAL_implements = 76, + LPAREN = 77, + RPAREN = 78, + LITERAL_this = 79, + LITERAL_super = 80, + ASSIGN = 81, + LITERAL_throws = 82, + COLON = 83, + LITERAL_if = 84, + LITERAL_else = 85, + LITERAL_for = 86, + LITERAL_while = 87, + LITERAL_do = 88, + LITERAL_break = 89, + LITERAL_continue = 90, + LITERAL_return = 91, + LITERAL_switch = 92, + LITERAL_throw = 93, + LITERAL_case = 94, + LITERAL_default = 95, + LITERAL_try = 96, + LITERAL_finally = 97, + LITERAL_catch = 98, + PLUS_ASSIGN = 99, + MINUS_ASSIGN = 100, + STAR_ASSIGN = 101, + DIV_ASSIGN = 102, + MOD_ASSIGN = 103, + SR_ASSIGN = 104, + BSR_ASSIGN = 105, + SL_ASSIGN = 106, + BAND_ASSIGN = 107, + BXOR_ASSIGN = 108, + BOR_ASSIGN = 109, + QUESTION = 110, + LOR = 111, + LAND = 112, + BOR = 113, + BXOR = 114, + BAND = 115, + NOT_EQUAL = 116, + EQUAL = 117, + LT_ = 118, + GT = 119, + LE = 120, + GE = 121, + LITERAL_instanceof = 122, + SL = 123, + SR = 124, + BSR = 125, + PLUS = 126, + MINUS = 127, + DIV = 128, + MOD = 129, + INC = 130, + DEC = 131, + BNOT = 132, + LNOT = 133, + LITERAL_true = 134, + LITERAL_false = 135, + LITERAL_null = 136, + LITERAL_new = 137, + NUM_INT = 138, + CHAR_LITERAL = 139, + STRING_LITERAL = 140, + NUM_FLOAT = 141, + NUM_LONG = 142, + NUM_DOUBLE = 143, + WS = 144, + SL_COMMENT = 145, + ML_COMMENT = 146, + ESC = 147, + HEX_DIGIT = 148, + VOCAB = 149, + EXPONENT = 150, + FLOAT_SUFFIX = 151, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_JavaTokenTypes_hpp_*/ diff --git a/languages/java/JavaTokenTypes.txt b/languages/java/JavaTokenTypes.txt new file mode 100644 index 00000000..48ff0ca3 --- /dev/null +++ b/languages/java/JavaTokenTypes.txt @@ -0,0 +1,150 @@ +// $ANTLR 2.7.7 (20061129): java.g -> JavaTokenTypes.txt$ +Java // output token vocab name +BLOCK=4 +MODIFIERS=5 +OBJBLOCK=6 +SLIST=7 +CTOR_DEF=8 +METHOD_DEF=9 +VARIABLE_DEF=10 +INSTANCE_INIT=11 +STATIC_INIT=12 +TYPE=13 +CLASS_DEF=14 +INTERFACE_DEF=15 +PACKAGE_DEF=16 +ARRAY_DECLARATOR=17 +EXTENDS_CLAUSE=18 +IMPLEMENTS_CLAUSE=19 +PARAMETERS=20 +PARAMETER_DEF=21 +LABELED_STAT=22 +TYPECAST=23 +INDEX_OP=24 +POST_INC=25 +POST_DEC=26 +METHOD_CALL=27 +EXPR=28 +ARRAY_INIT=29 +IMPORT=30 +UNARY_MINUS=31 +UNARY_PLUS=32 +CASE_GROUP=33 +ELIST=34 +FOR_INIT=35 +FOR_CONDITION=36 +FOR_ITERATOR=37 +EMPTY_STAT=38 +FINAL="final"=39 +ABSTRACT="abstract"=40 +STRICTFP="strictfp"=41 +SUPER_CTOR_CALL=42 +CTOR_CALL=43 +LITERAL_package="package"=44 +SEMI=45 +LITERAL_import="import"=46 +LBRACK=47 +RBRACK=48 +LITERAL_void="void"=49 +LITERAL_boolean="boolean"=50 +LITERAL_byte="byte"=51 +LITERAL_char="char"=52 +LITERAL_short="short"=53 +LITERAL_int="int"=54 +LITERAL_float="float"=55 +LITERAL_long="long"=56 +LITERAL_double="double"=57 +IDENT=58 +DOT=59 +STAR=60 +LITERAL_private="private"=61 +LITERAL_public="public"=62 +LITERAL_protected="protected"=63 +LITERAL_static="static"=64 +LITERAL_transient="transient"=65 +LITERAL_native="native"=66 +LITERAL_threadsafe="threadsafe"=67 +LITERAL_synchronized="synchronized"=68 +LITERAL_volatile="volatile"=69 +LITERAL_class="class"=70 +LITERAL_extends="extends"=71 +LITERAL_interface="interface"=72 +LCURLY=73 +RCURLY=74 +COMMA=75 +LITERAL_implements="implements"=76 +LPAREN=77 +RPAREN=78 +LITERAL_this="this"=79 +LITERAL_super="super"=80 +ASSIGN=81 +LITERAL_throws="throws"=82 +COLON=83 +LITERAL_if="if"=84 +LITERAL_else="else"=85 +LITERAL_for="for"=86 +LITERAL_while="while"=87 +LITERAL_do="do"=88 +LITERAL_break="break"=89 +LITERAL_continue="continue"=90 +LITERAL_return="return"=91 +LITERAL_switch="switch"=92 +LITERAL_throw="throw"=93 +LITERAL_case="case"=94 +LITERAL_default="default"=95 +LITERAL_try="try"=96 +LITERAL_finally="finally"=97 +LITERAL_catch="catch"=98 +PLUS_ASSIGN=99 +MINUS_ASSIGN=100 +STAR_ASSIGN=101 +DIV_ASSIGN=102 +MOD_ASSIGN=103 +SR_ASSIGN=104 +BSR_ASSIGN=105 +SL_ASSIGN=106 +BAND_ASSIGN=107 +BXOR_ASSIGN=108 +BOR_ASSIGN=109 +QUESTION=110 +LOR=111 +LAND=112 +BOR=113 +BXOR=114 +BAND=115 +NOT_EQUAL=116 +EQUAL=117 +LT_=118 +GT=119 +LE=120 +GE=121 +LITERAL_instanceof="instanceof"=122 +SL=123 +SR=124 +BSR=125 +PLUS=126 +MINUS=127 +DIV=128 +MOD=129 +INC=130 +DEC=131 +BNOT=132 +LNOT=133 +LITERAL_true="true"=134 +LITERAL_false="false"=135 +LITERAL_null="null"=136 +LITERAL_new="new"=137 +NUM_INT=138 +CHAR_LITERAL=139 +STRING_LITERAL=140 +NUM_FLOAT=141 +NUM_LONG=142 +NUM_DOUBLE=143 +WS=144 +SL_COMMENT=145 +ML_COMMENT=146 +ESC=147 +HEX_DIGIT=148 +VOCAB=149 +EXPONENT=150 +FLOAT_SUFFIX=151 diff --git a/languages/java/KDevJavaSupportIface.cpp b/languages/java/KDevJavaSupportIface.cpp new file mode 100644 index 00000000..306ad76e --- /dev/null +++ b/languages/java/KDevJavaSupportIface.cpp @@ -0,0 +1,24 @@ + +#include "KDevJavaSupportIface.h" +#include "javasupportpart.h" + +KDevJavaSupportIface::KDevJavaSupportIface( JavaSupportPart* javaSupport ) + : QObject( javaSupport ), DCOPObject( "KDevJavaSupport" ), m_javaSupport( javaSupport ) +{ +} + +KDevJavaSupportIface::~KDevJavaSupportIface() +{ +} + +void KDevJavaSupportIface::addClass() +{ + m_javaSupport->slotNewClass(); +} + +void KDevJavaSupportIface::parseProject() +{ + m_javaSupport->parseProject(); +} + +#include "KDevJavaSupportIface.moc" diff --git a/languages/java/KDevJavaSupportIface.h b/languages/java/KDevJavaSupportIface.h new file mode 100644 index 00000000..e0dce53f --- /dev/null +++ b/languages/java/KDevJavaSupportIface.h @@ -0,0 +1,26 @@ + +#ifndef KDEVJAVASUPPORTIFACE_H +#define KDEVJAVASUPPORTIFACE_H + +#include <qobject.h> +#include <dcopobject.h> + +class JavaSupportPart; + +class KDevJavaSupportIface : public QObject, public DCOPObject +{ + Q_OBJECT + K_DCOP +public: + KDevJavaSupportIface( JavaSupportPart* javaSupport ); + ~KDevJavaSupportIface(); + +k_dcop: + void addClass(); + void parseProject(); + +private: + JavaSupportPart* m_javaSupport; +}; + +#endif diff --git a/languages/java/Makefile.am b/languages/java/Makefile.am new file mode 100644 index 00000000..386f220f --- /dev/null +++ b/languages/java/Makefile.am @@ -0,0 +1,37 @@ +# Here resides the Java support part. + +KDE_CXXFLAGS = $(USE_EXCEPTIONS) + +# SUBDIRS = templates subclassing_template newclass_templates file_templates +SUBDIRS = file_templates app_templates doc + +INCLUDES = -I$(top_srcdir)/lib/antlr -I$(top_srcdir)/lib/catalog \ + -I$(top_srcdir)/lib/compat -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \ + $(all_includes) + +kde_module_LTLIBRARIES = libkdevjavasupport.la +libkdevjavasupport_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevjavasupport_la_LIBADD = $(top_builddir)/lib/libkdevelop.la $(top_builddir)/lib/antlr/src/libantlr.la $(top_builddir)/lib/catalog/libkdevcatalog.la + +libkdevjavasupport_la_SOURCES = JavaLexer.cpp KDevJavaSupportIface.cpp javasupportfactory.cpp \ +JavaRecognizer.cpp backgroundparser.cpp configproblemreporter.ui javasupportpart.cpp \ +JavaStoreWalker.cpp javasupport_utils.cpp problemreporter.cpp driver.cpp kdevdriver.cpp KDevJavaSupportIface.skel + + +EXTRA_DIST = java.g java.tree.g java.store.g + + +#JavaLexer.hpp JavaLexer.cpp JavaRecognizer.hpp JavaRecognizer.cpp: # java.g +# antlr java.g + +#JavaStoreWalker.hpp JavaStoreWalker.cpp: # java.store.g +# antlr java.store.g + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevjavasupport.desktop + +rcdir = $(kde_datadir)/kdevjavasupport +rc_DATA = kdevjavasupport.rc diff --git a/languages/java/README.dox b/languages/java/README.dox new file mode 100644 index 00000000..49af1e43 --- /dev/null +++ b/languages/java/README.dox @@ -0,0 +1,48 @@ +/** \class JavaSupportPart +This is Java language support plugin. + +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +<code>This is code</code>, html links <a href="http://somelocation">link text</a>, +and images. + +\authors <a href="mailto:jonas.nordin AT syncom.se">Jonas Nordin</a> Copyright (C) 1999 +\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a> Copyright (C) 2000-2001 +\authors <a href="mailto:roberto AT kdevelop.org">Roberto Raggi</a> Copyright (C) 2002-2003 + +\maintainer <a href="mailto:roberto AT kdevelop.org">Roberto Raggi</a> Copyright (C) 2002-2003 + +\feature Java language support +\feature Consult \ref LangSupportStatus for a up to date features/status of this programming language support part. + +\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=javasupport&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">javasupport component at Bugzilla database</a> +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq <b>First frequenly asked question about your part ?</b> Answer. +\faq <b>Second frequenly asked question about your part ?</b> Answer. +... +\faq <b>Last frequenly asked question about your part ?</b> Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/languages/java/app_templates/Makefile.am b/languages/java/app_templates/Makefile.am new file mode 100644 index 00000000..b47abfca --- /dev/null +++ b/languages/java/app_templates/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = javahello kappjava superwaba +profilesdir = $(kde_datadir)/kdevelop/profiles/IDE/CompiledLanguageIDE/JavaIDE +profiles_DATA = java.appwizard diff --git a/languages/java/app_templates/java.appwizard b/languages/java/app_templates/java.appwizard new file mode 100644 index 00000000..087d6c0c --- /dev/null +++ b/languages/java/app_templates/java.appwizard @@ -0,0 +1,2 @@ +[General] +List=javahello,kappjava,superwaba diff --git a/languages/java/app_templates/javahello/.kdev_ignore b/languages/java/app_templates/javahello/.kdev_ignore new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/languages/java/app_templates/javahello/.kdev_ignore diff --git a/languages/java/app_templates/javahello/Main.java b/languages/java/app_templates/javahello/Main.java new file mode 100644 index 00000000..dc757fe5 --- /dev/null +++ b/languages/java/app_templates/javahello/Main.java @@ -0,0 +1,7 @@ + +class Main{ + + public static void main( String[] args ){ + System.out.println( "Hello, world!" ); + } +} diff --git a/languages/java/app_templates/javahello/Makefile.am b/languages/java/app_templates/javahello/Makefile.am new file mode 100644 index 00000000..8551a6ac --- /dev/null +++ b/languages/java/app_templates/javahello/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = Main.java build.xml javahello.filelist javahello.kdevelop +templateName= javahello + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz
\ No newline at end of file diff --git a/languages/java/app_templates/javahello/build.xml b/languages/java/app_templates/javahello/build.xml new file mode 100644 index 00000000..27b6046d --- /dev/null +++ b/languages/java/app_templates/javahello/build.xml @@ -0,0 +1,37 @@ +<project name="%{APPNAME}" default="dist" basedir="."> + <description> + hello application + </description> + <!-- set global properties for this build --> + <property name="src" location="." /> + <property name="build" location="build" /> + <property name="dist" location="dist" /> + + <target name="init"> + <!-- Create the time stamp --> + <tstamp/> + <!-- Create the build directory structure used by compile --> + <mkdir dir="${build}"/> + </target> + + <target name="compile" depends="init" + description="compile the source " > + <!-- Compile the java code from ${src} into ${build} --> + <javac srcdir="${src}" destdir="${build}"/> + </target> + + <target name="dist" depends="compile" + description="generate the distribution" > + <!-- Create the distribution directory --> + <mkdir dir="${dist}/lib"/> + + <jar jarfile="${dist}/lib/%{APPNAMELC}.jar" basedir="${build}"/> + </target> + + <target name="clean" + description="clean up" > + <!-- Delete the ${build} and ${dist} directory trees --> + <delete dir="${build}"/> + <delete dir="${dist}"/> + </target> +</project> diff --git a/languages/java/app_templates/javahello/javahello b/languages/java/app_templates/javahello/javahello new file mode 100644 index 00000000..a2225ce5 --- /dev/null +++ b/languages/java/app_templates/javahello/javahello @@ -0,0 +1,11 @@ +# Java application +[General] +Name=Application +Name[fr]=Une application JAVA / Ant +Icon=qmakeapp.png +Category=Java/Ant project +Category[fr]=Java/Ant +Comment=Generate a Java application +Comment[fr]=Gnre une application dans le language JAVA en utilisant Ant +FileTemplates=java,JavaStyle +ShowFilesAfterGeneration=Main.java diff --git a/languages/java/app_templates/javahello/javahello.filelist b/languages/java/app_templates/javahello/javahello.filelist new file mode 100644 index 00000000..97da44be --- /dev/null +++ b/languages/java/app_templates/javahello/javahello.filelist @@ -0,0 +1,2 @@ +# KDevelop Custom Project File List +Main.java diff --git a/languages/java/app_templates/javahello/javahello.kdevelop b/languages/java/app_templates/javahello/javahello.kdevelop new file mode 100644 index 00000000..c3eb6898 --- /dev/null +++ b/languages/java/app_templates/javahello/javahello.kdevelop @@ -0,0 +1,69 @@ +<?xml version="1.0"?> +<kdevelop> + <general> + <author>%{AUTHOR}</author> + <email>%{EMAIL}</email> + <version>%{VERSION}</version> + <projectmanagement>KDevAntProject</projectmanagement> + <primarylanguage>Java</primarylanguage> + <ignoreparts> + <part>KDevDebugger</part> + </ignoreparts> + </general> + <kdevcustomproject> + <build> + <buildtool>ant</buildtool> + </build> + </kdevcustomproject> + <kdevdoctreeview> + <ignoretocs> + <toc>ada</toc> + <toc>ada_bugs_gcc</toc> + <toc>bash</toc> + <toc>bash_bugs</toc> + <toc>c++_bugs_gcc</toc> + <toc>clanlib</toc> + <toc>fortran_bugs_gcc</toc> + <toc>gnome1</toc> + <toc>gnustep</toc> + <toc>gtk</toc> + <toc>gtk_bugs</toc> + <toc>haskell</toc> + <toc>haskell_bugs_ghc</toc> + <toc>kde2book</toc> + <toc>libc</toc> + <toc>libstdc++</toc> + <toc>opengl</toc> + <toc>pascal_bugs_fp</toc> + <toc>php</toc> + <toc>php_bugs</toc> + <toc>perl</toc> + <toc>perl_bugs</toc> + <toc>python</toc> + <toc>python_bugs</toc> + <toc>qt-kdev3</toc> + <toc>ruby</toc> + <toc>ruby_bugs</toc> + <toc>sdl</toc> + <toc>stl</toc> + <toc>sw</toc> + <toc>wxwidgets_bugs</toc> + </ignoretocs> + <ignoreqt_xml> + <toc>Guide to the Qt Translation Tools</toc> + <toc>Qt Assistant Manual</toc> + <toc>Qt Designer Manual</toc> + <toc>Qt Reference Documentation</toc> + <toc>qmake User Guide</toc> + </ignoreqt_xml> + <ignoredoxygen> + <toc>KDE Libraries (Doxygen)</toc> + </ignoredoxygen> + </kdevdoctreeview> + <kdevfileview> + <tree> + <hidenonprojectfiles>false</hidenonprojectfiles> + <hidepatterns>*.o,*.lo,CVS</hidepatterns> + </tree> + </kdevfileview> +</kdevelop> diff --git a/languages/java/app_templates/javahello/javahello.kdevtemplate b/languages/java/app_templates/javahello/javahello.kdevtemplate new file mode 100644 index 00000000..a7427704 --- /dev/null +++ b/languages/java/app_templates/javahello/javahello.kdevtemplate @@ -0,0 +1,124 @@ +# KDE Config File +[General] +Name=Application +Name[br]=Arload +Name[ca]=Aplicació +Name[cy]=Cymhwysiad +Name[da]=Program +Name[de]=Anwendung +Name[el]=Εφαρμογή +Name[es]=Aplicación +Name[et]=Rakendus +Name[eu]=Aplikazioa +Name[fa]=کاربرد +Name[ga]=Feidhmchlár +Name[gl]=Aplicación +Name[hu]=Alkalmazások +Name[it]=Applicazione +Name[ja]=アプリケーション +Name[lt]=Programa +Name[ms]=Aplikasi +Name[nds]=Programm +Name[ne]=अनुप्रयोग +Name[nl]=Toepassing +Name[pl]=Program +Name[pt]=Aplicação +Name[pt_BR]=Aplicativo +Name[ru]=Приложение +Name[rw]=Porogaramu +Name[sk]=Aplikácia +Name[sl]=Program +Name[sr]=Програм +Name[sr@Latn]=Program +Name[sv]=Program +Name[tr]=Uygulama +Name[zh_CN]=应用程序 +Name[zh_TW]=應用程式 +Icon=qmakeapp.png +Category=Java/Ant project +Category[fr]=Java/Ant +Comment=Generate a Java application +Comment[ca]=Genera una aplicació Java +Comment[da]=Generér et Java-program +Comment[de]=Erstellt eine Java-Anwendung +Comment[el]=Δημιουργία μιας εφαρμογής Java +Comment[es]=Genera una aplicación en Java +Comment[et]=Java rakenduse loomine +Comment[eu]=Sortu Java aplikazio bat +Comment[fa]=یک کاربرد جاوا تولید میکند +Comment[fr]=Génère une application Java +Comment[ga]=Cruthaigh feidhmchlár Java +Comment[gl]=Xera unha aplicación Java +Comment[hu]=Létrehoz egy Java-alkalmazást +Comment[it]=Genera un'applicazione Java +Comment[ja]= Java アプリケーションを作成 +Comment[nds]=Stellt en Java-Programm op +Comment[ne]=जाभा अनुप्रयोग उत्पन्न गर्नुहोस् +Comment[nl]=Genereer een Java-toepassing +Comment[pl]=Generuj program w Javie +Comment[pt]=Gera uma aplicação em Java +Comment[pt_BR]=Gera uma aplicação em Java +Comment[ru]=Создание приложения Java +Comment[sk]=Vygeneruje Java aplikáciu +Comment[sr]=Прави Java програм +Comment[sr@Latn]=Pravi Java program +Comment[sv]=Skapa ett Java-program +Comment[tr]=Bir Java uygulaması yarat +Comment[zh_CN]=生成一个 Java 应用程序 +Comment[zh_TW]=產生 Java 應用程式 +FileTemplates=java,JavaStyle +ShowFilesAfterGeneration=%{dest}/Main.java +Archive=javahello.tar.gz + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/javahello.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE2] +Type=install +Source=%{src}/javahello.filelist +Dest=%{dest}/%{APPNAMELC}.filelist + +[FILE3] +Type=install +Source=%{src}/Main.java +Dest=%{dest}/Main.java + +[FILE4] +Type=install +Source=%{src}/build.xml +Dest=%{dest}/build.xml + +[msg] +Type=message +Comment=A JAVA application was created in %{dest} +Comment[ca]=Una aplicació JAVA ha estat creada en %{dest} +Comment[da]=Et JAVA-program blev oprettet i %{dest} +Comment[de]=Eine Java-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαρμογή JAVA δημιουργήθηκε στο %{dest} +Comment[es]=Una aplicación en Java ha sido creada en %{dest} +Comment[et]=Java rakendus loodi asukohta %{dest} +Comment[eu]=JAVA aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد جاوا در %{dest} ایجاد شد +Comment[fr]=Une application Java a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár JAVA i %{dest} +Comment[gl]=Creouse una aplicación JAVA en %{dest} +Comment[hu]=Létrejött egy Java-alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione Java in %{dest} +Comment[ja]=JAVA アプリケーションを %{dest} に作成しました +Comment[nds]=In %{dest} wöör en JAVA-Programm opstellt +Comment[ne]= जाभा अनुप्रयोग %{dest} मा सिर्जना गरियो +Comment[nl]=Een Java-toepassing is aangemaakt in %{dest} +Comment[pl]=Program w Javie został utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação em Java em %{dest} +Comment[pt_BR]=Foi criada uma aplicação em Java em %{dest} +Comment[ru]=Приложение Java создано в %{dest} +Comment[sk]=Java aplikácia bola vytvorená v %{dest} +Comment[sr]=Java програм је направљен у %{dest} +Comment[sr@Latn]=Java program je napravljen u %{dest} +Comment[sv]=Ett Java-program skapades i %{dest} +Comment[tr]=Bir JAVA uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了一个 Java 应用程序 +Comment[zh_TW]=一個 Java 應用程式已建立於 %{dest} diff --git a/languages/java/app_templates/javahello/javahello.png b/languages/java/app_templates/javahello/javahello.png Binary files differnew file mode 100644 index 00000000..840a953c --- /dev/null +++ b/languages/java/app_templates/javahello/javahello.png diff --git a/languages/java/app_templates/kappjava/.kdev_ignore b/languages/java/app_templates/kappjava/.kdev_ignore new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/languages/java/app_templates/kappjava/.kdev_ignore diff --git a/languages/java/app_templates/kappjava/Makefile.am b/languages/java/app_templates/kappjava/Makefile.am new file mode 100644 index 00000000..4cda2ef7 --- /dev/null +++ b/languages/java/app_templates/kappjava/Makefile.am @@ -0,0 +1,17 @@ +dataFiles = app.java pref.java appview.java app_client.java appui.rc \ + src-Makefile.am kappjava.png app.kdevelop subdirs +templateName = kappjava + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz
\ No newline at end of file diff --git a/languages/java/app_templates/kappjava/app.desktop b/languages/java/app_templates/kappjava/app.desktop new file mode 100644 index 00000000..941c0846 --- /dev/null +++ b/languages/java/app_templates/kappjava/app.desktop @@ -0,0 +1,41 @@ +[Desktop Entry] +Name=%{APPNAME} +Exec=%{APPNAMELC} %i -caption "%c" +Icon=%{APPNAMELC} +Type=Application +X-DocPath=%{APPNAMELC}/%{APPNAMELC}.html +Comment=A Java KDE KPart Application +Comment[ca]=Una aplicació KPart en Java per al KDE +Comment[da]=Et Java KDE KPart-program +Comment[de]=Eine KDE-Komponten-Anwendung in Java +Comment[el]=Μια εφαρμογή Java KDE KPart +Comment[es]=Una aplicación KPart en Java para KDE +Comment[et]=Java KDE KPart rakendus +Comment[eu]=Java KDE KPart aplikazio bat +Comment[fa]=یک کاربرد KDE KPart جاوا +Comment[fr]=Une application KPart en JAVA pour KDE +Comment[ga]=Feidhmchlár KPart KDE i Java +Comment[gl]=Unha aplicación KPart de KDE en Java +Comment[hi]=एक जावा केडीई के-पार्ट अनुप्रयोग +Comment[hu]=Java-ban írt, KPart-alapú KDE-alkalmazás +Comment[is]=Java KDE KPart forrit +Comment[it]=Un'applicazione Java KDE KPart +Comment[ja]= Java KDE KPart アプリケーション +Comment[nds]=En KDE-Programm in Java +Comment[ne]=जाभा केडीई KPart अनुप्रयोग +Comment[nl]=Een Java KDE KPart-toepassing +Comment[pl]=Element osadzalny KPart Javy +Comment[pt]=Uma Aplicação KDE KPart em Java +Comment[pt_BR]=Um Aplicativo KPart do KDE para Java +Comment[ru]=Приложение KPart для KDE на Java +Comment[sk]=Java KDE KPart aplikácia +Comment[sl]=Program za Javo KDE KPart +Comment[sr]=Java KDE KPart програм +Comment[sr@Latn]=Java KDE KPart program +Comment[sv]=Ett Java KDE Kpart-program +Comment[ta]=ஜாவா கெடி கெபாகம் பயன்பாடு +Comment[tg]=Гузориш KPart барои KDE дар Java +Comment[tr]=Bir Java KDE KPart Uygulaması +Comment[zh_CN]=一个 Java KDE KPart 应用程序 +Comment[zh_TW]=Java KDE KPart 應用程式 +Terminal=false diff --git a/languages/java/app_templates/kappjava/app.java b/languages/java/app_templates/kappjava/app.java new file mode 100644 index 00000000..2cb3e94a --- /dev/null +++ b/languages/java/app_templates/kappjava/app.java @@ -0,0 +1,281 @@ +/* + * Copyright (C) %{YEAR} %{AUTHOR} <%{EMAIL}> + */ + +import java.util.*; +import org.kde.qt.*; +import org.kde.koala.*; + +/** + * This class serves as the main window for %{APPNAME}. It handles the + * menus, toolbars, and status bars. + * + * @short Main window class + * @author $AUTHOR <$EMAIL> + * @version $APP_VERSION + */ +public class %{APPNAME} extends KMainWindow +{ + private %{APPNAME}View m_view; + private QPrinter m_printer; + +%{APPNAME}() +{ + super( null, "%{APPNAME}" ); + m_view = new %{APPNAME}View(this); + m_printer = new QPrinter(); + // accept dnd + setAcceptDrops(true); + + // tell the KMainWindow that this is indeed the main widget + setCentralWidget(m_view); + + // then, setup our actions + setupActions(); + + // and a status bar + statusBar().show(); + + // Apply the create the main window and ask the mainwindow to + // automatically save settings if changed: window size, toolbar + // position, icon size, etc. Also to add actions for the statusbar + // toolbar, and keybindings if necessary. + setupGUI(); + + // allow the view to change the statusbar and caption + connect(m_view, SIGNAL("signalChangeStatusbar(String)"), + this, SLOT("changeStatusbar(String)")); + connect(m_view, SIGNAL("signalChangeCaption(String)"), + this, SLOT("changeCaption(String)")); + +} + +public void load(KURL url) +{ + StringBuffer target = new StringBuffer(); + // the below code is what you should normally do. in this + // example case, we want the url to our own. you probably + // want to use this code instead for your app + + // download the contents + if (NetAccess.download(url, target, null)) + { + // set our caption + setCaption(url.fileName()); + + // load in the file (target is always local) +// loadFile(target); + + // and remove the temp file + NetAccess.removeTempFile(target.toString()); + } + + setCaption(url.url()); + m_view.openURL(url); +} + +public void setupActions() +{ + KApplication kapp = KApplication.kApplication(); + KStdAction.openNew(this, SLOT("fileNew()"), actionCollection()); + KStdAction.open(this, SLOT("fileOpen()"), actionCollection()); + KStdAction.save(this, SLOT("fileSave()"), actionCollection()); + KStdAction.saveAs(this, SLOT("fileSaveAs()"), actionCollection()); + KStdAction.print(this, SLOT("filePrint()"), actionCollection()); + KStdAction.quit(kapp, SLOT("quit()"), actionCollection()); + + KStdAction.preferences(this, SLOT("optionsPreferences()"), actionCollection()); + + // this doesn't do anything useful. it's just here to illustrate + // how to insert a custom menu and menu item + KAction custom = new KAction(tr("Cus&tom Menuitem"), new KShortcut(), + this, SLOT("optionsPreferences()"), + actionCollection(), "custom_action"); +} + +protected void saveProperties(KConfig config) +{ + // the 'config' object points to the session managed + // config file. anything you write here will be available + // later when this app is restored + + if (m_view.currentURL() != null) + config.writeEntry("lastURL", m_view.currentURL()); +} + +protected void readProperties(KConfig config) +{ + // the 'config' object points to the session managed + // config file. this function is automatically called whenever + // the app is being restored. read in here whatever you wrote + // in 'saveProperties' + + String url = config.readPathEntry("lastURL"); + + if (url != null) + m_view.openURL(new KURL(url)); +} + +protected void dragEnterEvent(QDragEnterEvent event) +{ + // accept uri drops only + event.accept(QUriDrag.canDecode(event)); +} + +protected void dropEvent(QDropEvent event) +{ + // this is a very simplistic implementation of a drop event. we + // will only accept a dropped URL. the Qt dnd code can do *much* + // much more, so please read the docs there + ArrayList uri = new ArrayList(); + + // see if we can decode a URI.. if not, just ignore it + if (QUriDrag.decode(event, (String[]) uri.toArray())) + { + // okay, we have a URI.. process it + String url, target; + url = (String) uri.get(0); + + // load in the file + load(new KURL(url)); + } +} + +private void fileNew() +{ + // this slot is called whenever the File.New menu is selected, + // the New shortcut is pressed (usually CTRL+N) or the New toolbar + // button is clicked + + // create a new window + (new %{APPNAME}()).show(); +} + +private void fileOpen() +{ + // this slot is called whenever the File.Open menu is selected, + // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar + // button is clicked + KURL url = KURLRequesterDlg.getURL(null, this, tr("Open Location") ); + if (!url.isEmpty()) + m_view.openURL(url); +} + +private void fileSave() +{ + // this slot is called whenever the File.Save menu is selected, + // the Save shortcut is pressed (usually CTRL+S) or the Save toolbar + // button is clicked + + // save the current file +} + +private void fileSaveAs() +{ + // this slot is called whenever the File.Save As menu is selected, + KURL file_url = KFileDialog.getSaveURL(); + if (!file_url.isEmpty() && file_url.isValid()) + { + // save your info, here + } +} + +private void filePrint() +{ + // this slot is called whenever the File.Print menu is selected, + // the Print shortcut is pressed (usually CTRL+P) or the Print toolbar + // button is clicked + if (m_printer == null) m_printer = new QPrinter(); + if (QPrintDialog.getPrinterSetup(m_printer)) + { + // setup the printer. with Qt, you always "print" to a + // QPainter.. whether the output medium is a pixmap, a screen, + // or paper + QPainter p = new QPainter(); + p.begin(m_printer); + + // we let our view do the actual printing + QPaintDeviceMetrics metrics = new QPaintDeviceMetrics(m_printer); + m_view.print(p, metrics.height(), metrics.width()); + + // and send the result to the printer + p.end(); + } +} + +private void optionsPreferences() +{ + // popup some sort of preference dialog, here + %{APPNAME}Preferences dlg = new %{APPNAME}Preferences(); + if (dlg.exec() != 0) + { + // redo your settings + } +} + +private void changeStatusbar(String text) +{ + // display the text on the statusbar + statusBar().message(text); +} + +private void changeCaption(String text) +{ + // display the text on the caption + setCaption(text); +} + +static String description = + "A KDE Application"; + +static String version = "%{VERSION}"; + +static String[][] options = +{ + { "+[URL]", "Document to open.", null } +}; + +static void main(String[] cmdLineArgs) +{ + KAboutData about = new KAboutData("%{APPNAMELC}", "%{APPNAME}", version, description, + KAboutData.License_%{LICENSE}, "(C) %{YEAR} %{AUTHOR}", null, null, "%{EMAIL}"); + about.addAuthor( "%{AUTHOR}", null, "%{EMAIL}" ); + KCmdLineArgs.init(cmdLineArgs, about); + KCmdLineArgs.addCmdLineOptions(options); + KApplication app = new KApplication(); + + // see if we are starting with session management + if (app.isRestored()) + RESTORE("%{APPNAME}"); + else + { + // no session.. just start up normally + KCmdLineArgs args = KCmdLineArgs.parsedArgs(); + if (args.count() == 0) + { + %{APPNAME} widget = new %{APPNAME}(); + widget.show(); + } + else + { + int i = 0; + for (; i < args.count(); i++) + { + %{APPNAME} widget = new %{APPNAME}(); + widget.show(); + widget.load(args.url(i)); + } + } + args.clear(); + } + + app.exec(); + return; +} + + static { + qtjava.initialize(); + kdejava.initialize(); + } +} + diff --git a/languages/java/app_templates/kappjava/app.kdevelop b/languages/java/app_templates/kappjava/app.kdevelop new file mode 100644 index 00000000..078f5c1a --- /dev/null +++ b/languages/java/app_templates/kappjava/app.kdevelop @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<kdevelop> + <general> + <author>%{AUTHOR}</author> + <email>%{EMAIL}</email> + <version>%{VERSION}</version> + <projectmanagement>KDevAutoProject</projectmanagement> + <primarylanguage>Java</primarylanguage> + <keywords> + <keyword>Java</keyword> + <keyword>Code</keyword> + <keyword>Qt</keyword> + <keyword>KDE</keyword> + </keywords> + </general> + <kdevautoproject> + <general> + <activetarget>src/java</activetarget> + </general> + <run> + <mainprogram>src/%{APPNAMELC}</mainprogram> + </run> + </kdevautoproject> + <kdevfileview> + <groups> + <group pattern="*.java" name="Sources" /> + <group pattern="*.ui" name="User Interface" /> + <group pattern="*.png" name="Icons" /> + <group pattern="*.po;*.ts" name="Translations" /> + <group pattern="*" name="Others" /> + </groups> + </kdevfileview> + <kdevdebugger> + <general> + </general> + </kdevdebugger> + <kdevdoctreeview> + <ignoretocs> + <toc>ada</toc> + <toc>ada_bugs_gcc</toc> + <toc>bash</toc> + <toc>bash_bugs</toc> + <toc>c++_bugs_gcc</toc> + <toc>clanlib</toc> + <toc>w3c-dom-level2-html</toc> + <toc>fortran_bugs_gcc</toc> + <toc>gnome1</toc> + <toc>gnustep</toc> + <toc>gtk</toc> + <toc>gtk_bugs</toc> + <toc>haskell</toc> + <toc>haskell_bugs_ghc</toc> + <toc>libc</toc> + <toc>libstdc++</toc> + <toc>opengl</toc> + <toc>pascal_bugs_fp</toc> + <toc>php</toc> + <toc>php_bugs</toc> + <toc>perl</toc> + <toc>perl_bugs</toc> + <toc>python</toc> + <toc>python_bugs</toc> + <toc>ruby</toc> + <toc>ruby_bugs</toc> + <toc>sdl</toc> + <toc>stl</toc> + <toc>w3c-svg</toc> + <toc>sw</toc> + <toc>w3c-uaag10</toc> + <toc>wxwidgets_bugs</toc> + </ignoretocs> + <ignoreqt_xml> + <toc>Guide to the Qt Translation Tools</toc> + <toc>Qt Assistant Manual</toc> + <toc>Qt Designer Manual</toc> + <toc>Qt Reference Documentation</toc> + <toc>qmake User Guide</toc> + </ignoreqt_xml> + <ignoredoxygen> + <toc>KDE Libraries (Doxygen)</toc> + </ignoredoxygen> + </kdevdoctreeview> + <kdevfilecreate> + <useglobaltypes> + <type ext="java"/> + </useglobaltypes> + </kdevfilecreate> +</kdevelop> diff --git a/languages/java/app_templates/kappjava/app_client.java b/languages/java/app_templates/kappjava/app_client.java new file mode 100644 index 00000000..9ed90c8a --- /dev/null +++ b/languages/java/app_templates/kappjava/app_client.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) %{YEAR} %{AUTHOR} <%{EMAIL}> + */ + +#include <kapp.h> +#include <dcopclient.h> +#include <qdatastream.h> +#include <qstring.h> + +int main(int argc, char **argv) +{ + KApplication app(argc, argv, "%{APPNAMELC}_client", false); + + // get our DCOP client and attach so that we may use it + DCOPClient *client = app.dcopClient(); + client->attach(); + + // do a 'send' for now + QByteArray data; + QDataStream ds(data, IO_WriteOnly); + if (argc > 1) + ds << QString(argv[1]); + else + ds << QString("http://www.kde.org"); + client->send("%{APPNAMELC}", "%{APPNAME}Iface", "openURL(QString)", data); + + return app.exec(); +} diff --git a/languages/java/app_templates/kappjava/appui.rc b/languages/java/app_templates/kappjava/appui.rc new file mode 100644 index 00000000..ceb4f14e --- /dev/null +++ b/languages/java/app_templates/kappjava/appui.rc @@ -0,0 +1,8 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="%{APPNAMELC}" version="1"> +<MenuBar> + <Menu name="custom"><text>C&ustom</text> + <Action name="custom_action" /> + </Menu> +</MenuBar> +</kpartgui> diff --git a/languages/java/app_templates/kappjava/appview.java b/languages/java/app_templates/kappjava/appview.java new file mode 100644 index 00000000..1ead5458 --- /dev/null +++ b/languages/java/app_templates/kappjava/appview.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) %{YEAR} %{AUTHOR} <%{EMAIL}> + */ + +import java.util.*; +import org.kde.qt.*; +import org.kde.koala.*; + +/** + * This is the main view class for %{APPNAME}. Most of the non-menu, + * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go + * here. + * + * This %{APPNAMELC} uses an HTML component as an example. + * + * @short Main view + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +public class %{APPNAME}View extends QWidget +{ + + QHBoxLayout top_layout; + +public %{APPNAME}View(QWidget parent) +{ + super(parent, null); + // setup our layout manager to automatically add our widgets + top_layout = new QHBoxLayout(this); + top_layout.setAutoAdd(true); + + // we want to look for all components that satisfy our needs. the + // trader will actually search through *all* registered KDE + // applications and components -- not just KParts. So we have to + // specify two things: a service type and a constraint + // + // the service type is like a mime type. we say that we want all + // applications and components that can handle HTML -- 'text/html' + // + // however, by itself, this will return such things as Netscape.. + // not what we wanted. so we constrain it by saying that the + // string 'KParts/ReadOnlyPart' must be found in the ServiceTypes + // field. with this, only components of the type we want will be + // returned. + ArrayList offers = KTrader.self().query("text/html", "'KParts/ReadOnlyPart' in ServiceTypes"); + + KLibFactory factory = null; + // in theory, we only care about the first one.. but let's try all + // offers just in case the first can't be loaded for some reason + Iterator it = offers.iterator(); + while(it.hasNext()) + { + KService ptr = (KService) it.next(); + + // we now know that our offer can handle HTML and is a part. + // since it is a part, it must also have a library... let's try to + // load that now + factory = KLibLoader.self().factory( ptr.library() ); + if (factory != null) + { + m_html = (ReadOnlyPart) factory.create(this, ptr.name(), "KParts::ReadOnlyPart"); + break; + } + } + + // if our factory is invalid, then we never found our component + // and we might as well just exit now + if (factory == null) + { + KMessageBox.error(this, "Could not find a suitable HTML component"); + return; + } + + connect(m_html, SIGNAL("setWindowCaption(String)"), + this, SLOT("slotSetTitle(String)")); + connect(m_html, SIGNAL("setStatusBarText(String)"), + this, SLOT("slotOnURL(String)")); + +} + + +public void print(QPainter p, int height, int width) +{ + // do the actual printing, here + // p.drawText(etc..) +} + +public String currentURL() +{ + return m_html.url().url(); +} + +public void openURL(String url) +{ + openURL(new KURL(url)); +} + +public void openURL(KURL url) +{ + m_html.openURL(url); +} + +private void slotOnURL(String url) +{ + emit("signalChangeStatusbar", url); +} + +private void slotSetTitle(String title) +{ + emit("signalChangeCaption", title); +} + +private ReadOnlyPart m_html; + +} diff --git a/languages/java/app_templates/kappjava/kappjava b/languages/java/app_templates/kappjava/kappjava new file mode 100644 index 00000000..e199ac25 --- /dev/null +++ b/languages/java/app_templates/kappjava/kappjava @@ -0,0 +1,10 @@ +# KDE Config File +[General] +Name=Application framework +Name[fr]=Squelette d'application +Icon=kappjava.png +Category=Java/KDE +Comment=Generates a simple Java KDE application with one toplevel window, menus and toolbars. +Comment[fr]=Gnre une simple application KDE dans le language JAVA avec une fentre principale, des menus, et des barres d'outils. +FileTemplates=java,CStyle +ShowFilesAfterGeneration=src/APPNAMEView.java diff --git a/languages/java/app_templates/kappjava/kappjava.kdevtemplate b/languages/java/app_templates/kappjava/kappjava.kdevtemplate new file mode 100644 index 00000000..3fd80ca8 --- /dev/null +++ b/languages/java/app_templates/kappjava/kappjava.kdevtemplate @@ -0,0 +1,163 @@ +# KDE Config File +[General] +Name=Application framework +Name[ca]=Infraestructura d'aplicacions +Name[da]=Programskelet +Name[de]=Anwendungsgrundgerüst +Name[el]=Πλαίσιο εφαρμογής +Name[es]=Infraestructura de aplicación +Name[et]=Rakenduse raamistik +Name[eu]=Aplikazioen lan-markoa +Name[fa]=چارچوب کاربرد +Name[fr]=Infrastructure d'application +Name[ga]=Creatlach feidhmchláir +Name[gl]=Entorno de traballo para aplicación +Name[hu]=Alkalmazás-keretrendszer +Name[it]=Infrastruttura applicativa +Name[ja]=アプリケーションフレームワーク +Name[nds]=Programmrahmenwark +Name[ne]=अनुप्रयोग फ्रेमवर्क +Name[nl]=Applicationframework +Name[pl]=Szablon programu +Name[pt]=Plataforma de aplicações +Name[pt_BR]=Plataforma de aplicações +Name[ru]=Приложение KDE +Name[sk]=Aplikačný framework +Name[sl]=Ogrodje programa +Name[sr]=Радни оквир програма +Name[sr@Latn]=Radni okvir programa +Name[sv]=Programramverk +Name[tr]=Uygulama Çatısı +Name[zh_CN]=应用程序框架 +Name[zh_TW]=應用程式框架 +Icon=kappjava.png +Category=Java/KDE +Comment=Generates a simple Java KDE application with one toplevel window, menus and toolbars. +Comment[ca]=Genera una simple aplicació per al KDE en Java amb una finestra principal, menús i barres d'eines. +Comment[da]=Genererer et simpelt Java KDE program med et vindue på topniveau, menuer og værktøjslinjer. +Comment[de]=Erstellt eine einfache Java-KDE-Anwendung mit einem Toplevel-Fenster, Menüs und Werkzeugleisten. +Comment[el]=Δημιουργεί μια απλή εφαρμογή Java του KDE με ένα ανώτερο παράθυρο, μενού, και γραμμές εργαλείων. +Comment[es]=Genera una sencilla aplicación para KDE en Java, con una ventana principal, menús y barras de herramientas. +Comment[et]=Lihtsa Java KDE rakenduse loomine ühe tipptaseme akna, menüüde ja tööriistaribadega. +Comment[eu]=Goi-mailako lehio bat, menuak eta tresna-barrak dituen Java KDE aplikazio bat sortzen du. +Comment[fa]=یک کاربرد سادۀ KDE جاوا با یک پنجرۀ سطح بالا، گزینگان و میلههای ابزار تولید میکند. +Comment[fr]=Génère une application KDE simple en Java comprenant une fenêtre de premier niveau, des menus et des barres d'outils. +Comment[gl]=Xera unha aplicación sinxela KDE en Java cunha xanela principal, menús e barras de ferramentas. +Comment[hu]=Létrehoz egy egyszerű Java-alapú KDE-alkalmazást egy főablakkal, menükkel és eszköztárakkal. +Comment[it]=Genera una semplice applicazione KDE Java con una finestra toplevel, menu e barre degli strumenti. +Comment[nds]=Stellt en eenfach KDE-Programm in Java mit een böverst Finster, Menüs un Warktüüchbalkens op. +Comment[ne]=एउटा उच्चतह सञ्झ्याल, मेनु र उपकरणपट्टीसँग साधारण जाभा केडीई अनुप्रयोग उत्पन्न गर्दछ । +Comment[nl]=Genereert een eenvoudige Java KDE-toepassing met een toplevel window, menu's en toolbars. +Comment[pl]=Generuje prosty program KDE w Javie posiadający okno, menu i paski narzędzi. +Comment[pt]=Gera uma aplicação para KDE simples em Java, com uma janela de topo, menus e barras de ferramentas. +Comment[pt_BR]=Gera uma aplicação para KDE simples em Java, com uma janela de topo, menus e barras de ferramentas. +Comment[ru]=Создание простого приложения Java KDE с окном, меню и панелями инструментов. +Comment[sk]=Vygeneruje jednoduchú Java KDE aplikáciu s jedným oknom, menu a panelom nástrojov. +Comment[sr]=Прави једноставан Java KDE програм са једним прозором највишег нивоа, менијима и тракама са алатом. +Comment[sr@Latn]=Pravi jednostavan Java KDE program sa jednim prozorom najvišeg nivoa, menijima i trakama sa alatom. +Comment[sv]=Skapar ett enkelt Java KDE-program med ett toppnivåfönster, menyer och verktygsrader. +Comment[tr]=Bir üst seviye penceresi, menüleri ve araç çubukları olan basit bir Java KDE uygulaması yaratır. +Comment[zh_CN]=生成一个简单的带有顶级窗口、菜单和工具栏的 Java KDE 应用程序。 +Comment[zh_TW]=產生一個簡單的 Java KDE 應用程式,內含頂層視窗、選單與工具列。 +FileTemplates=java,CStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAME}View.java +Archive=kappjava.tar.gz + +[ADMIN] +Type=include +File=%{kdevelop}/template-common/admin.kdevtemplate + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[DOCBOOK] +Type=include +File=%{kdevelop}/template-common/dockbook.kdevtemplate + +[FILE4] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILE5] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.am +Dest=%{dest}/Makefile.am + +[FILE6] +Type=install +Source=%{kdevelop}/template-common/kde-Makefile.cvs +Dest=%{dest}/Makefile.cvs + +[FILE7] +Type=install +Source=%{kdevelop}/template-common/kde-configure.in.in +Dest=%{dest}/configure.in.in + +[MkDir3] +Type=mkdir +Dir=%{dest}/src + +[FILE8] +Type=install +Source=%{kdevelop}/template-common/kde-app.desktop +Dest=%{dest}/src/%{APPNAMELC}.desktop + +[FILE9] +Type=install +Source=%{kdevelop}/template-common/kde-app.lsm +Dest=%{dest}/src/%{APPNAMELC}.lsm + +[FILE10] +Type=install +Source=%{kdevelop}/template-common/hi16-app-app.png +Dest=%{dest}/src/hi16-app-%{APPNAMELC}.png +Process=false + +[FILE11] +Type=install +Source=%{kdevelop}/template-common/hi32-app-app.png +Dest=%{dest}/src/hi32-app-%{APPNAMELC}.png +Process=false + +[MkDir4] +Type=mkdir +Dir=%{dest}/po + +[FILE12] +Type=install +Source=%{kdevelop}/template-common/kde-po-Makefile.am +Dest=%{dest}/po/Makefile.am + +[FILE13] +Type=install +Source=%{src}/subdirs +Dest=%{dest}/subdirs + +[FILE14] +Type=install +Source=%{src}/src-Makefile.am +Dest=%{dest}/src/Makefile.am + +[FILE15] +Type=install +Source=%{src}/app.java +Dest=%{dest}/src/%{APPNAME}.java + +[FILE16] +Type=install +Source=%{src}/appview.java +Dest=%{dest}/src/%{APPNAME}View.java + +[FILE17] +Type=install +Source=%{src}/pref.java +Dest=%{dest}/src/%{APPNAME}Preferences.java + +[FILE18] +Type=install +Source=%{src}/appui.rc +Dest=%{dest}/src/%{APPNAMELC}ui.rc + diff --git a/languages/java/app_templates/kappjava/kappjava.png b/languages/java/app_templates/kappjava/kappjava.png Binary files differnew file mode 100644 index 00000000..913ebb87 --- /dev/null +++ b/languages/java/app_templates/kappjava/kappjava.png diff --git a/languages/java/app_templates/kappjava/pref.java b/languages/java/app_templates/kappjava/pref.java new file mode 100644 index 00000000..a50fdb31 --- /dev/null +++ b/languages/java/app_templates/kappjava/pref.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) %{YEAR} %{AUTHOR} <%{EMAIL}> + */ + +import java.util.*; +import org.kde.qt.*; +import org.kde.koala.*; + +public class %{APPNAME}Preferences extends KDialogBase +{ +private %{APPNAME}PrefPageOne m_pageOne; +private %{APPNAME}PrefPageTwo m_pageTwo; + +public %{APPNAME}Preferences() +{ + super(TreeList, "%{APPNAME} Preferences", + Help|Default|Ok|Apply|Cancel, Ok); + + // this is the base class for your preferences dialog. it is now + // a Treelist dialog.. but there are a number of other + // possibilities (including Tab, Swallow, and just Plain) + QFrame frame; + frame = addPage(tr("First Page"), tr("Page One Options")); + m_pageOne = new %{APPNAME}PrefPageOne(frame); + + frame = addPage(tr("Second Page"), tr("Page Two Options")); + m_pageTwo = new %{APPNAME}PrefPageTwo(frame); +} + +public class %{APPNAME}PrefPageOne extends QFrame { +public %{APPNAME}PrefPageOne(QWidget parent) +{ + super(parent); + QHBoxLayout layout = new QHBoxLayout(this); + layout.setAutoAdd(true); + + new QLabel("Add something here", this); +} +} + +public class %{APPNAME}PrefPageTwo extends QFrame { +public %{APPNAME}PrefPageTwo(QWidget parent) +{ + super(parent); + QHBoxLayout layout = new QHBoxLayout(this); + layout.setAutoAdd(true); + + new QLabel("Add something here", this); +} +} + +} diff --git a/languages/java/app_templates/kappjava/src-Makefile.am b/languages/java/app_templates/kappjava/src-Makefile.am new file mode 100644 index 00000000..6468994c --- /dev/null +++ b/languages/java/app_templates/kappjava/src-Makefile.am @@ -0,0 +1,18 @@ +## Makefile.am for %{APPNAMELC} + +JAVAROOT = . + +# which sources should be compiled for %{APPNAMELC} +java_JAVA = %{APPNAME}.java %{APPNAME}View.java \ + %{APPNAME}Preferences.java + + +KDE_ICON = %{APPNAMELC} + +# this is where the kdelnk file will go +kdelnkdir = $(kde_appsdir)/Utilities +kdelnk_DATA = %{APPNAMELC}.desktop + +# this is where the XML-GUI resource file goes +rcdir = $(kde_datadir)/%{APPNAMELC} +rc_DATA = %{APPNAMELC}ui.rc diff --git a/languages/java/app_templates/kappjava/subdirs b/languages/java/app_templates/kappjava/subdirs new file mode 100644 index 00000000..0e678106 --- /dev/null +++ b/languages/java/app_templates/kappjava/subdirs @@ -0,0 +1,3 @@ +doc +po +src diff --git a/languages/java/app_templates/superwaba/.kdev_ignore b/languages/java/app_templates/superwaba/.kdev_ignore new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/languages/java/app_templates/superwaba/.kdev_ignore diff --git a/languages/java/app_templates/superwaba/Makefile.am b/languages/java/app_templates/superwaba/Makefile.am new file mode 100644 index 00000000..8c27b8d5 --- /dev/null +++ b/languages/java/app_templates/superwaba/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = superwaba.png sw.java src-Makefile sw.kdevelop sw.filelist +templateName = superwaba + +### no need to change below: +template_DATA = $(templateName).kdevtemplate +templatedir = ${appwizarddatadir}/templates + +appwizarddatadir = ${kde_datadir}/kdevappwizard +$(templateName).tar.gz: ${dataFiles} + $(TAR) -cf $(templateName).tar -C $(srcdir) ${dataFiles} + $(GZIP_COMMAND) -f9 $(templateName).tar + +archivedir = ${appwizarddatadir} +archive_DATA = $(templateName).tar.gz ${templateName}.png + +CLEANFILES = *.tar.gz
\ No newline at end of file diff --git a/languages/java/app_templates/superwaba/src-Makefile b/languages/java/app_templates/superwaba/src-Makefile new file mode 100644 index 00000000..84b55ece --- /dev/null +++ b/languages/java/app_templates/superwaba/src-Makefile @@ -0,0 +1,226 @@ +# Makefile template +# +# for using WABA and SUPERWABA on Linux systems +# +# Doug Lawson (dlawson@cablespeed.com) +# Modified for use with KDevelop by Ian Reinhart Geiser <geiseri@kde.org> + +# Copyright (c) Doug Lawson 2003 +# developed for classes I teach. +# +# may be distributed under GPL +# (http://www.gnu.org/licenses/gpl.html) +# or any other license that allows it to be freely used. +# +# please let me know about any improvements you make + +VERSION = %{VERSION} +# What are we building? We put the names here at the +# top to make it easy to change + +MAINCLASSNAME = %{APPNAME} + +# ExtraClassList will be blank if the app consists of +# only one class +EXTRACLASSLIST = + +# Is there an icon for this program? If there +# is, create an icon argument for exegen +# +# Exegen will automatically look for icons +# so this may not be needed. Run +# java Exegen /? +# for help on Exegen +# +# If you use this line, make sure to un-comment it! +# +# ICONFLAG = /I Icon + +# Like ICONFLAG, height and width may be specified, or +# you may accept the default. On PalmOS, the app will run +# full-screen by default, which is usually what you want. +# +# If you want the same look on PalmOS as on +# Windows CE, you should specify height and width +# +# run +# java Exegen /? +# for more information, or see the docs. +# +# HEIGHT = /h 160 +# WIDTH = /w 160 + +# CAB Options +# The /Z parameter is used to create eight cab files so your application can +# easily be installed in all compatible Windows CE platforms. You may pass, +# optionally, a .swz file with some global and local libraries used by your +# app. For example, if you need to install the TinyLarge.pdb font and also a +# custom database, E.g. mydata.pdb, you must copy all files to the current +# directory, then create a myapp.swz file with the following contents: +# +# [G]TinyLarge.pdb +# [L]mydata.pdb +# +# The [G] denotes a global library (fonts are always global libraries), and the +# [L] denotes a local library. +# The user will then have two options to start the installation process: +# 1. Run the created xxx_install.bat file, or +# 2. If the cab files are available in the internet, the user may launch the +# browser from inside the device, connect to the site and choose the appropriate +# cab file. The browser will then download and install the file. +# The /Z parameter works on in the Windows platform. +SWZFILE = +CABFLAGS = /Z $(SWZFILE) + +# ------------------------------------------------------ +# Most of the stuff below this line will not change +# very often. If you change Java SDKs or re-install +# waba or superwaba, you may need to change it. + +# first, the locations of the various java components. +# On a *NIX system, they will usually be in something +# like the directories listed here. + + +# The flags and arguments here have been developed for use with +# the SUN jdk v1.3. Read your java documentation carefully, +# don't just blindly assume that what I have here will work +# with your setup. + +JAVADIR = %{JAVADIR} +JAVABINDIR = $(JAVADIR)/bin +JAVAC = $(JAVABINDIR)/javac +JAR = $(JAVABINDIR)/jar + +# Java Compiler flags and arguments. For these makefiles, +# it is easiest if we include the CLASSPATH in the command +# line. +JCFLAGS = -classpath $(CLASSPATH) + +JAVA = $(JAVABINDIR)/java +JAVAFLAGS = -classpath $(CLASSPATH) + +APPLETVIEWER = $(JAVABINDIR)/appletviewer +AVFLAGS = -J-classpath -J$(CLASSPATH) + + +# next, where are all the WABA bits and pieces? +WABADIR = %{WABADIR} +WABABINDIR = $(WABADIR)/superwaba/bin +WABAEXTRADIR = $(WABADIR)/superwaba + +################################################################################ +# You should not have to change anything below this line. +################################################################################ +# the classpath will have to tell java where to find the waba stuff. +# +# the CLASSPATH here is set to let java find +# - the classes it needs to produce the executable class files +# - the waba.applet class, Warp.class, and Exegen.class +# +# This strategy works so far, but it may (conceivably) produce a +# conflict at some point. Be warned. You may want to use a CLASSPATH +# that leaves out waba.applet, Warp and/or Exegen. +# +CLASSPATH = $(WABADIR):$(WABAEXTRADIR):$(WABAEXTRADIR)/classes:$(WABABINDIR):. + +# exegen and warp +# +# exegen is the EXEcutable GENerator. It takes the +# main waba/java class (which usually extends MainWindow) +# and makes it into a program that will automagically run +# itself under waba or superwaba on a PalmOS gadget. +# +# Since the palm program has a .prc extension, it is called +# PRCFILE here. +# +# Exegen also creates a .exe file for Window CE +# +# warp is the Waba Application Resource Packager. +# It bundles the classes and other resources into +# a single PALM database file (which is also used +# by the Win CE executable). This file has a .pdb +# extension. In this makefile it is called PDBFILE +# +# The standard waba SDK has only the MS-Windows *.exe files. +# for exegen and warp +# +# Although there are exegen and warp native binaries for Linux, +# they don't seem to work very well. The solution has been to +# write those programs in Java. +# +# for waba, use the java apps +# from http://www.wn.com.au/rnielsen/wextras/ +# (Rob Nielsen). Getting all the paths to fall into the right +# place takes a little tuning, though (which is why this makefile +# is here, I suppose) +# +# For superwaba, the same programs are included in the +# distribution + + +EXEGEN = $(JAVA) $(JAVAFLAGS) Exegen +EXEGENFLAGS = $(HEIGHT) $(WIDTH) $(ICONFLAG) /L /V $(VERSION) $(CABFLAGS) + +WARP = $(JAVA) $(JAVAFLAGS) Warp +WARPFLAGS = c + +MAINCLASS = $(MAINCLASSNAME).class +EXTRACLASSES = $(EXTRACLASSLIST) + +WEBPAGE = $(MAINCLASSNAME).html + +PRCBASENAME = $(MAINCLASSNAME) +PDBBASENAME = $(MAINCLASSNAME) + +PDBFILE = $(PDBBASENAME).pdb +PRCFILE = $(PRCBASENAME).prc + + +all: $(PDBFILE) $(PRCFILE) + +$(PRCFILE): $(PDBFILE) + $(EXEGEN) $(EXEGENFLAGS) $(PRCBASENAME) $(MAINCLASSNAME) $(PDBBASENAME) + +# you may want to change this one so that Warp only handles +# the classes you tell it to (instead of using the wildcard '*.class') +# Use the second pair of lines below, which are commented out. +# +# Note that there is a potential problem if your program generates +# inner classes (which have names like +# 'ClockPanel$SettingsWindow.class'. +# If that is the case, the wildcard *.class filespec is guaranteed to +# include them in the make dependency. + +$(PDBFILE): $(MAINCLASS) $(EXTRACLASSES) + $(WARP) $(WARPFLAGS) $(PDBBASENAME) *.class + +# $(PDBFILE): $(MAINCLASS) $(EXTRACLASSES) +# $(WARP) $(WARPFLAGS) $(PDBBASENAME) $(MAINCLASS) $(EXTRACLASSES) + +# Below, we just tell make how to create foo.class if it can find +# foo.java + +%.class: %.java + $(JAVAC) $(JCFLAGS) $< + +# note that the 'test' target DOES NOT INCLUDE A DEPENDENCY +# for the java classes. This way, you can keep doing tests of the old +# class while you rewrite the source (foo.java). + +test: + echo "running this test does not rebuild any of the targets" ;\ + $(JAVA) $(JAVAFLAGS) waba.applet.Applet $(MAINCLASSNAME) + +# Since I haven't (yet) got the code written to generate the +# web page, target 'applettest' is commented out. If you want +# to create the web page by hand and test it, be my guest. + +# applettest: $(WEBPAGE) +# $(APPLETVIEWER) $(AVFLAGS) $(webpage) + +clean: + rm -f *.class *.pdb *.prc *.lnk + +jar: $(MAINCLASS) $(EXTRACLASSES) + $(JAR) -cvfm $(MAINCLASSNAME).jar $(MAINCLASSNAME).mft $(MAINCLASS) $(EXTRACLASSES) diff --git a/languages/java/app_templates/superwaba/superwaba b/languages/java/app_templates/superwaba/superwaba new file mode 100644 index 00000000..eea98775 --- /dev/null +++ b/languages/java/app_templates/superwaba/superwaba @@ -0,0 +1,54 @@ +# KDE Config File +[General] +Name=SuperWaba +Name[fr]=Une application SuperWaba +Icon=superwaba.png +Category=Java +Comment=A simple template for building SuperWaba Java based apps on WinCE and PalmOS. More information can be found at http://www.superwaba.org +Comment[fr]=Gnre un simple modle d'application JAVA en utilisant SuperWaba pour les environnements WinCE et PalmOS. Plus d'informations peuvent tre trouv l'URL suivante : http://www.superwaba.org. +FileTemplates=java +ShowFilesAfterGeneration=APPNAME.java +Archive=superwaba.tar.gz + +[JAVA] +Type=value +Value=JAVA +Comment=Path to your java root +Default=/usr/lib/java +ValueType=QString + +[WABA] +Type=value +Value=WABA +Comment=Path to your SuperWaba root +Default=/usr/lib +ValueType=QString + +[GNU] +Type=install archive +Source=%{kdevelop}/template-common/gnu.tar.gz +Dest=%{dest} + +[PROJECT] +Type=install +Source=%{src}/sw.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILELIST] +Type=install +Source=%{src}/sw.filelist +Dest=%{dest}/%{APPNAMELC}.filelist + +[MAKEFILE] +Type=install +Source=%{src}/src-Makefile +Dest=%{dest}/Makefile + +[SOURCE] +Type=install +Source=%{src}/sw.java +Dest=%{dest}/%{APPNAME}.java + +[MESSAGE] +Type=Message +Comment=Your application is setup to build. Edit the make targets to customize the file. diff --git a/languages/java/app_templates/superwaba/superwaba.kdevtemplate b/languages/java/app_templates/superwaba/superwaba.kdevtemplate new file mode 100644 index 00000000..a963caac --- /dev/null +++ b/languages/java/app_templates/superwaba/superwaba.kdevtemplate @@ -0,0 +1,166 @@ +# KDE Config File +[General] +Name=SuperWaba +Name[ne]=सुपरवाभा +Icon=superwaba.png +Category=Java +Comment=A simple template for building SuperWaba Java based apps on WinCE and PalmOS. More information can be found at http://www.superwaba.org +Comment[ca]=Una simple plantilla per a construir aplicacions basades en SuperWaba Java per a WinCE i PalmOS. Podeu trobar més informació a http://www.superwaba.org +Comment[da]=En simpel skabelon til at bygge SuperWaba Java baserede programmer på WinCE og PalmOS. Mere information kan findes på http://www.superwaba.org +Comment[de]=Eine einfache Vorlage zum Erstellen von auf Java basierenden SuperWaba-Anwendungen unter WinCE und PalmOS. Weitere Informationen erhalten Sie auf http://www.superwaba.org. +Comment[el]=Ένα απλό πρότυπο για την κατασκευή εφαρμογών SuperWaba Java για τα WinCE και PalmOS. Περισσότερες πληροφορίες μπορούν να βρεθούν στο http://www.superwaba.org +Comment[es]=Una plantilla sencilla para crear aplicaciones basadas en SuperWaba Java para WinCE y PalmOS. Puede encontrar más información en http://www.superwaba.org +Comment[et]=Lihtne mall rakenduste loomiseks SuperWaba Java põhjal WinCE ja PalmOS'i tarbeks. Rohkem infot annab http://www.superwaba.org +Comment[eu]=WinCE eta PalmOS sistema eragileetan SuperWaba Javan oinarritutako aplikazioak sortzeko txantiloi sinple bat. Informazio gehiagorako: http://www.superwaba.org +Comment[fa]=یک قالب ساده برای ساختن کاربردهای بر مبنای SuperWaba جاوا روی WinCE و PalmOS. اطلاعات بیشتر میتواند در http://www.superwaba.org یافت شود +Comment[fr]=Un modèle simple pour construire des applications basées sur Java SuperWaba pour WinCE et PalmOS. Vous trouverez plus d'informations sur http://www.superwaba.org +Comment[gl]=Un modelo sinxelo para crear aplicacións SuperWaba baseadas en Java para WinCE e PalmOS. Pode atopar máis información en http://www.superwaba.org +Comment[hu]=Egyszerű sablon SuperWaba Java-alkalmazások készítéséhez, WinCE és PalmOS platformra. Részletes információ itt található: http://www.superwaba.org +Comment[it]=Un semplice modello per compilare applicazioni Java SuperWaba basato su WinCE e PalmOS. Ulteriori informazioni possono essere trovate visitando http://www.superwaba.org/ +Comment[nds]=En eenfach Vörlaag för't Opstellen vun op WinCE un PalmOS opbuut SuperWaba-Programmen. Mehr Informatschonen laat sik op http://www.superwaba.org finnen +Comment[ne]=WinCE र PalmOS मा सुपरवाभा जाभा आधारित अनुप्रयोग निर्माणका लागि साधारण टेम्प्लेट । बढी जानकारी http://www.superwaba.org मा फेला पार्न सकिन्छ । +Comment[nl]=Een eenvouidg sjabloon voor het bouwen van SuperWaba Java-gebaseerde toepassingen op WinCE en PalmOS. Meer informatie vindt u op http://www.superwaba.org. +Comment[pl]=Prosty szablon do budowania programów w Javie wykorzystujących SuperWaba w środowiskach WinCE oraz PalmOS. Więcej informacji można znaleźć na stronie http://www.superwaba.org +Comment[pt]=Um modelo simples para criara aplicações Java, baseadas no SuperWaba, para o WinCE e o PalmOS. Poderá encontrar mais informações em http://www.superwaba.org +Comment[pt_BR]=Um modelo simples para criara aplicações Java, baseadas no SuperWaba, para o WinCE e o PalmOS. Poderá encontrar mais informações em http://www.superwaba.org +Comment[ru]=Создание приложения SuperWaba Java для устройств WinCE и PalmOS. Дополнительную информацию можно найти на http://www.superwaba.org +Comment[sk]=Jednoduchá šablóna pre vytváranie SuperWaba Java Aplikácií na WinCE a PalmOS. Viac informácií môžte nájsť na http://www.superwaba.org +Comment[sr]=Једноставан шаблон за градњу SuperWaba програма на основу Java-е, за WinCE и PalmOS. Више информација на http://www.superwaba.org +Comment[sr@Latn]=Jednostavan šablon za gradnju SuperWaba programa na osnovu Java-e, za WinCE i PalmOS. Više informacija na http://www.superwaba.org +Comment[sv]=En enkel mall för att bygga SuperWaba Java-baserade program på WinCE och PalmOS. Mer information hittas på http://www.superwaba.org. +Comment[tr]=WinCE ve PalmOS üstünde SuperWaba tabanlı Java uygulamarı yapmak için basit bir şablon. Daha fazla bilgi http://www.superwaba.org/ adresinde bulunabilir. +Comment[zh_CN]=在 WinCE 和 PalmOS 上构建基于 SuperWaba Java 应用程序的简单模板。更多信息可以在 http://www.superwaba.org 找到 +Comment[zh_TW]=一個簡單的建立在 WinCE 與 PalmOS 上執行的 SuperWaba Java 應用程式。您可以在 http://www.superwaba.org 取得更多資訊。 +FileTemplates=java +ShowFilesAfterGeneration=%{dest}/%{APPNAME}.java +Archive=superwaba.tar.gz + +[JAVA] +Type=value +Value=JAVA +Comment=Path to your java root +Comment[ca]=Ruta cap a la vostra arrel Java +Comment[da]=Sti til din java-rod +Comment[de]=Pfad zum Stammordner von Java +Comment[el]=Διαδρομή στο κατάλογό σας της java +Comment[es]=Ruta a su carpeta raíz Java +Comment[et]=Java juurkataloogi asukoht +Comment[eu]=Zure java erroaren bide-izena +Comment[fa]=مسیر ریشۀ جاوای شما +Comment[fr]=Chemin vers votre racine Java +Comment[gl]=Ruta a súa instalación de java +Comment[hu]=A Java-alapkönyvtár elérési útja +Comment[it]=Percorso alla radice java +Comment[ja]=Java ルートへのパス +Comment[nds]=Padd na Dien Java-Wörtelorner +Comment[ne]=तपाईँको जाभा रूटको मार्ग +Comment[nl]=Pad naar uw Java-hoofdmap +Comment[pl]=Ścieżka do głównego katalogu Javy +Comment[pt]=A localização de base do seu Java +Comment[pt_BR]=A localização de base do seu Java +Comment[ru]=Путь к корневому каталогу Java +Comment[sk]=Cesta ku java koreňu +Comment[sr]=Путања до вашег корена Java-е +Comment[sr@Latn]=Putanja do vašeg korena Java-e +Comment[sv]=Sökväg till Java-rotkatalog +Comment[zh_CN]=您的 Java 根路径 +Comment[zh_TW]=您的 java 根路徑 +Default=/usr/lib/java +ValueType=QString + +[WABA] +Type=value +Value=WABA +Comment=Path to your SuperWaba root +Comment[ca]=Ruta cap a la vostra arrel SuperWaba +Comment[da]=Sti til din SuperWaba-rod +Comment[de]=Pfad zum Stammordner von SuperWaba +Comment[el]=Διαδρομή στο κατάλογό σας της SuperWaba +Comment[es]=Ruta a su carpeta raíz de SuperWaba +Comment[et]=SuperWaba juurkataloogi asukoht +Comment[eu]=Zure SuperWaba erroaren bide-izena +Comment[fa]=مسیر ریشۀ SuperWaba شما +Comment[fr]=Chemin vers votre racine SuperWaba +Comment[gl]=Ruta a súa instalación de SuperWaba +Comment[hu]=A SuperWaba-alapkönyvtár elérési útja +Comment[it]=Percorso alla radice SuperWaba +Comment[ja]=SuperWaba ルートへのパス +Comment[nds]=Padd na Dien SuperWaba-Wörtelorner +Comment[ne]=तपाईँको सुपरवाभा रूटको मार्ग +Comment[nl]=Pad naar uw SuperWaba-hoofdmap +Comment[pl]=Ścieżka do głównego katalogu SuperWaba +Comment[pt]=A localização de base do seu SuperWaba +Comment[pt_BR]=A localização de base do seu SuperWaba +Comment[ru]=Путь к корневому каталогу SuperWaba +Comment[sk]=Cesta ku SuperWaba koreňu +Comment[sr]=Путања до вашег корена SuperWaba-е +Comment[sr@Latn]=Putanja do vašeg korena SuperWaba-e +Comment[sv]=Sökväg till SuperWaba-rotkatalog +Comment[tr]=SuperWaba kök dizininizin yolu +Comment[zh_CN]=您的 SuperWaba 根路径 +Comment[zh_TW]=您的 SuperWaba 根路徑 +Default=/usr/lib +ValueType=QString + +[GNU] +Type=install archive +Source=%{kdevelop}/template-common/gnu.tar.gz +Dest=%{dest} + +[PROJECT] +Type=install +EscapeXML=true +Source=%{src}/sw.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[FILELIST] +Type=install +Source=%{src}/sw.filelist +Dest=%{dest}/%{APPNAMELC}.filelist + +[MAKEFILE] +Type=install +Source=%{src}/src-Makefile +Dest=%{dest}/Makefile + +[SOURCE] +Type=install +Source=%{src}/sw.java +Dest=%{dest}/%{APPNAME}.java + +[MESSAGE] +Type=Message +Comment=Your application is setup to build. Edit the make targets to customize the file. +Comment[ca]=La vostra aplicació està llesta per a ser construïda. Editeu els objectius de make per a personalitzar el fitxer. +Comment[da]=Dit program er parat til at blive bygget. Redigér make targets for at indstille filen. +Comment[de]=Ihre Anwendung ist bereit für das Erstellen. Bearbeiten Sie die Make-Targets, um die Datei an Ihre Bedürfnisse anzupassen. +Comment[el]=Η εφαρμογή σας έχει ρυθμιστεί για κατασκευή. Επεξεργαστείτε τους προορισμούς κατασκευής για την προσαρμογή του αρχείου. +Comment[en_GB]=Your application is setup to build. Edit the make targets to customise the file. +Comment[es]=Su aplicación está lista para ser construída. Edite los objetivos make para personalizar el archivo. +Comment[et]=Rakendus on ehitamiseks valmis. Faili kohandamiseks redigeeri ehitamise sihtmärke. +Comment[eu]=Zure aplikazioa eraikitzeko konfiguratu da. Editatu make-en helburuak fitxategia pertsonalizatzeko. +Comment[fa]=کاربرد شما برای ساختن برپا میشود. برای سفارشی کردن پرونده، هدفهای make را ویرایش کنید. +Comment[fr]=Votre application est prête à être construite. Modifiez les cibles de « make » pour personnaliser le fichier. +Comment[gl]=A súa aplicación esta configurada para compilar. Edite os obxectivos make para persoalizalo ficheiro. +Comment[hu]=Az alkalmazás készen áll a lefordításra. A make-célpontok szerkeszthetők, ha szükséges. +Comment[it]=L'applicazione è configurata per compilare. Modifica i target di make per personalizzare il file. +Comment[nds]=Dien Programm kann opstellt warrn. Bewerk de "Make"-Telen för't Topassen vun de Datei. +Comment[ne]=तपाईँको अनुप्रयोग निर्माण गर्नका लागि सेटअप भएको छ । फाइललाई अनुकूल गर्नका लागि मेक तार्गेटलाई सम्पादन गर्नुहोस् । +Comment[nl]=Uw toepassing kan worden gebouwd. Bewerk de make targets om het bestand naar eigen inzicht aan te passen. +Comment[pl]=Program skonfigurowany. Dostosowanie pliku do własnych potrzeb jest możliwe przez modyfikację celów make. +Comment[pt]=A sua aplicação está preparada para ser compilada. Edite os alvos do 'make' para personalizar o ficheiro. +Comment[pt_BR]=A sua aplicação está preparada para ser compilada. Edite os alvos do 'make' para personalizar o ficheiro. +Comment[ru]=Ваше приложение готово для сборки. +Comment[sk]=Aplikácia je pripravená na build. Môžte si prispôsobiť make ciele. +Comment[sr]=Ваш програм је спреман за градњу. Уредите циљеве справљача да бисте прилагодили фајл. +Comment[sr@Latn]=Vaš program je spreman za gradnju. Uredite ciljeve spravljača da biste prilagodili fajl. +Comment[sv]=Programmet är inställt att byggas. Redigera byggmålen för att anpassa filen. +Comment[tr]=Uygulamanız derlenmeye hazır. Dosyayı özelleştirmek için make hedeflerini düzenleyin. +Comment[zh_CN]=您的应用程序已设置为构建。编辑 make 目标可自定义文件。 +Comment[zh_TW]=您的應用程式已設定好可建立了。請編輯 make 目標來調整檔案。 +Archive=superwaba.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + diff --git a/languages/java/app_templates/superwaba/superwaba.png b/languages/java/app_templates/superwaba/superwaba.png Binary files differnew file mode 100644 index 00000000..3492333d --- /dev/null +++ b/languages/java/app_templates/superwaba/superwaba.png diff --git a/languages/java/app_templates/superwaba/sw.filelist b/languages/java/app_templates/superwaba/sw.filelist new file mode 100644 index 00000000..f219d672 --- /dev/null +++ b/languages/java/app_templates/superwaba/sw.filelist @@ -0,0 +1 @@ +%{APPNAME}.java diff --git a/languages/java/app_templates/superwaba/sw.java b/languages/java/app_templates/superwaba/sw.java new file mode 100644 index 00000000..e1c9927c --- /dev/null +++ b/languages/java/app_templates/superwaba/sw.java @@ -0,0 +1,97 @@ + +/** An example that shows the new user interface gadgets for grayscale */ + +import waba.fx.*; +import waba.sys.*; +import waba.ui.*; + +public class %{APPNAME} extends MainWindow +{ + MenuBar mbar; + Button pushB; + +public %{APPNAME}() +{ + super( "%{APPNAME}", TAB_ONLY_BORDER ); + + setDoubleBuffer( true ); + // use native style? + if ( waba.sys.Settings.platform.equals( "PalmOS" ) ) + { + waba.sys.Settings.setPalmOSStyle( true ); + } + // if we are a color device then we can use a nice color + // otherwise WHITE is the most readable + if ( !waba.sys.Settings.isColor ) + { + Color.defaultBackColor = Color.WHITE; + waba.ui.MainWindow.getMainWindow().setBackColor( Color.WHITE ); + } + else + { + Color.defaultBackColor = new Color( 213, 210, 205 ); + waba.ui.MainWindow.getMainWindow().setBackColor( new Color( 213, 210, 205 ) ); + } +} + +public void onStart() +{ + + initGUI(); + Settings.appSecretKey = "installed"; +} + +// Called by the system to pass events to the application. +public void onEvent( Event event ) +{ + if ( event.type == ControlEvent.WINDOW_CLOSED ) + { + if ( event.target == mbar ) + { + switch ( mbar.getSelectedMenuItem() ) + { + case 1: + quitApp(); + break; + case 101: + showAbout(); + break; + default : + break; + } + } + } + else if ( event.type == ControlEvent.PRESSED ) + { + if ( event.target == pushB ) + { + showAbout(); + } + } +} + +private void showAbout( ) +{ + MessageBox mb = new MessageBox( "%{APPNAME}", "This is a small test app." ); + mb.setDoubleBuffer( true ); + popupBlockingModal( mb ); +} + +private void quitApp() +{ + exit( 0 ); +} + + +private void initGUI() +{ + String col0[] = { "File","Exit..."}; + String col1[] = { "Help","About" }; + + pushB = new Button( "Push me" ); + add(pushB, CENTER, CENTER); + setMenuBar( mbar = new MenuBar( new String[][]{ col0, col1 }) ); + +} + +} diff --git a/languages/java/app_templates/superwaba/sw.kdevelop b/languages/java/app_templates/superwaba/sw.kdevelop new file mode 100644 index 00000000..bddee282 --- /dev/null +++ b/languages/java/app_templates/superwaba/sw.kdevelop @@ -0,0 +1,94 @@ +<?xml version="1.0"?> +<kdevelop> + <general> + <author>%{AUTHOR}</author> + <email>%{EMAIL}</email> + <version>%{VERSION}</version> + <projectmanagement>KDevCustomProject</projectmanagement> + <primarylanguage>Java</primarylanguage> + <ignoreparts> + <part>KDevDebugger</part> + </ignoreparts> + <keywords> + <keyword>Java</keyword> + <keyword>Code</keyword> + </keywords> + </general> + <kdevcustomproject> + <run> + <mainprogram>make test</mainprogram> + <programargs/> + <terminal>true</terminal> + <envvars/> + </run> + <envvars/> + <build> + <buildtool>make</buildtool> + <builddir/> + </build> + <make> + <abortonerror>true</abortonerror> + <numberofjobs>1</numberofjobs> + <dontact>false</dontact> + <makebin/> + <envvars/> + </make> + <makeenvvars/> + </kdevcustomproject> + <kdevfileview> + <groups> + <group pattern="Makefile" name="Build" /> + <group pattern="*.java" name="Source" /> + </groups> + </kdevfileview> + <kdevdoctreeview> + <ignoretocs> + <toc>bash</toc> + <toc>bash_bugs</toc> + <toc>c++_bugs_gcc</toc> + <toc>clanlib</toc> + <toc>w3c-dom-level2-html</toc> + <toc>fortran_bugs_gcc</toc> + <toc>gnome1</toc> + <toc>gnustep</toc> + <toc>gtk</toc> + <toc>gtk_bugs</toc> + <toc>haskell</toc> + <toc>haskell_bugs_ghc</toc> + <toc>kde2book</toc> + <toc>libc</toc> + <toc>libstdc++</toc> + <toc>opengl</toc> + <toc>pascal_bugs_fp</toc> + <toc>php</toc> + <toc>php_bugs</toc> + <toc>perl</toc> + <toc>perl_bugs</toc> + <toc>python</toc> + <toc>python_bugs</toc> + <toc>qt-kdev3</toc> + <toc>ruby</toc> + <toc>ruby_bugs</toc> + <toc>sdl</toc> + <toc>stl</toc> + <toc>w3c-svg</toc> + <toc>w3c-uaag10</toc> + <toc>wxwidgets_bugs</toc> + </ignoretocs> + <ignoreqt_xml> + <toc>Guide to the Qt Translation Tools</toc> + <toc>Qt Assistant Manual</toc> + <toc>Qt Designer Manual</toc> + <toc>Qt Reference Documentation</toc> + <toc>qmake User Guide</toc> + </ignoreqt_xml> + <ignoredoxygen> + <toc>KDE Libraries (Doxygen)</toc> + </ignoredoxygen> + </kdevdoctreeview> + <kdevfilecreate> + <useglobaltypes> + <type ext="java"/> + </useglobaltypes> + </kdevfilecreate> +</kdevelop> diff --git a/languages/java/backgroundparser.cpp b/languages/java/backgroundparser.cpp new file mode 100644 index 00000000..4081949c --- /dev/null +++ b/languages/java/backgroundparser.cpp @@ -0,0 +1,363 @@ +/*************************************************************************** + * Copyright (C) 2002 by Roberto Raggi * + * roberto@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "backgroundparser.h" +#include "javasupportpart.h" +#include "javasupport_events.h" +#include "driver.h" +#include "kdevdeepcopy.h" +#include "kdevdriver.h" + +#if QT_VERSION < 0x030100 +#include <kdevmutex.h> +#else +#include <qmutex.h> +#endif + +#include <kparts/part.h> +#include <ktexteditor/editinterface.h> +#include <ktexteditor/document.h> +#include <ktexteditor/view.h> + +#include <kdevpartcontroller.h> +#include <kdevproject.h> + +#include <kurl.h> +#include <kdebug.h> +#include <kapplication.h> + +#include <qfile.h> +#include <qfileinfo.h> +#include <qtextstream.h> + +class KDevSourceProvider: public SourceProvider +{ +public: + KDevSourceProvider( JavaSupportPart* javaSupport ) + : m_javaSupport( javaSupport ), + m_readFromDisk( false ) {} + + void setReadFromDisk( bool b ) { m_readFromDisk = b; } + bool readFromDisk() const { return m_readFromDisk; } + + virtual QString contents( const QString& fileName ) + { + if( !m_readFromDisk ){ + //kdDebug(9013) << "-------> kapp is locked = " << kapp->locked() << endl; + bool needToLock = kapp->locked() == false; + + if( needToLock ) + kapp->lock(); + + //kdDebug(9013) << "-------> kapp locked" << endl; + + QPtrList<KParts::Part> parts( *m_javaSupport->partController()->parts() ); + QPtrListIterator<KParts::Part> it( parts ); + while( it.current() ){ + KTextEditor::Document* doc = dynamic_cast<KTextEditor::Document*>( it.current() ); + ++it; + + KTextEditor::EditInterface* editIface = dynamic_cast<KTextEditor::EditInterface*>( doc ); + if( !doc || !editIface || doc->url().path() != fileName ) + continue; + + QString contents = QString( editIface->text().ascii() ); // deep copy + + if( needToLock ) + kapp->unlock(); + + //kdDebug(9013) << "-------> kapp unlocked" << endl; + + return contents; + } + + if( needToLock ) + kapp->unlock(); + //kdDebug(9013) << "-------> kapp unlocked" << endl; + } + + QFile f( fileName ); + QTextStream stream( &f ); + if( f.open(IO_ReadOnly) ){ + QString contents = stream.read(); + f.close(); + return contents; + } + + return QString::null; + } + + virtual bool isModified( const QString& fileName ) + { + Q_UNUSED( fileName ); + return true; + } + +private: + JavaSupportPart* m_javaSupport; + bool m_readFromDisk; +private: + KDevSourceProvider( const KDevSourceProvider& source ); + void operator = ( const KDevSourceProvider& source ); +}; + +class SynchronizedFileList +{ +public: + SynchronizedFileList() {} + + bool isEmpty() const + { + QMutexLocker locker( &m_mutex ); + return m_fileList.isEmpty(); + } + + uint count() const + { + QMutexLocker locker( &m_mutex ); + return m_fileList.count(); + } + + QPair<QString, bool> front() const + { + QMutexLocker locker( &m_mutex ); + return m_fileList.front(); + } + + void clear() + { + QMutexLocker locker( &m_mutex ); + m_fileList.clear(); + } + + void push_back( const QString& fileName, bool readFromDisk=false ) + { + QMutexLocker locker( &m_mutex ); + m_fileList.append( qMakePair(fileName, readFromDisk) ); /// \FIXME ROBE deepcopy?! + } + + void pop_front() + { + QMutexLocker locker( &m_mutex ); + m_fileList.pop_front(); + } + + bool contains( const QString& fileName ) const + { + QMutexLocker locker( &m_mutex ); + QValueList< QPair<QString, bool> >::ConstIterator it = m_fileList.begin(); + while( it != m_fileList.end() ){ + if( (*it).first == fileName ) + return true; + ++it; + } + return false; + } + + void remove( const QString& fileName ) + { + QMutexLocker locker( &m_mutex ); + QValueList< QPair<QString, bool> >::Iterator it = m_fileList.begin(); + while( it != m_fileList.end() ){ + if( (*it).first == fileName ) + m_fileList.remove( it ); + ++it; + } + } + +private: + mutable QMutex m_mutex; + QValueList< QPair<QString, bool> > m_fileList; +}; + +BackgroundParser::BackgroundParser( JavaSupportPart* part, QWaitCondition* consumed ) + : m_consumed( consumed ), m_javaSupport( part ), m_close( false ) +{ + m_fileList = new SynchronizedFileList(); + m_driver = new KDevDriver( m_javaSupport ); + m_driver->setSourceProvider( new KDevSourceProvider(m_javaSupport) ); + //disabled for now m_driver->setResolveDependencesEnabled( true ); +} + +BackgroundParser::~BackgroundParser() +{ + removeAllFiles(); + + delete( m_driver ); + m_driver = 0; + + delete m_fileList; + m_fileList = 0; +} + +void BackgroundParser::addFile( const QString& fileName, bool readFromDisk ) +{ + QString fn = deepCopy( fileName ); + + bool added = false; + if( !m_fileList->contains(fn) ){ + m_fileList->push_back( fn, readFromDisk ); + added = true; + } + + if( added ) + m_canParse.wakeAll(); +} + +void BackgroundParser::removeAllFiles() +{ + kdDebug(9013) << "BackgroundParser::removeAllFiles()" << endl; + QMutexLocker locker( &m_mutex ); + + QMap<QString, Unit*>::Iterator it = m_unitDict.begin(); + while( it != m_unitDict.end() ){ + Unit* unit = it.data(); + ++it; + delete( unit ); + unit = 0; + } + m_unitDict.clear(); + m_driver->reset(); + m_fileList->clear(); + + m_isEmpty.wakeAll(); +} + +void BackgroundParser::removeFile( const QString& fileName ) +{ + QMutexLocker locker( &m_mutex ); + + if( Unit* unit = findUnit(fileName) ){ + m_driver->remove( fileName ); + m_unitDict.remove( fileName ); + delete( unit ); + unit = 0; + } + + if( m_fileList->isEmpty() ) + m_isEmpty.wakeAll(); +} + +Unit* BackgroundParser::parseFile( const QString& fileName, bool readFromDisk ) +{ + static_cast<KDevSourceProvider*>( m_driver->sourceProvider() )->setReadFromDisk( readFromDisk ); + + m_driver->remove( fileName ); + m_driver->parseFile( fileName ); + RefJavaAST translationUnit = m_driver->takeTranslationUnit( fileName ); + + Unit* unit = new Unit; + unit->fileName = fileName; + unit->translationUnit = translationUnit; + unit->problems = m_driver->problems( fileName ); + + static_cast<KDevSourceProvider*>( m_driver->sourceProvider() )->setReadFromDisk( false ); + + if( m_unitDict.find(fileName) != m_unitDict.end() ){ + Unit* u = m_unitDict[ fileName ]; + m_unitDict.remove( fileName ); + delete( u ); + u = 0; + } + + m_unitDict.insert( fileName, unit ); + + if( m_fileList->contains(fileName) ){ + kdDebug(9013) << "========================> FILE: " << fileName << " IN QUEUE <=============" << endl; + } else { + KApplication::postEvent( m_javaSupport, new FileParsedEvent(fileName, unit->problems) ); + } + + m_currentFile = QString::null; + + if( m_fileList->isEmpty() ) + m_isEmpty.wakeAll(); + + return unit; +} + +Unit* BackgroundParser::findUnit( const QString& fileName ) +{ + QMap<QString, Unit*>::Iterator it = m_unitDict.find( fileName ); + return it != m_unitDict.end() ? *it : 0; +} + +RefJavaAST BackgroundParser::translationUnit( const QString& fileName ) +{ + Unit* u = 0; + if( (u = findUnit(fileName)) == 0 ){ + m_fileList->remove( fileName ); + u = parseFile( fileName, false ); + } + + return u->translationUnit; +} + +QValueList<Problem> BackgroundParser::problems( const QString& fileName ) +{ + Unit* u = 0; + if( (u = findUnit(fileName)) == 0 ){ + m_fileList->remove( fileName ); + u = parseFile( fileName, false ); + } + + return u ? u->problems : QValueList<Problem>(); +} + +void BackgroundParser::close() +{ + QMutexLocker locker( &m_mutex ); + m_close = true; + m_canParse.wakeAll(); +} + +bool BackgroundParser::filesInQueue() +{ + QMutexLocker locker( &m_mutex ); + + return m_fileList->count() || !m_currentFile.isEmpty(); +} + +void BackgroundParser::run() +{ + // (void) m_javaSupport->codeCompletion()->repository()->getEntriesInScope( QStringList(), false ); + + while( !m_close ){ + + m_mutex.lock(); + while( m_fileList->isEmpty() ){ + m_canParse.wait( &m_mutex ); + + if( m_close ){ + break; + } + } + + if( m_close ){ + m_mutex.unlock(); + break; + } + + QPair<QString, bool> entry = m_fileList->front(); + QString fileName = entry.first; + bool readFromDisk = entry.second; + m_currentFile = fileName; + m_fileList->pop_front(); + + (void) parseFile( fileName, readFromDisk ); + m_mutex.unlock(); + } + + kdDebug(9013) << "!!!!!!!!!!!!!!!!!! BG PARSER DESTROYED !!!!!!!!!!!!" << endl; + + //commented to fix #83352 + //QThread::exit(); +} diff --git a/languages/java/backgroundparser.h b/languages/java/backgroundparser.h new file mode 100644 index 00000000..2029ebf5 --- /dev/null +++ b/languages/java/backgroundparser.h @@ -0,0 +1,86 @@ +/*************************************************************************** + * Copyright (C) 2002 by Roberto Raggi * + * roberto@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef BACKGROUNDPARSER_H +#define BACKGROUNDPARSER_H + +#include "driver.h" +#include "JavaAST.hpp" + +#include <qthread.h> +#include <qwaitcondition.h> +#include <qmutex.h> +#include <qmap.h> +#include <kdebug.h> + +class JavaSupportPart; +class TranslationUnitAST; +class SynchronizedFileList; + +class Unit +{ +public: + Unit() {} + ~Unit() {} + + QString fileName; + QValueList<Problem> problems; + RefJavaAST translationUnit; + +protected: + Unit( const Unit& source ); + void operator = ( const Unit& source ); +}; + +class BackgroundParser: public QThread +{ +public: + BackgroundParser( JavaSupportPart*, QWaitCondition* consumed ); + virtual ~BackgroundParser(); + + QMutex& mutex() { return m_mutex; } + void lock() { m_mutex.lock(); } + void unlock() { m_mutex.unlock(); } + + QWaitCondition& canParse() { return m_canParse; } + QWaitCondition& isEmpty() { return m_isEmpty; } + + bool filesInQueue(); + + void addFile( const QString& fileName, bool readFromDisk=false ); + void removeFile( const QString& fileName ); + void removeAllFiles(); + + RefJavaAST translationUnit( const QString& fileName ); + QValueList<Problem> problems( const QString& fileName ); + + void close(); + + virtual void run(); + +protected: + Unit* findUnit( const QString& fileName ); + Unit* parseFile( const QString& fileName, bool readFromDisk ); + +private: + class KDevDriver* m_driver; + QString m_currentFile; + QWaitCondition m_canParse; + QWaitCondition m_isEmpty; + QWaitCondition* m_consumed; + QMutex m_mutex; + SynchronizedFileList* m_fileList; + JavaSupportPart* m_javaSupport; + bool m_close; + QMap<QString, Unit*> m_unitDict; +}; + +#endif diff --git a/languages/java/configproblemreporter.ui b/languages/java/configproblemreporter.ui new file mode 100644 index 00000000..580f60c4 --- /dev/null +++ b/languages/java/configproblemreporter.ui @@ -0,0 +1,257 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>ConfigureProblemReporter</class> +<widget class="QWidget"> + <property name="name"> + <cstring>ConfigureProblemReporter</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>588</width> + <height>490</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>&Parsing</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>bgParserCheckbox</cstring> + </property> + <property name="text"> + <string>&Enable background parsing</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>delayLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>msec</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignLeft</set> + </property> + </widget> + </hbox> + </widget> + <widget class="QSlider"> + <property name="name"> + <cstring>delaySlider</cstring> + </property> + <property name="maxValue"> + <number>2000</number> + </property> + <property name="lineStep"> + <number>250</number> + </property> + <property name="pageStep"> + <number>500</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="tickmarks"> + <enum>Right</enum> + </property> + <property name="tickInterval"> + <number>250</number> + </property> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox3</cstring> + </property> + <property name="title"> + <string>&Special Headers</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView" row="0" column="0" rowspan="5" colspan="1"> + <column> + <property name="text"> + <string></string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>specialHeaderListView</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + </widget> + <spacer row="4" column="1"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>61</height> + </size> + </property> + </spacer> + <widget class="QPushButton" row="3" column="1"> + <property name="name"> + <cstring>pushButton6</cstring> + </property> + <property name="text"> + <string>Move &Down</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>pushButton5</cstring> + </property> + <property name="text"> + <string>Move &Up</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton" row="0" column="1"> + <property name="name"> + <cstring>pushButton3</cstring> + </property> + <property name="text"> + <string>&Add</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton" row="1" column="1"> + <property name="name"> + <cstring>pushButton4</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>delaySlider</sender> + <signal>valueChanged(int)</signal> + <receiver>ConfigureProblemReporter</receiver> + <slot>setDelayLabel(int)</slot> + </connection> + <connection> + <sender>bgParserCheckbox</sender> + <signal>toggled(bool)</signal> + <receiver>ConfigureProblemReporter</receiver> + <slot>bgParserCheckbox_toggled(bool)</slot> + </connection> + <connection> + <sender>pushButton3</sender> + <signal>clicked()</signal> + <receiver>ConfigureProblemReporter</receiver> + <slot>addSpecialHeader()</slot> + </connection> + <connection> + <sender>pushButton4</sender> + <signal>clicked()</signal> + <receiver>ConfigureProblemReporter</receiver> + <slot>removeSpecialHeader()</slot> + </connection> + <connection> + <sender>pushButton5</sender> + <signal>clicked()</signal> + <receiver>ConfigureProblemReporter</receiver> + <slot>moveUpSpecialHeader()</slot> + </connection> + <connection> + <sender>pushButton6</sender> + <signal>clicked()</signal> + <receiver>ConfigureProblemReporter</receiver> + <slot>moveDownSpecialHeader()</slot> + </connection> +</connections> +<tabstops> + <tabstop>bgParserCheckbox</tabstop> + <tabstop>delaySlider</tabstop> + <tabstop>specialHeaderListView</tabstop> + <tabstop>pushButton3</tabstop> + <tabstop>pushButton4</tabstop> + <tabstop>pushButton5</tabstop> + <tabstop>pushButton6</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> + <include location="local" impldecl="in implementation">configproblemreporter.ui.h</include> +</includes> +<slots> + <slot>init()</slot> + <slot>destroy()</slot> + <slot>accept()</slot> + <slot>bgParserCheckbox_toggled( bool b )</slot> + <slot access="protected">setDelayLabel( int delay )</slot> + <slot>addSpecialHeader()</slot> + <slot>removeSpecialHeader()</slot> + <slot>moveUpSpecialHeader()</slot> + <slot>moveDownSpecialHeader()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>klistview.h</includehint> +</includehints> +</UI> diff --git a/languages/java/configproblemreporter.ui.h b/languages/java/configproblemreporter.ui.h new file mode 100644 index 00000000..f68a0c80 --- /dev/null +++ b/languages/java/configproblemreporter.ui.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use Qt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ +#include <kconfig.h> +#include <kapplication.h> +#include <klocale.h> + +void ConfigureProblemReporter::init() +{ + KConfig* config = kapp->config(); + config->setGroup( "General Options" ); + bgParserCheckbox->setChecked( config->readBoolEntry("EnableJavaBgParser", true) ); + delaySlider->setEnabled( bgParserCheckbox->isChecked() ); + delaySlider->setValue( config->readNumEntry("BgParserDelay", 500) ); + setDelayLabel( delaySlider->value() ); +} + +void ConfigureProblemReporter::destroy() +{ +} + +void ConfigureProblemReporter::accept() +{ + KConfig* config = kapp->config(); + config->setGroup( "General Options" ); + config->writeEntry( "EnableJavaBgParser", bgParserCheckbox->isChecked() ); + if( bgParserCheckbox->isChecked() ) + config->writeEntry( "BgParserDelay", delaySlider->value() ); + config->sync(); +} + + +void ConfigureProblemReporter::bgParserCheckbox_toggled( bool b ) +{ + delaySlider->setEnabled( b ); + if ( b == TRUE ) + delayLabel->show(); + else + delayLabel->hide(); +} + + +void ConfigureProblemReporter::setDelayLabel( int delay ) +{ + delayLabel->setText( i18n( "delay: %1 msec" ).arg( delay ) ); +} + + +void ConfigureProblemReporter::addSpecialHeader() +{ + +} + + +void ConfigureProblemReporter::removeSpecialHeader() +{ + +} + + +void ConfigureProblemReporter::moveUpSpecialHeader() +{ + +} + + +void ConfigureProblemReporter::moveDownSpecialHeader() +{ + +} diff --git a/languages/java/doc/Makefile.am b/languages/java/doc/Makefile.am new file mode 100644 index 00000000..adb0f24f --- /dev/null +++ b/languages/java/doc/Makefile.am @@ -0,0 +1,6 @@ +tocdir = ${kde_datadir}/kdevdocumentation/tocs +toc_DATA = sw.toc java_bugs_gcc.toc java_bugs_sun.toc + +#indexdir = ${kde_datadir}/devdoctreeview/indices +#index_DATA = + diff --git a/languages/java/doc/java_bugs_gcc.toc b/languages/java/doc/java_bugs_gcc.toc new file mode 100644 index 00000000..8162d1e1 --- /dev/null +++ b/languages/java/doc/java_bugs_gcc.toc @@ -0,0 +1,7 @@ +<!DOCTYPE kdeveloptoc> +<kdeveloptoc> +<title>Java bugs (GCC)</title> +<base href="http://gcc.gnu.org/bugzilla/"/> +<tocsect1 name="Query" url="query.cgi"> +</tocsect1> +</kdeveloptoc> diff --git a/languages/java/doc/java_bugs_sun.toc b/languages/java/doc/java_bugs_sun.toc new file mode 100644 index 00000000..779f2a32 --- /dev/null +++ b/languages/java/doc/java_bugs_sun.toc @@ -0,0 +1,7 @@ +<!DOCTYPE kdeveloptoc> +<kdeveloptoc> +<title>Java bugs (Sun)</title> +<base href="http://developer.java.sun.com/developer/bugParade/"/> +<tocsect1 name="Query" url="index.jshtml"> +</tocsect1> +</kdeveloptoc> diff --git a/languages/java/doc/sw.toc b/languages/java/doc/sw.toc new file mode 100644 index 00000000..da6356d2 --- /dev/null +++ b/languages/java/doc/sw.toc @@ -0,0 +1,146 @@ +<!DOCTYPE kdeveloptoc> +<kdeveloptoc> +<title>SuperWaba 3.4.1 API</title> +<base href="http://www.superwaba.com.br/doc/"/> +<tocsect1 name="java.lang" url="java/lang/package-summary.html"> + <tocsect2 name="Class" url="java/lang/Class.html"/> + <tocsect2 name="Math" url="java/lang/Math.html"/> + <tocsect2 name="Object" url="java/lang/Object.html"/> + <tocsect2 name="String" url="java/lang/String.html"/> + <tocsect2 name="StringBuffer" url="java/lang/StringBuffer.html"/> + <tocsect2 name="Throwable" url="java/lang/Throwable.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.palm.io.builtin" url="superwaba/ext/palm/io/builtin/package-summary.html"> + <tocsect2 name="Address" url="superwaba/ext/palm/io/builtin/Address.html"/> + <tocsect2 name="Datebook" url="superwaba/ext/palm/io/builtin/Datebook.html"/> + <tocsect2 name="Mail" url="superwaba/ext/palm/io/builtin/Mail.html"/> + <tocsect2 name="Memo" url="superwaba/ext/palm/io/builtin/Memo.html"/> + <tocsect2 name="ToDo" url="superwaba/ext/palm/io/builtin/ToDo.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.palm.io.scanner" url="superwaba/ext/palm/io/scanner/package-summary.html"> + <tocsect2 name="ScanEvent" url="superwaba/ext/palm/io/scanner/ScanEvent.html"/> + <tocsect2 name="Scan" url="superwaba/ext/palm/io/scanner/Scan.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.game" url="superwaba/ext/xplat/game/package-summary.html"> + <tocsect2 name="AnimatedButton" url="superwaba/ext/xplat/game/AnimatedButton.html"/> + <tocsect2 name="AnimatedSprite" url="superwaba/ext/xplat/game/AnimatedSprite.html"/> + <tocsect2 name="Animation" url="superwaba/ext/xplat/game/Animation.html"/> + <tocsect2 name="AnimationEvent" url="superwaba/ext/xplat/game/AnimationEvent.html"/> + <tocsect2 name="GameEngine" url="superwaba/ext/xplat/game/GameEngine.html"/> + <tocsect2 name="HighScoreEntry" url="superwaba/ext/xplat/game/HightScoreEntry.html"/> + <tocsect2 name="HighScores" url="superwaba/ext/xplat/game/HighScores.html"/> + <tocsect2 name="Options" url="superwaba/ext/xplat/game/Options.html"/> + <tocsect2 name="Sprite" url="superwaba/ext/xplat/game/Sprite.html"/> + <tocsect2 name="TextRenderer" url="superwaba/ext/xplat/game/TextRenderer.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.io" url="superwaba/ext/xplat/io/package-summary.html"> + <tocsect2 name="Storable" url="superwaba/ext/xplat/io/Storable.html"/> + <tocsect2 name="DataStream" url="superwaba/ext/xplat/io/DataStream.html"/> + <tocsect2 name="SerialPDB" url="superwaba/ext/xplat/io/SerialPDB.html"/> + <tocsect2 name="ObjectCatalog" url="superwaba/ext/xplat/io/ObjectCatalog.html"/> + <tocsect2 name="SerialPDBServer" url="superwaba/ext/xplat/io/SerialPDBServer.html"/> + <tocsect2 name="SerialSocketServer" url="superwaba/ext/xplat/io/SerialSocketServer.html"/> + <tocsect2 name="SerialSocket" url="superwaba/ext/xplat/io/SerialSocket.html"/> + <tocsect2 name="BufferStream" url="superwaba/ext/xplat/io/BufferStream.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.io.gps" url="superwaba/ext/xplat.io.gps/package-summary.html"> + <tocsect2 name="GPS" url="superwaba/ext/xplat/io/gps/GPS.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.io.gps.garmin" url="superwaba/ext/xplat/io/gps/garmin/package-summary.html"> + <tocsect2 name="Waypoint" url="superwaba/ext/xplat/io/gps/garmin/Waypoint.html"/> + <tocsect2 name="Route" url="superwaba/ext/xplat/io/gps/garmin/Route.html"/> + <tocsect2 name="Packet" url="superwaba/ext/xplat/io/gps/garmin/Packet.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.sql" url="superwaba/ext/.xplat/sql/package-summary.html"> + <tocsect2 name="BatchUpdateException" url="superwaba/ext/xplat/sql/BatchUpdateException.html"/> + <tocsect2 name="Connection" url="superwaba/ext/xplat/sql/Connection.html"/> + <tocsect2 name="ResultSet" url="superwaba/ext/xplat/sql/ResultSet.html"/> + <tocsect2 name="SQLWarning" url="superwaba/ext/xplat/sql/SQLWarning.html"/> + <tocsect2 name="Driver" url="superwaba/ext/xplat/sql/Driver.html"/> + <tocsect2 name="Timestamp" url="superwaba/ext/xplat/sql/Timestamp.html"/> + <tocsect2 name="Blob" url="superwaba/ext/xplat/sql/Blob.html"/> + <tocsect2 name="DriverPropertyInfo" url="superwaba/ext/xplat/sql/DriverPropertyInfo.html"/> + <tocsect2 name="Ref" url="superwaba/ext/xplat/sql/Ref.html"/> + <tocsect2 name="Statement" url="superwaba/ext/xplat/sql/Statement.html"/> + <tocsect2 name="Types" url="superwaba/ext/xplat/sql/Types.html"/> + <tocsect2 name="PreparedStatement" url="superwaba/ext/xplat/sql/PreparedStatement.htm"/>l + <tocsect2 name="SQLException" url="superwaba/ext/xplat/sql/SQLException.html"/> + <tocsect2 name="c" url="superwaba/ext/xplat/sql/c.html"/> + <tocsect2 name="DataTruncation" url="superwaba/ext/xplat/sql/DatabaseMetaData.html"/> + <tocsect2 name="Time" url="superwaba/ext/xplat/sql/Time.html"/> + <tocsect2 name="ResultSetMetaData" url="superwaba/ext/xplat/sql/ResultSetMetaData.html"/> + <tocsect2 name="ParameterMetaData" url="superwaba/ext/xplat/sql/ParameterMetaData.html"/> + <tocsect2 name="DriverManager" url="superwaba/ext/xplat/sql/DriverManager.html"/> + <tocsect2 name="Date" url="superwaba/ext/xplat/sql/Date.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.sql.db2e" url="superwaba/ext/.xplat/sql/db2e/package-summary.html"> + <tocsect2 name="Driver" url="superwaba/ext/xplat/sql/db2e/wdbc/Driver.html"/> + <tocsect2 name="BoundDate" url="superwaba/ext/xplat/sql/db2e/BoundDate.html"/> + <tocsect2 name="BoundTimestamp" url="superwaba/ext/xplat/sql/db2e/BoundTimestamp.html"/> + <tocsect2 name="c" url="superwaba/ext/xplat/sql/db2e/c.html"/> + <tocsect2 name="BoundInt" url="superwaba/ext/xplat/sql/db2e/BoundInt.html"/> + <tocsect2 name="DB2Exception" url="superwaba/ext/xplat/sql/db2e/DB2Exception.html"/> + <tocsect2 name="BoundBlob" url="superwaba/ext/xplat/sql/db2e/BoundBlob.html"/> + <tocsect2 name="Db2e" url="superwaba/ext/xplat/sql/db2e/Db2e.html"/> + <tocsect2 name="BoundString" url="superwaba/ext/xplat/sql/db2e/BoundString.html"/> + <tocsect2 name="BoundTime" url="superwaba/ext/xplat/sql/db2e/BoundTime.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.sql.db2e.wdbc" url="superwaba/ext/xplat/sql/db2e/wdbc/package-summary.html"> + <tocsect2 name="Db2eConnection" url="superwaba/ext/xplat/sql/db2e/wdbc/Db2eConnection.html"/> + <tocsect2 name="Db2eMetaData" url="superwaba/ext/xplat/sql/db2e/wdbc/Db2eMetaData.html"/> + <tocsect2 name="Db2eStatement" url="superwaba/ext/xplat/sql/db2e/wdbc/Db2eStatement.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.ui" url="superwaba/ext/xplat/ui/package-summary.html"> + <tocsect2 name="MultiEditMenu" url="superwaba/ext/xplat/ui/MultiEditMenu.html"/> + <tocsect2 name="ChoicesDialog" url="superwaba/ext/xplat/ui/ChoicesDialog.html"/> + <tocsect2 name="Grid" url="superwaba/ext/xplat/ui/Grid.html"/> + <tocsect2 name="ProgressBar" url="superwaba/ext/xplat/ui/ProgressBar.html"/> + <tocsect2 name="JustifiedContainer" url="superwaba/ext/xplat/ui/JustifiedContainer.html"/> + <tocsect2 name="BigNumber" url="superwaba/ext/xplat/ui/BigNumber.html"/> + <tocsect2 name="MultiEdit" url="superwaba/ext/xplat/ui/MultiEdit.html"/> + <tocsect2 name="SpinList" url="superwaba/ext/xplat/ui/SpinList.html"/> + <tocsect2 name="GridModel" url="superwaba/ext/xplat/ui/GridModel.html"/> + <tocsect2 name="GridContainer" url="superwaba/ext/xplat/ui/GridContainer.html"/> + <tocsect2 name="ColorList" url="superwaba/ext/xplat/ui/ColorList.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.util" url="superwaba/ext/xplat/util/package-summary.html"> + <tocsect2 name="Compression" url="superwaba/ext/xplat/util/Compression.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.util.crypto" url="superwaba/ext/xplat/util/crypto/package-summary.html"> + <tocsect2 name="MD5" url="superwaba/ext/xplat/util/crypto/MD5.html"/> + <tocsect2 name="BlowfishECB" url="superwaba/ext/xplat/util/crypto/BlowfishECB.html"/> + <tocsect2 name="SHA1" url="superwaba/ext/xplat/util/crypto/SHA1.html"/> + <tocsect2 name="BinConverter" url="superwaba/ext/xplat/util/crypto/BinConverter.html"/> + <tocsect2 name="TEA" url="superwaba/ext/xplat/util/crypto/TEA.html"/> + <tocsect2 name="BlowfishCBC" url="superwaba/ext/xplat/util/crypto/BlowfishCBC.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.util.datergf" url="superwaba/ext/xplat/util/datergf/package-summary.html"> + <tocsect2 name="DateTime" url="superwaba/ext/xplat/util/datergf/DateTime.html"/> + <tocsect2 name="DTC" url="superwaba/ext/xplat/util/datergf/DTC.html"/> + <tocsect2 name="Calendar" url="superwaba/ext/xplat/util/datergf/Calendar.html"/> + <tocsect2 name="Time" url="superwaba/ext/xplat/util/datergf/Time.html"/> + <tocsect2 name="Date" url="superwaba/ext/xplat/util/datergf/Date.html"/> + <tocsect2 name="DateFormat" url="superwaba/ext/xplat/util/datergf/DateFormat.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.util.xml" url="superwaba/ext/xplat/util/xml/package-summary.html"> + <tocsect2 name="XmlListener" url="superwaba/ext/xplat/util/xml/XmlListener.html"/> + <tocsect2 name="LiteParser" url="superwaba/ext/xplat/util/xml/LiteParser.html"/> + <tocsect2 name="HttpLiteParser" url="superwaba/ext/xplat/util/xml/HttpLiteParser.html"/> + <tocsect2 name="StreamBuffer" url="superwaba/ext/xplat/util/xml/StreamBuffer.html"/> + <tocsect2 name="HttpListener" url="superwaba/ext/xplat/util/xml/HttpListener.html"/> + <tocsect2 name="XmlLiteParser" url="superwaba/ext/xplat/util/xml/XmlLiteParser.html"/> + <tocsect2 name="HttpXmlListener" url="superwaba/ext/xplat/util/xml/HttpXmlListener.html"/> + <tocsect2 name="HttpXmlLiteParser" url="superwaba/ext/xplat/util/xml/HttpXmlLiteParser.html"/> + <tocsect2 name="ParserException" url="superwaba/ext/xplat/util/xml/ParserException.html"/> +</tocsect1> +<tocsect1 name="superwaba.ext.xplat.util.props" url="superwaba/ext/xplat/util/props/package-summary.html"> + <tocsect2 name="Properties.Value" url="superwaba/ext/xplat/util/props/Properties.Value.html"/> + <tocsect2 name="Properties" url="superwaba/ext/xplat/util/props/Properties.html"/> + <tocsect2 name="Properties.Double" url="superwaba/ext/xplat/util/props/Properties.Double.html"/> + <tocsect2 name="Properties.Long" url="superwaba/ext/xplat/util/props/Properties.Long.html"/> + <tocsect2 name="Properties.Str" url="superwaba/ext/xplat/util/props/Properties.Str.html"/> + <tocsect2 name="Properties.Int" url="superwaba/ext/xplat/util/props/Properties.Int.html"/> + <tocsect2 name="Properties.Boolean" url="superwaba/ext/xplat/util/props/Properties.Boolean.html"/> +</tocsect1> +</kdeveloptoc> + diff --git a/languages/java/driver.cpp b/languages/java/driver.cpp new file mode 100644 index 00000000..f5bb6bfc --- /dev/null +++ b/languages/java/driver.cpp @@ -0,0 +1,227 @@ +/* This file is part of KDevelop + Copyright (C) 2002,2003 Roberto Raggi <roberto@kdevelop.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "JavaAST.hpp" +#include "JavaLexer.hpp" +#include "JavaRecognizer.hpp" + +#include <kdebug.h> +#include <stdlib.h> +#include <qfile.h> +#include <qfileinfo.h> +#include <qdir.h> + +#include <string> +#include <sstream> + +class DefaultSourceProvider: public SourceProvider +{ +public: + DefaultSourceProvider() {} + + virtual QString contents( const QString& fileName ) + { + QString source; + + QFile f( fileName ); + if( f.open(IO_ReadOnly) ){ + QTextStream s( &f ); + source = s.read(); + f.close(); + } + return source; + } + + virtual bool isModified( const QString& fileName ) + { + Q_UNUSED( fileName ); + return true; + } + +private: + DefaultSourceProvider( const DefaultSourceProvider& source ); + void operator = ( const DefaultSourceProvider& source ); +}; + + +Driver::Driver() + : lexer( 0 ) +{ + m_sourceProvider = new DefaultSourceProvider(); +} + +Driver::~Driver() +{ + reset(); + delete( m_sourceProvider ); +} + +SourceProvider* Driver::sourceProvider() +{ + return m_sourceProvider; +} + +void Driver::setSourceProvider( SourceProvider* sourceProvider ) +{ + if( m_sourceProvider ) + delete( m_sourceProvider ); + m_sourceProvider = sourceProvider; +} + +void Driver::reset( ) +{ + m_problems.clear(); + m_includePaths.clear(); + + while( m_parsedUnits.size() ){ + RefJavaAST unit = *m_parsedUnits.begin(); + m_parsedUnits.remove( m_parsedUnits.begin() ); + delete( unit ); + } +} + +void Driver::remove( const QString & fileName ) +{ + m_problems.remove( fileName ); + + QMap<QString, RefJavaAST>::Iterator it = m_parsedUnits.find( fileName ); + if( it != m_parsedUnits.end() ){ + RefJavaAST unit = *it; + m_parsedUnits.remove( it ); + delete( unit ); + } +} + +RefJavaAST Driver::takeTranslationUnit( const QString& fileName ) +{ + QMap<QString, RefJavaAST>::Iterator it = m_parsedUnits.find( fileName ); + RefJavaAST unit( *it ); + //m_parsedUnits.remove( it ); + m_parsedUnits[ fileName] = 0; + return unit; +} + +RefJavaAST Driver::translationUnit( const QString& fileName ) const +{ + QMap<QString, RefJavaAST>::ConstIterator it = m_parsedUnits.find( fileName ); + return it != m_parsedUnits.end() ? *it : RefJavaAST(); +} + +void Driver::addProblem( const QString & fileName, const Problem & problem ) +{ + findOrInsertProblemList( fileName ).append( problem ); +} + +QValueList < Problem >& Driver::findOrInsertProblemList( const QString & fileName ) +{ + QMap<QString, QValueList<Problem> >::Iterator it = m_problems.find( fileName ); + if( it != m_problems.end() ) + return it.data(); + + QValueList<Problem> l; + m_problems.insert( fileName, l ); + return m_problems[ fileName ]; +} + +QValueList < Problem > Driver::problems( const QString & fileName ) const +{ + QMap<QString, QValueList<Problem> >::ConstIterator it = m_problems.find( fileName ); + if( it != m_problems.end() ) + return it.data(); + return QValueList<Problem>(); +} + +void Driver::parseFile( const QString& fileName, bool onlyPreProcess, bool force ) +{ + QFileInfo fileInfo( fileName ); + QString absFilePath = fileInfo.absFilePath(); + + QMap<QString, RefJavaAST>::Iterator it = m_parsedUnits.find( absFilePath ); + + if( force && it != m_parsedUnits.end() ){ + takeTranslationUnit( absFilePath ); + } else if( it != m_parsedUnits.end() && *it != 0 ){ + // file already processed + return; + } + + m_problems.remove( fileName ); + + m_currentFileName = fileName; + + std::string source( sourceProvider()->contents(fileName).utf8() ); + std::istringstream in( source.c_str() ); + + JavaLexer lex( in ); + lex.setDriver( this ); + lexer = &lex; + setupLexer( &lex ); + + + /// @todo lex.setSource( sourceProvider()->contents(fileName) ); + + RefJavaAST translationUnit; + if( !onlyPreProcess ){ + JavaRecognizer parser( lex ); + parser.setDriver( this ); + setupParser( &parser ); + + + try{ + // make an ast factory + ANTLR_USE_NAMESPACE(antlr)JavaASTFactory ast_factory; + // initialize and put it in the parser... + parser.initializeASTFactory (ast_factory); + parser.setASTFactory (&ast_factory); + + parser.compilationUnit(); + + RefJavaAST translationUnit = RefJavaAST( parser.getAST() ); + m_parsedUnits.insert( fileName, translationUnit ); + + } catch( ANTLR_USE_NAMESPACE(antlr)ANTLRException& ex ){} + + } + + m_currentFileName = QString::null; + lexer = 0; + + fileParsed( fileName ); +} + +void Driver::setupLexer( JavaLexer * // lexer + ) +{ +} + +void Driver::setupParser( JavaRecognizer * parser ) +{ + Q_UNUSED( parser ); +} + +void Driver::addIncludePath( const QString &path ) +{ + if( !path.stripWhiteSpace().isEmpty() ) + m_includePaths << path; +} + +void Driver::fileParsed( const QString & fileName ) +{ + Q_UNUSED( fileName ); +} diff --git a/languages/java/driver.h b/languages/java/driver.h new file mode 100644 index 00000000..c830875e --- /dev/null +++ b/languages/java/driver.h @@ -0,0 +1,139 @@ +/* This file is part of KDevelop + Copyright (C) 2002,2003 Roberto Raggi <roberto@kdevelop.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef DRIVER_H +#define DRIVER_H + +#include "JavaAST.hpp" + +#include <qpair.h> +#include <qvaluestack.h> +#include <qstringlist.h> +#include <qmap.h> + +class JavaLexer; +class JavaRecognizer; + +class Problem +{ +public: + enum + { + Level_Error = 0, + Level_Warning, + Level_Todo, + Level_Fixme + }; + +public: + Problem() {} + Problem( const Problem& source ) + : m_text( source.m_text ), m_line( source.m_line ), + m_column( source.m_column ), m_level( source.m_level ) {} + Problem( const QString& text, int line, int column, int level=Level_Error ) + : m_text( text ), m_line( line ), m_column( column ), m_level(level) {} + + Problem& operator = ( const Problem& source ) + { + m_text = source.m_text; + m_line = source.m_line; + m_column = source.m_column; + m_level = source.m_level; + return( *this ); + } + + bool operator == ( const Problem& p ) const + { + return m_text == p.m_text && m_line == p.m_line && m_column == p.m_column && m_level == p.m_level; + } + + QString text() const { return m_text; } + int line() const { return m_line; } + int column() const { return m_column; } + int level() const { return m_level; } + +private: + QString m_text; + int m_line; + int m_column; + int m_level; +}; + +class SourceProvider +{ +public: + SourceProvider() {} + virtual ~SourceProvider() {} + + virtual QString contents( const QString& fileName ) = 0; + virtual bool isModified( const QString& fileName ) = 0; + +private: + SourceProvider( const SourceProvider& source ); + void operator = ( const SourceProvider& source ); +}; + +class Driver +{ +public: + Driver(); + virtual ~Driver(); + + SourceProvider* sourceProvider(); + void setSourceProvider( SourceProvider* sourceProvider ); + + virtual void reset(); + + virtual void parseFile( const QString& fileName, bool onlyPreProcesss=false, bool force=false ); + virtual void fileParsed( const QString& fileName ); + virtual void remove( const QString& fileName ); + + virtual void addProblem( const QString& fileName, const Problem& problem ); + + QString currentFileName() const { return m_currentFileName; } + RefJavaAST takeTranslationUnit( const QString& fileName ); + RefJavaAST translationUnit( const QString& fileName ) const; + QValueList<Problem> problems( const QString& fileName ) const; + + QStringList includePaths() const { return m_includePaths; } + virtual void addIncludePath( const QString &path ); + + const QMap<QString, RefJavaAST> &parsedUnits() const { return m_parsedUnits; } + +protected: + virtual void setupLexer( JavaLexer* lexer ); + virtual void setupParser( JavaRecognizer* parser ); + +private: + QValueList<Problem>& findOrInsertProblemList( const QString& fileName ); + +private: + QString m_currentFileName; + QMap< QString, QValueList<Problem> > m_problems; + QMap< QString, RefJavaAST > m_parsedUnits; + QStringList m_includePaths; + JavaLexer *lexer; + SourceProvider* m_sourceProvider; + +private: + Driver( const Driver& source ); + void operator = ( const Driver& source ); +}; + +#endif diff --git a/languages/java/file_templates/Makefile.am b/languages/java/file_templates/Makefile.am new file mode 100644 index 00000000..dc3b82a9 --- /dev/null +++ b/languages/java/file_templates/Makefile.am @@ -0,0 +1,4 @@ +templatedir = $(kde_datadir)/kdevfilecreate/file-templates +template_DATA = java + + diff --git a/languages/java/file_templates/java b/languages/java/file_templates/java new file mode 100644 index 00000000..f490b79c --- /dev/null +++ b/languages/java/file_templates/java @@ -0,0 +1,6 @@ +/* + * Author: $AUTHOR$ <$EMAIL$>, (C) $YEAR$ + * + * Copyright: See COPYING file that comes with this distribution + * +*/ diff --git a/languages/java/java.g b/languages/java/java.g new file mode 100644 index 00000000..1f825ec5 --- /dev/null +++ b/languages/java/java.g @@ -0,0 +1,1318 @@ + +header "pre_include_hpp" { + #include "driver.h" + #include "JavaAST.hpp" + + #include <qlistview.h> + #include <kdebug.h> + + #define SET_POSITION(ast,t)\ + { \ + RefJavaAST(ast)->setLine( t->getLine() );\ + RefJavaAST(ast)->setColumn( t->getColumn() ); \ + } +} + +options { + language="Cpp"; +} + +/** Java 1.3 Recognizer + * + * Run 'java Main [-showtree] directory-full-of-java-files' + * + * [The -showtree option pops up a Swing frame that shows + * the AST constructed from the parser.] + * + * Run 'java Main <directory full of java files>' + * + * Contributing authors: + * John Mitchell johnm@non.net + * Terence Parr parrt@magelang.com + * John Lilley jlilley@empathy.com + * Scott Stanchfield thetick@magelang.com + * Markus Mohnen mohnen@informatik.rwth-aachen.de + * Peter Williams pete.williams@sun.com + * Allan Jacobs Allan.Jacobs@eng.sun.com + * Steve Messick messick@redhills.com + * John Pybus john@pybus.org + * + * Version 1.00 December 9, 1997 -- initial release + * Version 1.01 December 10, 1997 + * fixed bug in octal def (0..7 not 0..8) + * Version 1.10 August 1998 (parrt) + * added tree construction + * fixed definition of WS,comments for mac,pc,unix newlines + * added unary plus + * Version 1.11 (Nov 20, 1998) + * Added "shutup" option to turn off last ambig warning. + * Fixed inner class def to allow named class defs as statements + * synchronized requires compound not simple statement + * add [] after builtInType DOT class in primaryExpression + * "const" is reserved but not valid..removed from modifiers + * Version 1.12 (Feb 2, 1999) + * Changed LITERAL_xxx to xxx in tree grammar. + * Updated java.g to use tokens {...} now for 2.6.0 (new feature). + * + * Version 1.13 (Apr 23, 1999) + * Didn't have (stat)? for else clause in tree parser. + * Didn't gen ASTs for interface extends. Updated tree parser too. + * Updated to 2.6.0. + * Version 1.14 (Jun 20, 1999) + * Allowed final/abstract on local classes. + * Removed local interfaces from methods + * Put instanceof precedence where it belongs...in relationalExpr + * It also had expr not type as arg; fixed it. + * Missing ! on SEMI in classBlock + * fixed: (expr) + "string" was parsed incorrectly (+ as unary plus). + * fixed: didn't like Object[].class in parser or tree parser + * Version 1.15 (Jun 26, 1999) + * Screwed up rule with instanceof in it. :( Fixed. + * Tree parser didn't like (expr).something; fixed. + * Allowed multiple inheritance in tree grammar. oops. + * Version 1.16 (August 22, 1999) + * Extending an interface built a wacky tree: had extra EXTENDS. + * Tree grammar didn't allow multiple superinterfaces. + * Tree grammar didn't allow empty var initializer: {} + * Version 1.17 (October 12, 1999) + * ESC lexer rule allowed 399 max not 377 max. + * java.tree.g didn't handle the expression of synchronized + * statements. + * Version 1.18 (August 12, 2001) + * Terence updated to Java 2 Version 1.3 by + * observing/combining work of Allan Jacobs and Steve + * Messick. Handles 1.3 src. Summary: + * o primary didn't include boolean.class kind of thing + * o constructor calls parsed explicitly now: + * see explicitConstructorInvocation + * o add strictfp modifier + * o missing objBlock after new expression in tree grammar + * o merged local class definition alternatives, moved after declaration + * o fixed problem with ClassName.super.field + * o reordered some alternatives to make things more efficient + * o long and double constants were not differentiated from int/float + * o whitespace rule was inefficient: matched only one char + * o add an examples directory with some nasty 1.3 cases + * o made Main.java use buffered IO and a Reader for Unicode support + * o supports UNICODE? + * Using Unicode charVocabulay makes code file big, but only + * in the bitsets at the end. I need to make ANTLR generate + * unicode bitsets more efficiently. + * Version 1.19 (April 25, 2002) + * Terence added in nice fixes by John Pybus concerning floating + * constants and problems with super() calls. John did a nice + * reorg of the primary/postfix expression stuff to read better + * and makes f.g.super() parse properly (it was METHOD_CALL not + * a SUPER_CTOR_CALL). Also: + * + * o "finally" clause was a root...made it a child of "try" + * o Added stuff for asserts too for Java 1.4, but *commented out* + * as it is not backward compatible. + * + * Version 1.20 (October 27, 2002) + * + * Terence ended up reorging John Pybus' stuff to + * remove some nondeterminisms and some syntactic predicates. + * Note that the grammar is stricter now; e.g., this(...) must + * be the first statement. + * + * Trinary ?: operator wasn't working as array name: + * (isBig ? bigDigits : digits)[i]; + * + * Checked parser/tree parser on source for + * Resin-2.0.5, jive-2.1.1, jdk 1.3.1, Lucene, antlr 2.7.2a4, + * and the 110k-line jGuru server source. + * + * Version tracking now done with following ID: + * + * $Id$ + * + * This grammar is in the PUBLIC DOMAIN + */ +class JavaRecognizer extends Parser; +options { + k = 2; // two token lookahead + exportVocab=Java; // Call its vocabulary "Java" + codeGenMakeSwitchThreshold = 2; // Some optimizations + codeGenBitsetTestThreshold = 3; + defaultErrorHandler = true; + buildAST = true; + ASTLabelType = "RefJavaAST"; +} + +tokens { + BLOCK; MODIFIERS; OBJBLOCK; SLIST; CTOR_DEF; METHOD_DEF; VARIABLE_DEF; + INSTANCE_INIT; STATIC_INIT; TYPE; CLASS_DEF; INTERFACE_DEF; + PACKAGE_DEF; ARRAY_DECLARATOR; EXTENDS_CLAUSE; IMPLEMENTS_CLAUSE; + PARAMETERS; PARAMETER_DEF; LABELED_STAT; TYPECAST; INDEX_OP; + POST_INC; POST_DEC; METHOD_CALL; EXPR; ARRAY_INIT; + IMPORT; UNARY_MINUS; UNARY_PLUS; CASE_GROUP; ELIST; FOR_INIT; FOR_CONDITION; + FOR_ITERATOR; EMPTY_STAT; FINAL="final"; ABSTRACT="abstract"; + STRICTFP="strictfp"; SUPER_CTOR_CALL; CTOR_CALL; +} + +{ +private: + Driver* m_driver; + +public: + void setDriver( Driver* d ) { m_driver = d; } + void setFileName( const QString& fileName ) { m_driver->currentFileName() = fileName; } + + void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(ex.getMessage().c_str()), ex.getLine(), ex.getColumn()) ); + } + + void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(errorMessage.c_str()), LT(1)->getLine(), LT(1)->getColumn()) ); + } + + void reportMessage( const ANTLR_USE_NAMESPACE(std)string& message ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(message.c_str()), LT(1)->getLine(), LT(1)->getColumn()) ); + } +} + +// Compilation Unit: In Java, this is a single file. This is the start +// rule for this parser +compilationUnit + : // A compilation unit starts with an optional package definition + ( packageDefinition + | /* nothing */ + ) + + // Next we have a series of zero or more import statements + ( importDefinition )* + + // Wrapping things up with any number of class or interface + // definitions + ( typeDefinition )* + + EOF! + ; + +// Package statement: "package" followed by an identifier. +packageDefinition + options {defaultErrorHandler = true;} // let ANTLR handle errors + : p:"package"^ {#p->setType(PACKAGE_DEF);} identifier SEMI! + ; + +// Import statement: import followed by a package or class name +importDefinition + options {defaultErrorHandler = true;} + : i:"import"^ {#i->setType(IMPORT);} identifierStar SEMI! + ; + +// A type definition in a file is either a class or interface definition. +typeDefinition + options {defaultErrorHandler = true;} + : m:modifiers! + ( classDefinition[#m] + | interfaceDefinition[#m] + ) + | SEMI! + ; + +/** A declaration is the creation of a reference or primitive-type variable + * Create a separate Type/Var tree for each var in the var list. + */ +declaration! + : m:modifiers t:typeSpec[false] v:variableDefinitions[#m,#t] + {#declaration = #v;} + ; + +// A type specification is a type name with possible brackets afterwards +// (which would make it an array type). +typeSpec[bool addImagNode] + : classTypeSpec[addImagNode] + | builtInTypeSpec[addImagNode] + ; + +// A class type specification is a class type with possible brackets afterwards +// (which would make it an array type). +classTypeSpec[bool addImagNode] + : identifier (lb:LBRACK^ {#lb->setType(ARRAY_DECLARATOR);} RBRACK!)* + { + if ( addImagNode ) { + #classTypeSpec = #(#[TYPE,"TYPE"], #classTypeSpec); + } + } + ; + +// A builtin type specification is a builtin type with possible brackets +// afterwards (which would make it an array type). +builtInTypeSpec[bool addImagNode] + : builtInType (lb:LBRACK^ {#lb->setType(ARRAY_DECLARATOR);} RBRACK!)* + { + if ( addImagNode ) { + #builtInTypeSpec = #(#[TYPE,"TYPE"], #builtInTypeSpec); + } + } + ; + +// A type name. which is either a (possibly qualified) class name or +// a primitive (builtin) type +type + : identifier + | builtInType + ; + +// The primitive types. +builtInType + : "void" + | "boolean" + | "byte" + | "char" + | "short" + | "int" + | "float" + | "long" + | "double" + ; + +// A (possibly-qualified) java identifier. We start with the first IDENT +// and expand its name by adding dots and following IDENTS +identifier + : IDENT ( DOT^ IDENT )* + ; + +identifierStar + : IDENT + ( DOT^ IDENT )* + ( DOT^ STAR )? + ; + +// A list of zero or more modifiers. We could have used (modifier)* in +// place of a call to modifiers, but I thought it was a good idea to keep +// this rule separate so they can easily be collected in a Vector if +// someone so desires +modifiers + : ( modifier )* + {#modifiers = #([MODIFIERS, "MODIFIERS"], #modifiers);} + ; + +// modifiers for Java classes, interfaces, class/instance vars and methods +modifier + : "private" + | "public" + | "protected" + | "static" + | "transient" + | "final" + | "abstract" + | "native" + | "threadsafe" + | "synchronized" +// | "const" // reserved word, but not valid + | "volatile" + | "strictfp" + ; + +// Definition of a Java class +classDefinition![RefJavaAST modifiers] + : "class" IDENT + // it _might_ have a superclass... + sc:superClassClause + // it might implement some interfaces... + ic:implementsClause + // now parse the body of the class + cb:classBlock + {#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"], + modifiers,IDENT,sc,ic,cb);} + ; + +superClassClause! + : ( "extends" id:identifier )? + {#superClassClause = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"],id);} + ; + +// Definition of a Java Interface +interfaceDefinition![RefJavaAST modifiers] + : "interface" IDENT + // it might extend some other interfaces + ie:interfaceExtends + // now parse the body of the interface (looks like a class...) + cb:classBlock + {#interfaceDefinition = #(#[INTERFACE_DEF,"INTERFACE_DEF"], + modifiers,IDENT,ie,cb);} + ; + +// This is the body of a class. You can have fields and extra semicolons, +// That's about it (until you see what a field is...) +classBlock + : LCURLY! + ( field | SEMI! )* + RCURLY! + {#classBlock = #([OBJBLOCK, "OBJBLOCK"], #classBlock);} + ; + +// An interface can extend several other interfaces... +interfaceExtends + : ( + e:"extends"! + identifier ( COMMA! identifier )* + )? + {#interfaceExtends = #(#[EXTENDS_CLAUSE,"EXTENDS_CLAUSE"], + #interfaceExtends);} + ; + +// A class can implement several interfaces... +implementsClause + : ( + i:"implements"! identifier ( COMMA! identifier )* + )? + {#implementsClause = #(#[IMPLEMENTS_CLAUSE,"IMPLEMENTS_CLAUSE"], + #implementsClause);} + ; + +// Now the various things that can be defined inside a class or interface... +// Note that not all of these are really valid in an interface (constructors, +// for example), and if this grammar were used for a compiler there would +// need to be some semantic checks to make sure we're doing the right thing... +field! + : // method, constructor, or variable declaration + mods:modifiers + ( h:ctorHead s:constructorBody // constructor + {#field = #(#[CTOR_DEF,"CTOR_DEF"], mods, h, s);} + + | cd:classDefinition[#mods] // inner class + {#field = #cd;} + + | id:interfaceDefinition[#mods] // inner interface + {#field = #id;} + + | t:typeSpec[false] // method or variable declaration(s) + ( IDENT // the name of the method + + // parse the formal parameter declarations. + LPAREN! param:parameterDeclarationList RPAREN! + + rt:declaratorBrackets[#t] + + // get the list of exceptions that this method is + // declared to throw + (tc:throwsClause)? + + ( s2:compoundStatement | SEMI ) + {#field = #(#[METHOD_DEF,"METHOD_DEF"], + mods, + #(#[TYPE,"TYPE"],rt), + IDENT, + param, + tc, + s2);} + | v:variableDefinitions[#mods,#t] SEMI +// {#field = #(#[VARIABLE_DEF,"VARIABLE_DEF"], v);} + {#field = #v;} + ) + ) + + // "static { ... }" class initializer + | "static" s3:compoundStatement + {#field = #(#[STATIC_INIT,"STATIC_INIT"], s3);} + + // "{ ... }" instance initializer + | s4:compoundStatement + {#field = #(#[INSTANCE_INIT,"INSTANCE_INIT"], s4);} + ; + +constructorBody + : lc:LCURLY^ {#lc->setType(SLIST);} + ( options { greedy=true; } : explicitConstructorInvocation)? + (statement)* + RCURLY! + ; + +/** Catch obvious constructor calls, but not the expr.super(...) calls */ +explicitConstructorInvocation + : "this"! lp1:LPAREN^ argList RPAREN! SEMI! + {#lp1->setType(CTOR_CALL);} + | "super"! lp2:LPAREN^ argList RPAREN! SEMI! + {#lp2->setType(SUPER_CTOR_CALL);} + ; + +variableDefinitions[RefJavaAST mods, RefJavaAST t] + : variableDeclarator[(RefJavaAST)getASTFactory()->dupTree((antlr::RefAST)mods), + (RefJavaAST)getASTFactory()->dupTree((antlr::RefAST)t)] + ( COMMA! + variableDeclarator[(RefJavaAST)getASTFactory()->dupTree((antlr::RefAST)mods), + (RefJavaAST)getASTFactory()->dupTree((antlr::RefAST)t)] + )* + ; + +/** Declaration of a variable. This can be a class/instance variable, + * or a local variable in a method + * It can also include possible initialization. + */ +variableDeclarator![RefJavaAST mods, RefJavaAST t] + : id:IDENT d:declaratorBrackets[t] v:varInitializer + {#variableDeclarator = #(#[VARIABLE_DEF,"VARIABLE_DEF"], mods, #(#[TYPE,"TYPE"],d), id, v);} + ; + +declaratorBrackets[RefJavaAST typ] + : {#declaratorBrackets=typ;} + (lb:LBRACK^ {#lb->setType(ARRAY_DECLARATOR);} RBRACK!)* + ; + +varInitializer + : ( ASSIGN^ initializer )? + ; + +// This is an initializer used to set up an array. +arrayInitializer + : lc:LCURLY^ {#lc->setType(ARRAY_INIT);} + ( initializer + ( + // CONFLICT: does a COMMA after an initializer start a new + // initializer or start the option ',' at end? + // ANTLR generates proper code by matching + // the comma as soon as possible. + options { + warnWhenFollowAmbig = false; + } + : + COMMA! initializer + )* + (COMMA!)? + )? + RCURLY! + ; + +// The two "things" that can initialize an array element are an expression +// and another (nested) array initializer. +initializer + : expression + | arrayInitializer + ; + +// This is the header of a method. It includes the name and parameters +// for the method. +// This also watches for a list of exception classes in a "throws" clause. +ctorHead + : IDENT // the name of the method + + // parse the formal parameter declarations. + LPAREN! parameterDeclarationList RPAREN! + + // get the list of exceptions that this method is declared to throw + (throwsClause)? + ; + +// This is a list of exception classes that the method is declared to throw +throwsClause + : "throws"^ identifier ( COMMA! identifier )* + ; + +// A list of formal parameters +parameterDeclarationList + : ( parameterDeclaration ( COMMA! parameterDeclaration )* )? + {#parameterDeclarationList = #(#[PARAMETERS,"PARAMETERS"], + #parameterDeclarationList);} + ; + +// A formal parameter. +parameterDeclaration! + : pm:parameterModifier t:typeSpec[false] id:IDENT + pd:declaratorBrackets[#t] + {#parameterDeclaration = #(#[PARAMETER_DEF,"PARAMETER_DEF"], + pm, #([TYPE,"TYPE"],pd), id);} + ; + +parameterModifier + : (f:"final")? + {#parameterModifier = #(#[MODIFIERS,"MODIFIERS"], f);} + ; + +// Compound statement. This is used in many contexts: +// Inside a class definition prefixed with "static": +// it is a class initializer +// Inside a class definition without "static": +// it is an instance initializer +// As the body of a method +// As a completely indepdent braced block of code inside a method +// it starts a new scope for variable definitions + +compoundStatement + : lc:LCURLY^ {#lc->setType(SLIST);} + // include the (possibly-empty) list of statements + (statement)* + RCURLY! + ; + +statement + // A list of statements in curly braces -- start a new scope! + : compoundStatement + + // declarations are ambiguous with "ID DOT" relative to expression + // statements. Must backtrack to be sure. Could use a semantic + // predicate to test symbol table to see what the type was coming + // up, but that's pretty hard without a symbol table ;) + | (declaration)=> declaration SEMI! + + // An expression statement. This could be a method call, + // assignment statement, or any other expression evaluated for + // side-effects. + | expression SEMI! + + // class definition + | m:modifiers! classDefinition[#m] + + // Attach a label to the front of a statement + | IDENT c:COLON^ {#c->setType(LABELED_STAT);} statement + + // If-else statement + | "if"^ LPAREN! expression RPAREN! statement + ( + // CONFLICT: the old "dangling-else" problem... + // ANTLR generates proper code matching + // as soon as possible. Hush warning. + options { + warnWhenFollowAmbig = false; + } + : + "else"! statement + )? + + // For statement + | "for"^ + LPAREN! + forInit SEMI! // initializer + forCond SEMI! // condition test + forIter // updater + RPAREN! + statement // statement to loop over + + // While statement + | "while"^ LPAREN! expression RPAREN! statement + + // do-while statement + | "do"^ statement "while"! LPAREN! expression RPAREN! SEMI! + + // get out of a loop (or switch) + | "break"^ (IDENT)? SEMI! + + // do next iteration of a loop + | "continue"^ (IDENT)? SEMI! + + // Return an expression + | "return"^ (expression)? SEMI! + + // switch/case statement + | "switch"^ LPAREN! expression RPAREN! LCURLY! + ( casesGroup )* + RCURLY! + + // exception try-catch block + | tryBlock + + // throw an exception + | "throw"^ expression SEMI! + + // synchronize a statement + | "synchronized"^ LPAREN! expression RPAREN! compoundStatement + + // asserts (uncomment if you want 1.4 compatibility) + // | "assert"^ expression ( COLON! expression )? SEMI! + + // empty statement + | s:SEMI {#s->setType(EMPTY_STAT);} + ; + +casesGroup + : ( // CONFLICT: to which case group do the statements bind? + // ANTLR generates proper code: it groups the + // many "case"/"default" labels together then + // follows them with the statements + options { + greedy = true; + } + : + aCase + )+ + caseSList + {#casesGroup = #([CASE_GROUP, "CASE_GROUP"], #casesGroup);} + ; + +aCase + : ("case"^ expression | "default") COLON! + ; + +caseSList + : (statement)* + {#caseSList = #(#[SLIST,"SLIST"],#caseSList);} + ; + +// The initializer for a for loop +forInit + // if it looks like a declaration, it is + : ( (declaration)=> declaration + // otherwise it could be an expression list... + | expressionList + )? + {#forInit = #(#[FOR_INIT,"FOR_INIT"],#forInit);} + ; + +forCond + : (expression)? + {#forCond = #(#[FOR_CONDITION,"FOR_CONDITION"],#forCond);} + ; + +forIter + : (expressionList)? + {#forIter = #(#[FOR_ITERATOR,"FOR_ITERATOR"],#forIter);} + ; + +// an exception handler try/catch block +tryBlock + : "try"^ compoundStatement + (handler)* + ( finallyClause )? + ; + +finallyClause + : "finally"^ compoundStatement + ; + +// an exception handler +handler + : "catch"^ LPAREN! parameterDeclaration RPAREN! compoundStatement + ; + +// expressions +// Note that most of these expressions follow the pattern +// thisLevelExpression : +// nextHigherPrecedenceExpression +// (OPERATOR nextHigherPrecedenceExpression)* +// which is a standard recursive definition for a parsing an expression. +// The operators in java have the following precedences: +// lowest (13) = *= /= %= += -= <<= >>= >>>= &= ^= |= +// (12) ?: +// (11) || +// (10) && +// ( 9) | +// ( 8) ^ +// ( 7) & +// ( 6) == != +// ( 5) < <= > >= +// ( 4) << >> +// ( 3) +(binary) -(binary) +// ( 2) * / % +// ( 1) ++ -- +(unary) -(unary) ~ ! (type) +// [] () (method call) . (dot -- identifier qualification) +// new () (explicit parenthesis) +// +// the last two are not usually on a precedence chart; I put them in +// to point out that new has a higher precedence than '.', so you +// can validy use +// new Frame().show() +// +// Note that the above precedence levels map to the rules below... +// Once you have a precedence chart, writing the appropriate rules as below +// is usually very straightfoward + +// the mother of all expressions +expression + : assignmentExpression + {#expression = #(#[EXPR,"EXPR"],#expression);} + ; + +// This is a list of expressions. +expressionList + : expression (COMMA! expression)* + {#expressionList = #(#[ELIST,"ELIST"], expressionList);} + ; + +// assignment expression (level 13) +assignmentExpression + : conditionalExpression + ( ( ASSIGN^ + | PLUS_ASSIGN^ + | MINUS_ASSIGN^ + | STAR_ASSIGN^ + | DIV_ASSIGN^ + | MOD_ASSIGN^ + | SR_ASSIGN^ + | BSR_ASSIGN^ + | SL_ASSIGN^ + | BAND_ASSIGN^ + | BXOR_ASSIGN^ + | BOR_ASSIGN^ + ) + assignmentExpression + )? + ; + +// conditional test (level 12) +conditionalExpression + : logicalOrExpression + ( QUESTION^ assignmentExpression COLON! conditionalExpression )? + ; + +// logical or (||) (level 11) +logicalOrExpression + : logicalAndExpression (LOR^ logicalAndExpression)* + ; + +// logical and (&&) (level 10) +logicalAndExpression + : inclusiveOrExpression (LAND^ inclusiveOrExpression)* + ; + +// bitwise or non-short-circuiting or (|) (level 9) +inclusiveOrExpression + : exclusiveOrExpression (BOR^ exclusiveOrExpression)* + ; + +// exclusive or (^) (level 8) +exclusiveOrExpression + : andExpression (BXOR^ andExpression)* + ; + +// bitwise or non-short-circuiting and (&) (level 7) +andExpression + : equalityExpression (BAND^ equalityExpression)* + ; + +// equality/inequality (==/!=) (level 6) +equalityExpression + : relationalExpression ((NOT_EQUAL^ | EQUAL^) relationalExpression)* + ; + +// boolean relational expressions (level 5) +relationalExpression + : shiftExpression + ( ( ( LT_^ + | GT^ + | LE^ + | GE^ + ) + shiftExpression + )* + | "instanceof"^ typeSpec[true] + ) + ; + +// bit shift expressions (level 4) +shiftExpression + : additiveExpression ((SL^ | SR^ | BSR^) additiveExpression)* + ; + +// binary addition/subtraction (level 3) +additiveExpression + : multiplicativeExpression ((PLUS^ | MINUS^) multiplicativeExpression)* + ; + +// multiplication/division/modulo (level 2) +multiplicativeExpression + : unaryExpression ((STAR^ | DIV^ | MOD^ ) unaryExpression)* + ; + +unaryExpression + : INC^ unaryExpression + | DEC^ unaryExpression + | MINUS^ {#MINUS->setType(UNARY_MINUS);} unaryExpression + | PLUS^ {#PLUS->setType(UNARY_PLUS);} unaryExpression + | unaryExpressionNotPlusMinus + ; + +unaryExpressionNotPlusMinus + : BNOT^ unaryExpression + | LNOT^ unaryExpression + + | ( // subrule allows option to shut off warnings + options { + // "(int" ambig with postfixExpr due to lack of sequence + // info in linear approximate LL(k). It's ok. Shut up. + generateAmbigWarnings=false; + } + : // If typecast is built in type, must be numeric operand + // Also, no reason to backtrack if type keyword like int, float... + lpb:LPAREN^ {#lpb->setType(TYPECAST);} builtInTypeSpec[true] RPAREN! + unaryExpression + + // Have to backtrack to see if operator follows. If no operator + // follows, it's a typecast. No semantic checking needed to parse. + // if it _looks_ like a cast, it _is_ a cast; else it's a "(expr)" + | (LPAREN classTypeSpec[true] RPAREN unaryExpressionNotPlusMinus)=> + lp:LPAREN^ {#lp->setType(TYPECAST);} classTypeSpec[true] RPAREN! + unaryExpressionNotPlusMinus + + | postfixExpression + ) + ; + +// qualified names, array expressions, method invocation, post inc/dec +postfixExpression + : + /* + "this"! lp1:LPAREN^ argList RPAREN! + {#lp1->setType(CTOR_CALL);} + + | "super"! lp2:LPAREN^ argList RPAREN! + {#lp2->setType(SUPER_CTOR_CALL);} + | + */ + primaryExpression + + ( + /* + options { + // the use of postfixExpression in SUPER_CTOR_CALL adds DOT + // to the lookahead set, and gives loads of false non-det + // warnings. + // shut them off. + generateAmbigWarnings=false; + } + : */ + DOT^ IDENT + ( lp:LPAREN^ {#lp->setType(METHOD_CALL);} + argList + RPAREN! + )? + | DOT^ "this" + + | DOT^ "super" + ( // (new Outer()).super() (create enclosing instance) + lp3:LPAREN^ argList RPAREN! + {#lp3->setType(SUPER_CTOR_CALL);} + | DOT^ IDENT + ( lps:LPAREN^ {#lps->setType(METHOD_CALL);} + argList + RPAREN! + )? + ) + | DOT^ newExpression + | lb:LBRACK^ {#lb->setType(INDEX_OP);} expression RBRACK! + )* + + ( // possibly add on a post-increment or post-decrement. + // allows INC/DEC on too much, but semantics can check + in:INC^ {#in->setType(POST_INC);} + | de:DEC^ {#de->setType(POST_DEC);} + )? + ; + +// the basic element of an expression +primaryExpression + : identPrimary ( options {greedy=true;} : DOT^ "class" )? + | constant + | "true" + | "false" + | "null" + | newExpression + | "this" + | "super" + | LPAREN! assignmentExpression RPAREN! + // look for int.class and int[].class + | builtInType + ( lbt:LBRACK^ {#lbt->setType(ARRAY_DECLARATOR);} RBRACK! )* + DOT^ "class" + ; + +/** Match a, a.b.c refs, a.b.c(...) refs, a.b.c[], a.b.c[].class, + * and a.b.c.class refs. Also this(...) and super(...). Match + * this or super. + */ +identPrimary + : IDENT + ( + options { + // .ident could match here or in postfixExpression. + // We do want to match here. Turn off warning. + greedy=true; + } + : DOT^ IDENT + )* + ( + options { + // ARRAY_DECLARATOR here conflicts with INDEX_OP in + // postfixExpression on LBRACK RBRACK. + // We want to match [] here, so greedy. This overcomes + // limitation of linear approximate lookahead. + greedy=true; + } + : ( lp:LPAREN^ {#lp->setType(METHOD_CALL);} argList RPAREN! ) + | ( options {greedy=true;} : + lbc:LBRACK^ {#lbc->setType(ARRAY_DECLARATOR);} RBRACK! + )+ + )? + ; + +/** object instantiation. + * Trees are built as illustrated by the following input/tree pairs: + * + * new T() + * + * new + * | + * T -- ELIST + * | + * arg1 -- arg2 -- .. -- argn + * + * new int[] + * + * new + * | + * int -- ARRAY_DECLARATOR + * + * new int[] {1,2} + * + * new + * | + * int -- ARRAY_DECLARATOR -- ARRAY_INIT + * | + * EXPR -- EXPR + * | | + * 1 2 + * + * new int[3] + * new + * | + * int -- ARRAY_DECLARATOR + * | + * EXPR + * | + * 3 + * + * new int[1][2] + * + * new + * | + * int -- ARRAY_DECLARATOR + * | + * ARRAY_DECLARATOR -- EXPR + * | | + * EXPR 1 + * | + * 2 + * + */ +newExpression + : "new"^ type + ( LPAREN! argList RPAREN! (classBlock)? + + //java 1.1 + // Note: This will allow bad constructs like + // new int[4][][3] {exp,exp}. + // There needs to be a semantic check here... + // to make sure: + // a) [ expr ] and [ ] are not mixed + // b) [ expr ] and an init are not used together + + | newArrayDeclarator (arrayInitializer)? + ) + ; + +argList + : ( expressionList + | /*nothing*/ + {#argList = #[ELIST,"ELIST"];} + ) + ; + +newArrayDeclarator + : ( + // CONFLICT: + // newExpression is a primaryExpression which can be + // followed by an array index reference. This is ok, + // as the generated code will stay in this loop as + // long as it sees an LBRACK (proper behavior) + options { + warnWhenFollowAmbig = false; + } + : + lb:LBRACK^ {#lb->setType(ARRAY_DECLARATOR);} + (expression)? + RBRACK! + )+ + ; + +constant + : NUM_INT + | CHAR_LITERAL + | STRING_LITERAL + | NUM_FLOAT + | NUM_LONG + | NUM_DOUBLE + ; + +//---------------------------------------------------------------------------- +// The Java scanner +//---------------------------------------------------------------------------- +{ +#include <string> +} +class JavaLexer extends Lexer; + +options { + exportVocab=Java; // call the vocabulary "Java" + testLiterals=false; // don't automatically test for literals + defaultErrorHandler=false; + k=4; // four characters of lookahead +// charVocabulary='\u0003'..'\uFFFF'; + charVocabulary='\u0003'..'\u00FF'; + // without inlining some bitset tests, couldn't do unicode; + // I need to make ANTLR generate smaller bitsets; see + // bottom of JavaLexer.java + codeGenBitsetTestThreshold=20; +} +{ +private: + Driver* m_driver; + +public: + void setDriver( Driver* d ) { m_driver = d; } + void setFileName( const QString& fileName ) { m_driver->currentFileName() = fileName; } + + virtual void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(ex.getMessage().c_str()), ex.getLine(), ex.getColumn()) ); + } + + virtual void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(errorMessage.c_str()), getLine(), getColumn()) ); + } + + virtual void reportWarning( const ANTLR_USE_NAMESPACE(std)string& warnMessage ){ + m_driver->addProblem( m_driver->currentFileName(), Problem( QString::fromLocal8Bit(warnMessage.c_str()), getLine(), getColumn()) ); + } +} + +// OPERATORS +QUESTION : '?' ; +LPAREN : '(' ; +RPAREN : ')' ; +LBRACK : '[' ; +RBRACK : ']' ; +LCURLY : '{' ; +RCURLY : '}' ; +COLON : ':' ; +COMMA : ',' ; +//DOT : '.' ; +ASSIGN : '=' ; +EQUAL : "==" ; +LNOT : '!' ; +BNOT : '~' ; +NOT_EQUAL : "!=" ; +DIV : '/' ; +DIV_ASSIGN : "/=" ; +PLUS : '+' ; +PLUS_ASSIGN : "+=" ; +INC : "++" ; +MINUS : '-' ; +MINUS_ASSIGN : "-=" ; +DEC : "--" ; +STAR : '*' ; +STAR_ASSIGN : "*=" ; +MOD : '%' ; +MOD_ASSIGN : "%=" ; +SR : ">>" ; +SR_ASSIGN : ">>=" ; +BSR : ">>>" ; +BSR_ASSIGN : ">>>=" ; +GE : ">=" ; +GT : ">" ; +SL : "<<" ; +SL_ASSIGN : "<<=" ; +LE : "<=" ; +LT_ : '<' ; +BXOR : '^' ; +BXOR_ASSIGN : "^=" ; +BOR : '|' ; +BOR_ASSIGN : "|=" ; +LOR : "||" ; +BAND : '&' ; +BAND_ASSIGN : "&=" ; +LAND : "&&" ; +SEMI : ';' ; + +// Whitespace -- ignored +WS : ( ' ' + | '\t' + | '\f' + // handle newlines + | ( options {generateAmbigWarnings=false;} + : "\r\n" // Evil DOS + | '\r' // Macintosh + | '\n' // Unix (the right way) + ) + { newline(); } + )+ + { $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); } + ; + +// Single-line comments +SL_COMMENT + : "//" + (~('\n'|'\r'))* ('\n'|'\r'('\n')?) + { + $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); + newline(); + } + ; + +// multiple-line comments +ML_COMMENT + : "/*" + ( /* '\r' '\n' can be matched in one alternative or by matching + '\r' in one iteration and '\n' in another. I am trying to + handle any flavor of newline that comes in, but the language + that allows both "\r\n" and "\r" and "\n" to all be valid + newline is ambiguous. Consequently, the resulting grammar + must be ambiguous. I'm shutting this warning off. + */ + options { + generateAmbigWarnings=false; + } + : + { LA(2)!='/' }? '*' + | '\r' '\n' {newline();} + | '\r' {newline();} + | '\n' {newline();} + | ~('*'|'\n'|'\r') + )* + "*/" + {$setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP);} + ; + +// character literals +CHAR_LITERAL + : '\'' ( ESC | ~'\'' ) '\'' + ; + +// string literals +STRING_LITERAL + : '"' (ESC|~('"'|'\\'))* '"' + ; + +// escape sequence -- note that this is protected; it can only be called +// from another lexer rule -- it will not ever directly return a token to +// the parser +// There are various ambiguities hushed in this rule. The optional +// '0'...'9' digit matches should be matched here rather than letting +// them go back to STRING_LITERAL to be matched. ANTLR does the +// right thing by matching immediately; hence, it's ok to shut off +// the FOLLOW ambig warnings. +protected +ESC + : '\\' + ( 'n' + | 'r' + | 't' + | 'b' + | 'f' + | '"' + | '\'' + | '\\' + | ('u')+ HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT + | '0'..'3' + ( + options { + warnWhenFollowAmbig = false; + } + : '0'..'7' + ( + options { + warnWhenFollowAmbig = false; + } + : '0'..'7' + )? + )? + | '4'..'7' + ( + options { + warnWhenFollowAmbig = false; + } + : '0'..'7' + )? + ) + ; + +// hexadecimal digit (again, note it's protected!) +protected +HEX_DIGIT + : ('0'..'9'|'A'..'F'|'a'..'f') + ; + +// a dummy rule to force vocabulary to be all characters (except special +// ones that ANTLR uses internally (0 to 2) +protected +VOCAB + : '\3'..'\377' + ; + +// an identifier. Note that testLiterals is set to true! This means +// that after we match the rule, we look in the literals table to see +// if it's a literal or really an identifer +IDENT + options {testLiterals=true;} + : ('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')* + ; + +// a numeric literal +NUM_INT + { + bool isDecimal = false; + ANTLR_USE_NAMESPACE(antlr)RefToken t = ANTLR_USE_NAMESPACE(antlr)nullToken; + } + : '.' {_ttype = DOT;} + ( ('0'..'9')+ (EXPONENT)? (f1:FLOAT_SUFFIX {t=f1;})? + { + if ( t && + (t->getText().find('f') != ANTLR_USE_NAMESPACE(std)string::npos || + t->getText().find('F') != ANTLR_USE_NAMESPACE(std)string::npos ) ) { + _ttype = NUM_FLOAT; + } + else { + _ttype = NUM_DOUBLE; // assume double + } + } + )? + + | ( '0' {isDecimal = true;} // special case for just '0' + ( ('x'|'X') + ( // hex + // the 'e'|'E' and float suffix stuff look + // like hex digits, hence the (...)+ doesn't + // know when to stop: ambig. ANTLR resolves + // it correctly by matching immediately. It + // is therefor ok to hush warning. + options { + warnWhenFollowAmbig=false; + } + : HEX_DIGIT + )+ + | ('0'..'7')+ // octal + )? + | ('1'..'9') ('0'..'9')* {isDecimal=true;} // non-zero decimal + ) + ( ('l'|'L') { _ttype = NUM_LONG; } + + // only check to see if it's a float if looks like decimal so far + | {isDecimal}? + ( '.' ('0'..'9')* (EXPONENT)? (f2:FLOAT_SUFFIX {t=f2;})? + | EXPONENT (f3:FLOAT_SUFFIX {t=f3;})? + | f4:FLOAT_SUFFIX {t=f4;} + ) + { + if ( t && + (t->getText().find('f') != ANTLR_USE_NAMESPACE(std)string::npos || + t->getText().find('F') != ANTLR_USE_NAMESPACE(std)string::npos ) ) { + _ttype = NUM_FLOAT; + } + else { + _ttype = NUM_DOUBLE; // assume double + } + } + )? + ; + +// a couple protected methods to assist in matching floating point numbers +protected +EXPONENT + : ('e'|'E') ('+'|'-')? ('0'..'9')+ + ; + +protected +FLOAT_SUFFIX + : 'f'|'F'|'d'|'D' + ; + diff --git a/languages/java/java.store.g b/languages/java/java.store.g new file mode 100644 index 00000000..b69b7323 --- /dev/null +++ b/languages/java/java.store.g @@ -0,0 +1,521 @@ +// KDevelop support by Roberto Raggi (roberto@kdevelop.org) + +header "pre_include_hpp" { + #include <codemodel.h> + #include "JavaAST.hpp" + + #include <qstring.h> + #include <qstringlist.h> + #include <qvaluestack.h> + #include <qfileinfo.h> +} + +header "post_include_hpp" { + #include <codemodel.h> + + #include <kdebug.h> +} + +options { + language="Cpp"; +} + +/** Java 1.2 AST Recognizer Grammar + * + * Author: + * Terence Parr parrt@magelang.com + * + * Version tracking now done with following ID: + * + * $Id$ + * + * This grammar is in the PUBLIC DOMAIN + * + * BUGS + */ +class JavaStoreWalker extends TreeParser; + +options { + importVocab=Java; + defaultErrorHandler = true; + ASTLabelType = "RefJavaAST"; +} +{ +private: + QStringList m_currentScope; + CodeModel* m_model; + FileDom m_file; + QValueStack<ClassDom> m_currentClass; + int m_currentAccess; + int m_anon; + ANTLR_USE_NAMESPACE(antlr)JavaASTFactory ast_factory; + +public: + void setCodeModel( CodeModel* model ) + { + m_model = model; + } + + void setFile( FileDom file ) + { + m_file = file; + } + + void init() + { + m_currentScope.clear(); + m_currentAccess = CodeModelItem::Public; + m_anon = 0; + + initializeASTFactory (ast_factory); + setASTFactory (&ast_factory); + } +} + +compilationUnit { QString package; QString imp; QStringList imports; } + : { init(); } + (package=packageDefinition)? + (imp=importDefinition { imports << imp; } )* + (typeDefinition)* + ; + +packageDefinition returns [ QString id ] + : #( PACKAGE_DEF id=identifier ) + ; + +importDefinition returns [ QString id ] + : #( IMPORT id=identifierStar ) + ; + +typeDefinition { QStringList bases; QString className; ClassDom klass; QStringList m;} + : #(CLASS_DEF m=modifiers IDENT + { + klass = m_model->create<ClassModel>(); + QString name = QString::fromUtf8( #IDENT->getText().c_str(), #IDENT->getText().length() ); + QStringList path = QStringList::split( ".", name ); + className = path.back(); + + klass->setName( path.back() ); + klass->setScope( m_currentScope ); + klass->setStartPosition( #IDENT->getLine(), #IDENT->getColumn() ); + /// @todo klass->setEndPositon() + + klass->setFileName( m_file->name() ); + if( m_currentClass.top() ) + m_currentClass.top()->addClass( klass ); + else + m_file->addClass( klass ); + } + bases=extendsClause + { + for( QStringList::Iterator it = bases.begin(); it != bases.end(); ++it ) + klass->addBaseClass( *it ); + } + implementsClause + { + m_currentClass.push( klass ); + m_currentScope.push_back( className ); + } + objBlock[klass] + { + m_currentClass.pop(); + m_currentScope.pop_back(); + } + ) + | #(INTERFACE_DEF m=modifiers IDENT + { + klass = m_model->create<ClassModel>(); + QString name = QString::fromUtf8( #IDENT->getText().c_str(), #IDENT->getText().length() ); + QStringList path = QStringList::split( ".", name ); + className = path.back(); + + klass->setName( path.back() ); + klass->setScope( m_currentScope ); + klass->setStartPosition( #IDENT->getLine(), #IDENT->getColumn() ); + /// @todo klass->setEndPositon() + + klass->setFileName( m_file->name() ); + + if( m_currentClass.top() ) + m_currentClass.top()->addClass( klass ); + else + m_file->addClass( klass ); + } + bases=extendsClause + { + m_currentClass.push( klass ); + m_currentScope.push_back( className ); + } + interfaceBlock[klass] + { + m_currentClass.pop(); + m_currentScope.pop_back(); + } + ) + ; + +typeSpec returns [ QString tp ] + : #(TYPE tp=typeSpecArray) + ; + +typeSpecArray returns [ QString tp ] + : #( ARRAY_DECLARATOR tp=typeSpecArray ) { tp += "[]"; } + | tp=type + ; + +type returns [ QString tp ] + : tp=identifier + | b:builtInType { tp = #b->getText().c_str(); } + ; + +builtInType + : "void" + | "boolean" + | "byte" + | "char" + | "short" + | "int" + | "float" + | "long" + | "double" + ; + +modifiers returns [ QStringList l ] + : #( MODIFIERS (m:modifier { l << #m->getText().c_str(); } )* ) + ; + +modifier + : "private" + | "public" + | "protected" + | "static" + | "transient" + | "final" + | "abstract" + | "native" + | "threadsafe" + | "synchronized" + | "const" + | "volatile" + ; + +extendsClause returns [ QStringList l ] { QString id; } + : #(EXTENDS_CLAUSE (id=identifier { l << id; } )* ) + ; + +implementsClause returns [ QStringList l ] { QString id; } + : #(IMPLEMENTS_CLAUSE (id=identifier { l << id; } )* ) + ; + +interfaceBlock [ ClassDom klass ] { FunctionDom meth; VariableDom attr; } + : #( OBJBLOCK + ( meth=methodDecl { + } + + | attr=variableDef { + } + )* + ) + ; + +objBlock [ ClassDom klass ] { FunctionDom meth; VariableDom attr; } + : #( OBJBLOCK + ( meth=ctorDef { + klass->addFunction( meth ); + } + | meth=methodDef { + klass->addFunction( meth ); + } + | attr=variableDef { + klass->addVariable( attr ); + } + | typeDefinition + | #(STATIC_INIT slist) + | #(INSTANCE_INIT slist) + )* + ) + ; + +ctorDef returns [ FunctionDom meth ] { + QStringList m; + meth = m_model->create<FunctionModel>(); + meth->setFileName( m_file->name() ); + } + : #(CTOR_DEF + m=modifiers methodHead[meth] slist + ) + { + if( m.contains("public") ) + meth->setAccess( CodeModelItem::Public ); + else if( m.contains("protected") ) + meth->setAccess( CodeModelItem::Protected ); + else + meth->setAccess( CodeModelItem::Private ); + } + ; + +methodDecl returns [ FunctionDom meth ] { + QStringList m; + QString tp; + meth = m_model->create<FunctionModel>(); + meth->setFileName( m_file->name() ); + } + : #(METHOD_DEF m=modifiers tp=typeSpec methodHead[meth]) + { + meth->setResultType( tp ); + if( m.contains("public") ) + meth->setAccess( CodeModelItem::Public ); + else if( m.contains("protected") ) + meth->setAccess( CodeModelItem::Protected ); + else + meth->setAccess( CodeModelItem::Private ); + } + ; + +methodDef returns [ FunctionDom meth ] { + QStringList m; + QString tp; + meth = m_model->create<FunctionModel>(); + meth->setFileName( m_file->name() ); + } + : #(METHOD_DEF m=modifiers tp=typeSpec methodHead[meth] (slist)?) + { + meth->setResultType( tp ); + if( m.contains("public") ) + meth->setAccess( CodeModelItem::Public ); + else if( m.contains("protected") ) + meth->setAccess( CodeModelItem::Protected ); + else + meth->setAccess( CodeModelItem::Private ); + } + ; + +variableDef returns [ VariableDom attr ] { + QStringList m; + QString tp; + attr = m_model->create<VariableModel>(); + attr->setFileName( m_file->name() ); + } + : #(VARIABLE_DEF m=modifiers tp=typeSpec variableDeclarator[attr] varInitializer) + { + attr->setType( tp ); + if( m.contains("public") ) + attr->setAccess( CodeModelItem::Public ); + else if( m.contains("protected") ) + attr->setAccess( CodeModelItem::Protected ); + else + attr->setAccess( CodeModelItem::Private ); + + attr->setStatic( m.contains("static") ); + } + ; + +parameterDef returns [ ArgumentDom arg ] { + QString tp; + arg = m_model->create<ArgumentModel>(); + } + : #(PARAMETER_DEF modifiers tp=typeSpec IDENT ) + { + arg->setType( tp ); + arg->setName( #IDENT->getText().c_str() ); + } + ; + +objectinitializer + : #(INSTANCE_INIT slist) + ; + +variableDeclarator [ VariableDom attr ] + : IDENT { + attr->setName( #IDENT->getText().c_str() ); + attr->setStartPosition( #IDENT->getLine(), #IDENT->getColumn() ); + } + | LBRACK variableDeclarator[attr] + ; + +varInitializer + : #(ASSIGN initializer) + | + ; + +initializer + : expression + | arrayInitializer + ; + +arrayInitializer + : #(ARRAY_INIT (initializer)*) + ; + +methodHead [ FunctionDom meth ] { ArgumentDom arg; } + : IDENT #( PARAMETERS (arg=parameterDef { meth->addArgument(arg); } )* ) (throwsClause)? + { + meth->setName( #IDENT->getText().c_str() ); + meth->setScope( m_currentScope ); + meth->setStartPosition( #IDENT->getLine(), #IDENT->getColumn() ); + } + ; + +throwsClause + : #( "throws" (identifier)* ) + ; + +identifier returns [ QString id ] + : IDENT { + id = #IDENT->getText().c_str(); + } + | #( DOT id=identifier IDENT ) { + id += QString(".") + #IDENT->getText().c_str(); + } + ; + +identifierStar returns [ QString id ] + : IDENT { + id = #IDENT->getText().c_str(); + } + | #( DOT id=identifier (STAR { id += QString(".") + #STAR->getText().c_str(); } | + IDENT { id += QString(".") + #IDENT->getText().c_str(); }) ) + ; + +slist + : #( SLIST (stat)* ) + ; + +stat: typeDefinition + | variableDef + | expression + | #(LABELED_STAT IDENT stat) + | #("if" expression stat (stat)? ) + | #( "for" + #(FOR_INIT (variableDef | elist)?) + #(FOR_CONDITION (expression)?) + #(FOR_ITERATOR (elist)?) + stat + ) + | #("while" expression stat) + | #("do" stat expression) + | #("break" (IDENT)? ) + | #("continue" (IDENT)? ) + | #("return" (expression)? ) + | #("switch" expression (caseGroup)*) + | #("throw" expression) + | #("synchronized" expression stat) + | tryBlock + | slist // nested SLIST + | EMPTY_STAT + ; + +caseGroup + : #(CASE_GROUP (#("case" expression) | "default")+ slist) + ; + +tryBlock + : #( "try" slist (handler)* (#("finally" slist))? ) + ; + +handler + : #( "catch" parameterDef slist ) + ; + +elist + : #( ELIST (expression)* ) + ; + +expression + : #(EXPR expr) + ; + +expr: #(QUESTION expr expr expr) // trinary operator + | #(ASSIGN expr expr) // binary operators... + | #(PLUS_ASSIGN expr expr) + | #(MINUS_ASSIGN expr expr) + | #(STAR_ASSIGN expr expr) + | #(DIV_ASSIGN expr expr) + | #(MOD_ASSIGN expr expr) + | #(SR_ASSIGN expr expr) + | #(BSR_ASSIGN expr expr) + | #(SL_ASSIGN expr expr) + | #(BAND_ASSIGN expr expr) + | #(BXOR_ASSIGN expr expr) + | #(BOR_ASSIGN expr expr) + | #(LOR expr expr) + | #(LAND expr expr) + | #(BOR expr expr) + | #(BXOR expr expr) + | #(BAND expr expr) + | #(NOT_EQUAL expr expr) + | #(EQUAL expr expr) + | #(LT_ expr expr) + | #(GT expr expr) + | #(LE expr expr) + | #(GE expr expr) + | #(SL expr expr) + | #(SR expr expr) + | #(BSR expr expr) + | #(PLUS expr expr) + | #(MINUS expr expr) + | #(DIV expr expr) + | #(MOD expr expr) + | #(STAR expr expr) + | #(INC expr) + | #(DEC expr) + | #(POST_INC expr) + | #(POST_DEC expr) + | #(BNOT expr) + | #(LNOT expr) + | #("instanceof" expr expr) + | #(UNARY_MINUS expr) + | #(UNARY_PLUS expr) + | primaryExpression + ; + +primaryExpression + : IDENT + | #( DOT + ( expr + ( IDENT + | arrayIndex + | "this" + | "class" + | #( "new" IDENT elist ) + ) + | #(ARRAY_DECLARATOR type) + | builtInType ("class")? + ) + ) + | arrayIndex + | #(METHOD_CALL primaryExpression elist) + | #(TYPECAST typeSpec expr) + | newExpression + | constant + | "super" + | "true" + | "false" + | "this" + | "null" + | typeSpec // type name used with instanceof + ; + +arrayIndex + : #(INDEX_OP primaryExpression expression) + ; + +constant + : NUM_INT + | CHAR_LITERAL + | STRING_LITERAL + | NUM_FLOAT + ; + +newExpression + : #( "new" type + ( newArrayDeclarator (arrayInitializer)? + | elist + ) + ) + + ; + +newArrayDeclarator + : #( ARRAY_DECLARATOR (newArrayDeclarator)? (expression)? ) + ; diff --git a/languages/java/java.tree.g b/languages/java/java.tree.g new file mode 100644 index 00000000..9fa94a95 --- /dev/null +++ b/languages/java/java.tree.g @@ -0,0 +1,331 @@ +options { + language="Cpp"; +} + +/** Java 1.3 AST Recognizer Grammar + * + * Author: (see java.g preamble) + * + * Version tracking now done with following ID: + * + * $Id$ + * + * This grammar is in the PUBLIC DOMAIN + */ + +class JavaTreeParser extends TreeParser; + +options { + importVocab = Java; +} + +compilationUnit + : (packageDefinition)? + (importDefinition)* + (typeDefinition)* + ; + +packageDefinition + : #( PACKAGE_DEF identifier ) + ; + +importDefinition + : #( IMPORT identifierStar ) + ; + +typeDefinition + : #(CLASS_DEF modifiers IDENT extendsClause implementsClause objBlock ) + | #(INTERFACE_DEF modifiers IDENT extendsClause interfaceBlock ) + ; + +typeSpec + : #(TYPE typeSpecArray) + ; + +typeSpecArray + : #( ARRAY_DECLARATOR typeSpecArray ) + | type + ; + +type: identifier + | builtInType + ; + +builtInType + : "void" + | "boolean" + | "byte" + | "char" + | "short" + | "int" + | "float" + | "long" + | "double" + ; + +modifiers + : #( MODIFIERS (modifier)* ) + ; + +modifier + : "private" + | "public" + | "protected" + | "static" + | "transient" + | "final" + | "abstract" + | "native" + | "threadsafe" + | "synchronized" + | "const" + | "volatile" + | "strictfp" + ; + +extendsClause + : #(EXTENDS_CLAUSE (identifier)* ) + ; + +implementsClause + : #(IMPLEMENTS_CLAUSE (identifier)* ) + ; + +interfaceBlock + : #( OBJBLOCK + ( methodDecl + | variableDef + )* + ) + ; + +objBlock + : #( OBJBLOCK + ( ctorDef + | methodDef + | variableDef + | typeDefinition + | #(STATIC_INIT slist) + | #(INSTANCE_INIT slist) + )* + ) + ; + +ctorDef + : #(CTOR_DEF modifiers methodHead (slist)?) + ; + +methodDecl + : #(METHOD_DEF modifiers typeSpec methodHead) + ; + +methodDef + : #(METHOD_DEF modifiers typeSpec methodHead (slist)?) + ; + +variableDef + : #(VARIABLE_DEF modifiers typeSpec variableDeclarator varInitializer) + ; + +parameterDef + : #(PARAMETER_DEF modifiers typeSpec IDENT ) + ; + +objectinitializer + : #(INSTANCE_INIT slist) + ; + +variableDeclarator + : IDENT + | LBRACK variableDeclarator + ; + +varInitializer + : #(ASSIGN initializer) + | + ; + +initializer + : expression + | arrayInitializer + ; + +arrayInitializer + : #(ARRAY_INIT (initializer)*) + ; + +methodHead + : IDENT #( PARAMETERS (parameterDef)* ) (throwsClause)? + ; + +throwsClause + : #( "throws" (identifier)* ) + ; + +identifier + : IDENT + | #( DOT identifier IDENT ) + ; + +identifierStar + : IDENT + | #( DOT identifier (STAR|IDENT) ) + ; + +slist + : #( SLIST (stat)* ) + ; + +stat: typeDefinition + | variableDef + | expression + | #(LABELED_STAT IDENT stat) + | #("if" expression stat (stat)? ) + | #( "for" + #(FOR_INIT (variableDef | elist)?) + #(FOR_CONDITION (expression)?) + #(FOR_ITERATOR (elist)?) + stat + ) + | #("while" expression stat) + | #("do" stat expression) + | #("break" (IDENT)? ) + | #("continue" (IDENT)? ) + | #("return" (expression)? ) + | #("switch" expression (caseGroup)*) + | #("throw" expression) + | #("synchronized" expression stat) + | tryBlock + | slist // nested SLIST + // uncomment to make assert JDK 1.4 stuff work + // | #("assert" expression (expression)?) + | EMPTY_STAT + ; + +caseGroup + : #(CASE_GROUP (#("case" expression) | "default")+ slist) + ; + +tryBlock + : #( "try" slist (handler)* (#("finally" slist))? ) + ; + +handler + : #( "catch" parameterDef slist ) + ; + +elist + : #( ELIST (expression)* ) + ; + +expression + : #(EXPR expr) + ; + +expr: #(QUESTION expr expr expr) // trinary operator + | #(ASSIGN expr expr) // binary operators... + | #(PLUS_ASSIGN expr expr) + | #(MINUS_ASSIGN expr expr) + | #(STAR_ASSIGN expr expr) + | #(DIV_ASSIGN expr expr) + | #(MOD_ASSIGN expr expr) + | #(SR_ASSIGN expr expr) + | #(BSR_ASSIGN expr expr) + | #(SL_ASSIGN expr expr) + | #(BAND_ASSIGN expr expr) + | #(BXOR_ASSIGN expr expr) + | #(BOR_ASSIGN expr expr) + | #(LOR expr expr) + | #(LAND expr expr) + | #(BOR expr expr) + | #(BXOR expr expr) + | #(BAND expr expr) + | #(NOT_EQUAL expr expr) + | #(EQUAL expr expr) + | #(LT_ expr expr) + | #(GT expr expr) + | #(LE expr expr) + | #(GE expr expr) + | #(SL expr expr) + | #(SR expr expr) + | #(BSR expr expr) + | #(PLUS expr expr) + | #(MINUS expr expr) + | #(DIV expr expr) + | #(MOD expr expr) + | #(STAR expr expr) + | #(INC expr) + | #(DEC expr) + | #(POST_INC expr) + | #(POST_DEC expr) + | #(BNOT expr) + | #(LNOT expr) + | #("instanceof" expr expr) + | #(UNARY_MINUS expr) + | #(UNARY_PLUS expr) + | primaryExpression + ; + +primaryExpression + : IDENT + | #( DOT + ( expr + ( IDENT + | arrayIndex + | "this" + | "class" + | #( "new" IDENT elist ) + | "super" + ) + | #(ARRAY_DECLARATOR typeSpecArray) + | builtInType ("class")? + ) + ) + | arrayIndex + | #(METHOD_CALL primaryExpression elist) + | ctorCall + | #(TYPECAST typeSpec expr) + | newExpression + | constant + | "super" + | "true" + | "false" + | "this" + | "null" + | typeSpec // type name used with instanceof + ; + +ctorCall + : #( CTOR_CALL elist ) + | #( SUPER_CTOR_CALL + ( elist + | primaryExpression elist + ) + ) + ; + +arrayIndex + : #(INDEX_OP expr expression) + ; + +constant + : NUM_INT + | CHAR_LITERAL + | STRING_LITERAL + | NUM_FLOAT + | NUM_DOUBLE + | NUM_LONG + ; + +newExpression + : #( "new" type + ( newArrayDeclarator (arrayInitializer)? + | elist (objBlock)? + ) + ) + + ; + +newArrayDeclarator + : #( ARRAY_DECLARATOR (newArrayDeclarator)? (expression)? ) + ; diff --git a/languages/java/javasupport_events.h b/languages/java/javasupport_events.h new file mode 100644 index 00000000..c267b8e5 --- /dev/null +++ b/languages/java/javasupport_events.h @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (C) 2003 by Roberto Raggi * + * roberto@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __javasupport_events_h +#define __javasupport_events_h + +#include "driver.h" +#include "kdevdeepcopy.h" + +#include <qevent.h> +#include <qvaluelist.h> + +#if QT_VERSION < 0x030100 +#include <kdevmutex.h> +#else +#include <qmutex.h> +#endif + +enum +{ + Event_FileParsed = QEvent::User + 1000 +}; + +class FileParsedEvent: public QCustomEvent +{ +public: + FileParsedEvent( const QString& fileName, const QValueList<Problem>& problems ) + : QCustomEvent(Event_FileParsed), m_fileName( deepCopy(fileName) ) + { + // the members are deep copies + QValueListConstIterator<Problem> it = problems.begin(); + while (it != problems.end()) { + Problem p = *it; + m_problems.append(Problem(deepCopy(p.text()), p.line(), p.column(), p.level())); + ++it; + } + } + + QString fileName() const { return m_fileName; } + QValueList<Problem> problems() const { return m_problems; } + +private: + QString m_fileName; + QValueList<Problem> m_problems; + +private: + FileParsedEvent( const FileParsedEvent& source ); + void operator = ( const FileParsedEvent& source ); +}; + + +#endif // __javasupport_events_h diff --git a/languages/java/javasupport_utils.cpp b/languages/java/javasupport_utils.cpp new file mode 100644 index 00000000..1fa28b81 --- /dev/null +++ b/languages/java/javasupport_utils.cpp @@ -0,0 +1,52 @@ + +#include "javasupport_utils.h" +#include <codemodel.h> + +static void typeNameList( QStringList& path, QStringList & lst, const CodeModel * model ); +static void typeNameList( QStringList& path, QStringList & lst, NamespaceDom ns ); +static void typeNameList( QStringList & path, QStringList & lst, ClassDom klass ); + +QStringList typeNameList( const CodeModel* model ) +{ + QStringList lst; + QStringList path; + typeNameList( path, lst, model ); + return lst; +} + +static void typeNameList( QStringList& path, QStringList & lst, const CodeModel * model ) +{ + const FileList fileList = model->fileList(); + for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it ) + typeNameList( path, lst, model_cast<NamespaceDom>(*it) ); +} + +static void typeNameList( QStringList& path, QStringList & lst, NamespaceDom ns ) +{ + if( !ns->isFile() ) + path.push_back( ns->name() ); + + const NamespaceList namespaceList = ns->namespaceList(); + for( NamespaceList::ConstIterator it=namespaceList.begin(); it!=namespaceList.end(); ++it ) + typeNameList( path, lst, *it ); + + const ClassList classList = ns->classList(); + for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it ) + typeNameList( path, lst, *it ); + + if( !ns->isFile() ) + path.pop_back(); +} + +static void typeNameList( QStringList & path, QStringList & lst, ClassDom klass ) +{ + path.push_back( klass->name() ); + + lst << path.join( "::" ); + + const ClassList classList = klass->classList(); + for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it ) + typeNameList( path, lst, *it ); + path.pop_back(); +} + diff --git a/languages/java/javasupport_utils.h b/languages/java/javasupport_utils.h new file mode 100644 index 00000000..12d2fec0 --- /dev/null +++ b/languages/java/javasupport_utils.h @@ -0,0 +1,21 @@ +/*************************************************************************** + * Copyright (C) 2003 by Roberto Raggi * + * roberto@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __javasupport_utils_h +#define __javasupport_utils_h + +#include <qstringlist.h> + +class CodeModel; + +QStringList typeNameList( const CodeModel* model ); + +#endif // __javasupport_utils_h diff --git a/languages/java/javasupportfactory.cpp b/languages/java/javasupportfactory.cpp new file mode 100644 index 00000000..a453c84a --- /dev/null +++ b/languages/java/javasupportfactory.cpp @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (C) 2000-2001 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <kinstance.h> +#include <kstandarddirs.h> +#include <kdevplugininfo.h> +#include "javasupportfactory.h" + +static const KDevPluginInfo data("kdevjavasupport"); +K_EXPORT_COMPONENT_FACTORY( libkdevjavasupport, JavaSupportFactory ) + +JavaSupportFactory::JavaSupportFactory() + : KDevGenericFactory<JavaSupportPart>( data ) +{ +} + +KInstance *JavaSupportFactory::createInstance() +{ + KInstance *instance = KDevGenericFactory<JavaSupportPart>::createInstance(); + KStandardDirs *dirs = instance->dirs(); + dirs->addResourceType( "newclasstemplates", KStandardDirs::kde_default("data") + "kdevjavasupport/newclass/" ); + dirs->addResourceType( "pcs", KStandardDirs::kde_default( "data" ) + "kdevjavasupport/pcs/" ); + + return instance; +} + +const KDevPluginInfo *JavaSupportFactory::info() +{ + return &data; +} + diff --git a/languages/java/javasupportfactory.h b/languages/java/javasupportfactory.h new file mode 100644 index 00000000..fc82d929 --- /dev/null +++ b/languages/java/javasupportfactory.h @@ -0,0 +1,31 @@ +/*************************************************************************** + * Copyright (C) 2000-2001 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _JAVASUPPORTFACTORY_H_ +#define _JAVASUPPORTFACTORY_H_ + +#include <kdevgenericfactory.h> +#include "javasupportpart.h" + +class KDevPluginInfo; + +class JavaSupportFactory : public KDevGenericFactory<JavaSupportPart> +{ +public: + JavaSupportFactory(); + + static const KDevPluginInfo *info(); + +protected: + virtual KInstance *createInstance(); +}; + +#endif diff --git a/languages/java/javasupportpart.cpp b/languages/java/javasupportpart.cpp new file mode 100644 index 00000000..c8122a47 --- /dev/null +++ b/languages/java/javasupportpart.cpp @@ -0,0 +1,908 @@ +/*************************************************************************** + * Copyright (C) 1999 by Jonas Nordin * + * jonas.nordin@syncom.se * + * Copyright (C) 2000-2001 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2002-2003 by Roberto Raggi * + * roberto@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "javasupportpart.h" +#include "javasupport_events.h" +#include "problemreporter.h" +#include "backgroundparser.h" +#include "KDevJavaSupportIface.h" +#include "javasupportfactory.h" +#include "catalog.h" +#include "kdevdriver.h" +#include "javasupport_utils.h" + +#include "JavaStoreWalker.hpp" +#include "JavaAST.hpp" + +#include <qheader.h> +#include <qdir.h> +#include <qdom.h> +#include <qfileinfo.h> +#include <qguardedptr.h> +#include <qpopupmenu.h> +#include <qprogressdialog.h> +#include <qstringlist.h> +#include <qtimer.h> +#include <qstatusbar.h> +#include <qprogressbar.h> +#include <qregexp.h> +#include <qlabel.h> +#include <qvbox.h> +#include <kmessagebox.h> +#include <kaction.h> +#include <kapplication.h> +#include <kdebug.h> +#include <kdialogbase.h> +#include <kgenericfactory.h> +#include <klocale.h> +#include <kmainwindow.h> +#include <kstatusbar.h> +#include <kconfig.h> +#include <kdeversion.h> +#include <kstandarddirs.h> +#include <kiconloader.h> + +#include <ktexteditor/document.h> +#include <ktexteditor/editinterface.h> +#include <ktexteditor/view.h> +#include <ktexteditor/selectioninterface.h> +#include <ktexteditor/viewcursorinterface.h> +#include <ktexteditor/clipboardinterface.h> + +#include <ktexteditor/texthintinterface.h> + +#include <kdevcore.h> +#include <kdevproject.h> +#include <kdevmainwindow.h> +#include <kdevpartcontroller.h> +#include <kdevmakefrontend.h> +#include <kdevcoderepository.h> + +#include <domutil.h> +#include <urlutil.h> +#include <config.h> + +enum { KDEV_DB_VERSION = 7 }; +enum { KDEV_PCS_VERSION = 8 }; + +class JavaDriver: public KDevDriver +{ +public: + JavaDriver( JavaSupportPart* javaSupport ) + : KDevDriver( javaSupport ) + { + } + + void fileParsed( const QString& fileName ) + { + //kdDebug(9013) << "-----> file " << fileName << " parsed!" << endl; + RefJavaAST ast = takeTranslationUnit( fileName ); + + if( javaSupport()->problemReporter() ){ + javaSupport()->problemReporter()->removeAllProblems( fileName ); + + QValueList<Problem> pl = problems( fileName ); + QValueList<Problem>::ConstIterator it = pl.begin(); + while( it != pl.end() ){ + const Problem& p = *it++; + javaSupport()->problemReporter()->reportProblem( fileName, p ); + } + } + + if( javaSupport()->codeModel()->hasFile(fileName) ){ + FileDom file = javaSupport()->codeModel()->fileByName( fileName ); + javaSupport()->removeWithReferences( fileName ); + } + + FileDom file = javaSupport()->codeModel()->create<FileModel>(); + file->setName( fileName ); + JavaStoreWalker walker; + walker.setFile( file ); + walker.setCodeModel( javaSupport()->codeModel() ); + walker.compilationUnit( ast ); + javaSupport()->codeModel()->addFile( file ); + + remove( fileName ); + } +}; + +JavaSupportPart::JavaSupportPart(QObject *parent, const char *name, const QStringList &/*args*/) + : KDevLanguageSupport(JavaSupportFactory::info(), parent, name ? name : "KDevJavaSupport"), + m_activeDocument( 0 ), m_activeView( 0 ), m_activeSelection( 0 ), m_activeEditor( 0 ), + m_activeViewCursor( 0 ), m_projectClosed( true ), m_valid( false ) +{ + setInstance(JavaSupportFactory::instance()); + + m_driver = new JavaDriver( this ); + + setXMLFile( "kdevjavasupport.rc" ); + + m_catalogList.setAutoDelete( true ); + setupCatalog(); + + m_backgroundParser = new BackgroundParser( this, &m_eventConsumed ); + m_backgroundParser->start(); + + connect( core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()) ); + connect( core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()) ); + connect( partController(), SIGNAL(savedFile(const KURL&)), + this, SLOT(savedFile(const KURL&)) ); + connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), + this, SLOT(contextMenu(QPopupMenu *, const Context *)) ); + connect( partController(), SIGNAL(activePartChanged(KParts::Part*)), + this, SLOT(activePartChanged(KParts::Part*))); + connect( partController(), SIGNAL(partRemoved(KParts::Part*)), + this, SLOT(partRemoved(KParts::Part*))); + + m_problemReporter = new ProblemReporter( this, 0, "problemReporterWidget" ); + m_problemReporter->setIcon( SmallIcon("info") ); + mainWindow( )->embedOutputView( m_problemReporter, i18n("Problems"), i18n("Problem reporter")); + + connect( core(), SIGNAL(configWidget(KDialogBase*)), + m_problemReporter, SLOT(configWidget(KDialogBase*)) ); + connect( core(), SIGNAL(configWidget(KDialogBase*)), + this, SLOT(configWidget(KDialogBase*)) ); + + KAction *action; + + action = new KAction(i18n("New Class..."), "classnew", 0, + this, SLOT(slotNewClass()), + actionCollection(), "project_newclass"); + action->setToolTip( i18n("Generate a new class") ); + action->setWhatsThis( i18n("<b>New Class</b>Generates a new class.<p>") ); + + // daniel + connect( core( ), SIGNAL( projectConfigWidget( KDialogBase* ) ), this, + SLOT( projectConfigWidget( KDialogBase* ) ) ); + + new KDevJavaSupportIface( this ); + //(void) dcopClient(); +} + + +JavaSupportPart::~JavaSupportPart() +{ + delete( m_driver ); + m_driver = 0; + + if( m_backgroundParser ){ + m_backgroundParser->close(); + m_backgroundParser->wait(); + delete m_backgroundParser; + m_backgroundParser = 0; + } + + codeRepository()->setMainCatalog( 0 ); + + QPtrListIterator<Catalog> it( m_catalogList ); + while( Catalog* catalog = it.current() ){ + ++it; + codeRepository()->unregisterCatalog( catalog ); + } + + mainWindow( )->removeView( m_problemReporter ); + + delete m_problemReporter; + m_problemReporter = 0; +} + +void JavaSupportPart::customEvent( QCustomEvent* ev ) +{ + //kdDebug(9013) << "JavaSupportPart::customEvent()" << endl; + + if( ev->type() == int(Event_FileParsed) ){ + FileParsedEvent* event = (FileParsedEvent*) ev; + QString fileName = event->fileName(); + + if( m_problemReporter ){ + m_problemReporter->removeAllProblems( fileName ); + + bool hasErrors = false; + QValueList<Problem> problems = event->problems(); + QValueList<Problem>::ConstIterator it = problems.begin(); + while( it != problems.end() ){ + const Problem& p = *it++; + if( p.level() == Problem::Level_Error ) + hasErrors = true; + + m_problemReporter->reportProblem( fileName, p ); + } + + m_backgroundParser->lock(); + if( RefJavaAST ast = m_backgroundParser->translationUnit(fileName) ){ + + if( !hasErrors ){ + if( codeModel()->hasFile(fileName) ){ + FileDom file = codeModel()->fileByName( fileName ); + removeWithReferences( fileName ); + } + + FileDom file = codeModel()->create<FileModel>(); + file->setName( fileName ); + JavaStoreWalker walker; + walker.setFile( file ); + walker.setCodeModel( codeModel() ); + + walker.compilationUnit( ast ); + codeModel()->addFile( file ); + + emit addedSourceInfo( fileName ); + } + } + m_backgroundParser->unlock(); + } + emit fileParsed( fileName ); + } +} + +void JavaSupportPart::projectConfigWidget( KDialogBase* /*dlg*/ ) +{ +} + +void JavaSupportPart::configWidget(KDialogBase */*dlg*/) +{ +} + +void JavaSupportPart::activePartChanged(KParts::Part *part) +{ + kdDebug(9032) << "JavaSupportPart::activePartChanged()" << endl; + + bool enabled = false; + + m_activeDocument = dynamic_cast<KTextEditor::Document*>( part ); + m_activeView = part ? dynamic_cast<KTextEditor::View*>( part->widget() ) : 0; + m_activeEditor = dynamic_cast<KTextEditor::EditInterface*>( part ); + m_activeSelection = dynamic_cast<KTextEditor::SelectionInterface*>( part ); + m_activeViewCursor = part ? dynamic_cast<KTextEditor::ViewCursorInterface*>( m_activeView ) : 0; + + m_activeFileName = QString::null; + + if (m_activeDocument) { + m_activeFileName = URLUtil::canonicalPath( m_activeDocument->url().path() ); + QFileInfo fi( m_activeFileName ); + QString ext = fi.extension(); + if (fileExtensions().contains(ext)) + enabled = true; + } + + if( !part ) + return; + + if( !m_activeView ) + return; + +#if 0 + KTextEditor::TextHintInterface* textHintIface = dynamic_cast<KTextEditor::TextHintInterface*>( m_activeView ); + if( !textHintIface ) + return; + + connect( view, SIGNAL(needTextHint(int,int,QString&)), + this, SLOT(slotNeedTextHint(int,int,QString&)) ); + + textHintIface->enableTextHints( 1000 ); +#endif +} + + +void JavaSupportPart::projectOpened( ) +{ + kdDebug( 9013 ) << "projectOpened( )" << endl; + + m_projectDirectory = URLUtil::canonicalPath( project()->projectDirectory() ); + + connect( project( ), SIGNAL( addedFilesToProject( const QStringList & ) ), + this, SLOT( addedFilesToProject( const QStringList & ) ) ); + connect( project( ), SIGNAL( removedFilesFromProject( const QStringList &) ), + this, SLOT( removedFilesFromProject( const QStringList & ) ) ); + connect( project( ), SIGNAL( changedFilesInProject( const QStringList & ) ), + this, SLOT( changedFilesInProject( const QStringList & ) ) ); + connect( project(), SIGNAL(projectCompiled()), + this, SLOT(slotProjectCompiled()) ); + + m_timestamp.clear(); + + m_projectClosed = false; + + QTimer::singleShot( 500, this, SLOT( initialParse( ) ) ); +} + + +void JavaSupportPart::projectClosed( ) +{ + kdDebug( 9013 ) << "projectClosed( )" << endl; + + saveProjectSourceInfo(); + + if( m_backgroundParser ) + m_backgroundParser->removeAllFiles(); + + m_projectClosed = true; +} + +void JavaSupportPart::contextMenu(QPopupMenu */*popup*/, const Context *context) +{ + m_activeClass = 0; + m_activeFunction = 0; + m_activeVariable = 0; + + if( context->hasType(Context::EditorContext) ){ + // nothing! + } else if( context->hasType(Context::CodeModelItemContext) ){ + const CodeModelItemContext* mcontext = static_cast<const CodeModelItemContext*>( context ); + + if( mcontext->item()->isClass() ){ + m_activeClass = (ClassModel*) mcontext->item(); + } else if( mcontext->item()->isFunction() ){ + m_activeFunction = (FunctionModel*) mcontext->item(); + } + } +} + +void JavaSupportPart::addedFilesToProject(const QStringList &fileList) +{ + QStringList files = fileList; + + for ( QStringList::ConstIterator it = files.begin(); it != files.end(); ++it ) + { + QString path = URLUtil::canonicalPath( m_projectDirectory + "/" + (*it) ); + + maybeParse( path ); + emit addedSourceInfo( path ); + } +} + +void JavaSupportPart::removedFilesFromProject(const QStringList &fileList) +{ + for ( QStringList::ConstIterator it = fileList.begin(); it != fileList.end(); ++it ) + { + QString path = URLUtil::canonicalPath( m_projectDirectory + "/" + *it ); + + removeWithReferences( path ); + m_backgroundParser->removeFile( path ); + } +} + +void JavaSupportPart::changedFilesInProject( const QStringList & fileList ) +{ + QStringList files = fileList; + + for ( QStringList::ConstIterator it = files.begin(); it != files.end(); ++it ) + { + QString path = URLUtil::canonicalPath( m_projectDirectory + "/" + *it ); + + maybeParse( path ); + emit addedSourceInfo( path ); + } +} + +void JavaSupportPart::savedFile(const KURL &fileName) +{ + Q_UNUSED( fileName.path() ); + +#if 0 // not needed anymore + kdDebug(9013) << "savedFile(): " << fileName.mid ( m_projectDirectory.length() + 1 ) << endl; + + QStringList projectFileList = project()->allFiles(); + if (projectFileList.contains(fileName.mid ( m_projectDirectory.length() + 1 ))) { + maybeParse( fileName ); + emit addedSourceInfo( fileName ); + } +#endif +} + +QString JavaSupportPart::findSourceFile() +{ + QFileInfo fi( m_activeFileName ); + QString path = fi.filePath(); + QString ext = fi.extension(); + QString base = path.left( path.length() - ext.length() ); + QStringList candidates; + + if (ext == "h" || ext == "H" || ext == "hh" || ext == "hxx" || ext == "hpp" || ext == "tlh") { + candidates << (base + "c"); + candidates << (base + "cc"); + candidates << (base + "java"); + candidates << (base + "java"); + candidates << (base + "cxx"); + candidates << (base + "C"); + candidates << (base + "m"); + candidates << (base + "mm"); + candidates << (base + "M"); + candidates << (base + "inl"); + } + + QStringList::ConstIterator it; + for (it = candidates.begin(); it != candidates.end(); ++it) { + kdDebug(9013) << "Trying " << (*it) << endl; + if (QFileInfo(*it).exists()) { + return *it; + } + } + + return m_activeFileName; +} + +KDevLanguageSupport::Features JavaSupportPart::features() +{ + return Features( Classes | Functions | Variables ); +} + +QString JavaSupportPart::formatClassName(const QString &name) +{ + return name; +} + +QString JavaSupportPart::unformatClassName(const QString &name) +{ + return name; +} + +QStringList JavaSupportPart::fileExtensions() const +{ + return QStringList::split(",", "java"); +} + +void JavaSupportPart::slotNewClass() +{ +} + +void JavaSupportPart::addMethod( ClassDom /*klass*/ ) +{ +} + +void JavaSupportPart::addAttribute( ClassDom /*klass*/ ) +{ +} + +void JavaSupportPart::initialParse( ) +{ + // For debugging + if( !project( ) ){ + // messagebox ? + kdDebug( 9013 ) << "No project" << endl; + return; + } + + parseProject( ); + emit updatedSourceInfo(); + m_valid = true; + return; +} + +#if QT_VERSION < 0x030100 +// Taken from qt-3.2/tools/qdatetime.java/QDateTime::toTime_t() and modified for normal function +uint toTime_t(QDateTime t) +{ + tm brokenDown; + brokenDown.tm_sec = t.time().second(); + brokenDown.tm_min = t.time().minute(); + brokenDown.tm_hour = t.time().hour(); + brokenDown.tm_mday = t.date().day(); + brokenDown.tm_mon = t.date().month() - 1; + brokenDown.tm_year = t.date().year() - 1900; + brokenDown.tm_isdst = -1; + int secsSince1Jan1970UTC = (int) mktime( &brokenDown ); + if ( secsSince1Jan1970UTC < -1 ) + secsSince1Jan1970UTC = -1; + return (uint) secsSince1Jan1970UTC; +} +#endif + +bool +JavaSupportPart::parseProject( ) +{ + //QLabel* label = new QLabel( "", mainWindow( )->statusBar( ) ); + //label->setMinimumWidth( 600 ); + //mainWindow( )->statusBar( )->addWidget( label ); + //label->show( ); + + mainWindow()->statusBar()->message( i18n("Updating...") ); + + kapp->processEvents( ); + kapp->setOverrideCursor( waitCursor ); + + QStringList files = modifiedFileList(); + + QProgressBar* bar = new QProgressBar( files.count( ), mainWindow( )->statusBar( ) ); + bar->setMinimumWidth( 120 ); + bar->setCenterIndicator( true ); + mainWindow( )->statusBar( )->addWidget( bar ); + bar->show( ); + + QDir d( m_projectDirectory ); + + QDataStream stream; + QMap< QString, QPair<uint, uint> > pcs; + + if( QFileInfo( project()->projectDirectory() + "/" + + project()->projectName().lower() + ".kdevelop.pcs" ).exists() ) + { + d.rename(project()->projectName().lower() + ".kdevelop.pcs", + project()->projectName() + ".kdevelop.pcs"); + } + QFile f(project()->projectDirectory() + "/" + project()->projectName() + ".kdevelop.pcs"); + if( f.open(IO_ReadOnly) ){ + stream.setDevice( &f ); + + QString sig; + int pcs_version = 0; + stream >> sig >> pcs_version; + if( sig == "PCS" && pcs_version == KDEV_PCS_VERSION ){ + + int numFiles = 0; + stream >> numFiles; + + for( int i=0; i<numFiles; ++i ){ + QString fn; + uint ts; + uint offset; + + stream >> fn >> ts >> offset; + pcs[ fn ] = qMakePair( ts, offset ); + } + } + } + + int n = 0; + for( QStringList::Iterator it = files.begin( ); it != files.end( ); ++it ) { + bar->setProgress( n++ ); + QFileInfo fileInfo( d, *it ); + + if( fileInfo.exists() && fileInfo.isFile() && fileInfo.isReadable() ){ + QString absFilePath = URLUtil::canonicalPath( fileInfo.absFilePath() ); + kdDebug(9013) << "parse file: " << absFilePath << endl; + + if( (n%5) == 0 ){ + kapp->processEvents(); + + if( m_projectClosed ){ + delete( bar ); + return false; + } + } + + if( isValidSource(absFilePath) ){ + QDateTime t = fileInfo.lastModified(); + if( m_timestamp.contains(absFilePath) && m_timestamp[absFilePath] == t ) + continue; + +#if QT_VERSION >= 0x030100 + if( pcs.contains(absFilePath) && t.toTime_t() == pcs[absFilePath].first ){ +#else + if( pcs.contains(absFilePath) && toTime_t(t) == pcs[absFilePath].first ){ +#endif + stream.device()->at( pcs[absFilePath].second ); + FileDom file = codeModel()->create<FileModel>(); + file->read( stream ); + codeModel()->addFile( file ); + } else { + m_driver->parseFile( absFilePath ); + } + + m_timestamp[ absFilePath ] = t; + } + } + + if( m_projectClosed ){ + kdDebug(9013) << "ABORT" << endl; + kapp->restoreOverrideCursor( ); + return false; + } + } + + kdDebug( 9013 ) << "updating sourceinfo" << endl; + emit updatedSourceInfo(); + + mainWindow( )->statusBar( )->removeWidget( bar ); + delete bar; + //mainWindow( )->statusBar( )->removeWidget( label ); + //delete label; + + kapp->restoreOverrideCursor( ); + mainWindow( )->statusBar( )->message( i18n( "Done" ), 2000 ); + + return true; +} + +void JavaSupportPart::maybeParse( const QString& fileName ) +{ + if( !isValidSource(fileName) ) + return; + + QFileInfo fileInfo( fileName ); + QString path = URLUtil::canonicalPath( fileName ); + QDateTime t = fileInfo.lastModified(); + + if( !fileInfo.exists() ){ + removeWithReferences( path ); + return; + } + + QMap<QString, QDateTime>::Iterator it = m_timestamp.find( path ); + if( it != m_timestamp.end() && *it == t ){ + return; + } + + m_timestamp[ path ] = t; + m_driver->parseFile( path ); +} + +void JavaSupportPart::slotNeedTextHint( int /*line*/, int /*column*/, QString& /*textHint*/ ) +{ +} + +QStringList JavaSupportPart::subclassWidget(const QString& /*formName*/) +{ + QStringList newFileNames; + return newFileNames; +} + +QStringList JavaSupportPart::updateWidget(const QString& /*formName*/, const QString& /*fileName*/) +{ + QStringList dummy; + return dummy; +} + +void JavaSupportPart::partRemoved( KParts::Part* part ) +{ + kdDebug(9032) << "JavaSupportPart::partRemoved()" << endl; + + if( KTextEditor::Document* doc = dynamic_cast<KTextEditor::Document*>( part ) ){ + + QString fileName = doc->url().path(); + if( fileName.isEmpty() ) + return; + + QString canonicalFileName = URLUtil::canonicalPath( fileName ); + m_backgroundParser->removeFile( canonicalFileName ); + m_backgroundParser->addFile( canonicalFileName, true ); + } +} + +void JavaSupportPart::slotProjectCompiled() +{ + kdDebug(9013) << "JavaSupportPart::slotProjectCompiled()" << endl; + parseProject(); +} + +QStringList JavaSupportPart::modifiedFileList() +{ + QStringList lst; + + QStringList fileList = project()->allFiles(); + QStringList::Iterator it = fileList.begin(); + while( it != fileList.end() ){ + QString fileName = *it; + ++it; + + QFileInfo fileInfo( m_projectDirectory, fileName ); + + if( !fileExtensions().contains(fileInfo.extension()) ) + continue; + + QDateTime t = fileInfo.lastModified(); + QString path = URLUtil::canonicalPath( fileInfo.absFilePath() ); + QMap<QString, QDateTime>::Iterator dictIt = m_timestamp.find( path ); + if( fileInfo.exists() && dictIt != m_timestamp.end() && *dictIt == t ) + continue; + + lst << fileName; + } + + return lst; +} + +KTextEditor::Document * JavaSupportPart::findDocument( const KURL & url ) +{ + if( !partController()->parts() ) + return 0; + + QPtrList<KParts::Part> parts( *partController()->parts() ); + QPtrListIterator<KParts::Part> it( parts ); + while( KParts::Part* part = it.current() ){ + KTextEditor::Document* doc = dynamic_cast<KTextEditor::Document*>( part ); + if( doc && doc->url() == url ) + return doc; + ++it; + } + + return 0; +} + +void JavaSupportPart::setupCatalog( ) +{ + kdDebug(9013) << "JavaSupportPart::setupCatalog()" << endl; + + QStringList indexList = QStringList() << "kind" << "name" << "scope" << "fileName"; + + KStandardDirs *dirs = JavaSupportFactory::instance()->dirs(); + QStringList pcsList = dirs->findAllResources( "pcs", "*.db", false, true ); + QStringList pcsIdxList = dirs->findAllResources( "pcs", "*.idx", false, true ); + + if( pcsList.size() && pcsVersion() < KDEV_DB_VERSION ){ + QStringList l = pcsList + pcsIdxList; + int rtn = KMessageBox::questionYesNoList( 0, i18n("Persistent class store will be disabled: you have a wrong version of pcs installed.\nRemove old pcs files?"), l, i18n("Java Support"), KStdGuiItem::remove(), i18n("Keep Them") ); + if( rtn == KMessageBox::Yes ){ + QStringList::Iterator it = l.begin(); + while( it != l.end() ){ + QFile::remove( *it ); + ++it; + } + // @todo regenerate the pcs list + pcsList.clear(); + } else { + return; + } + } + + QStringList::Iterator it = pcsList.begin(); + while( it != pcsList.end() ){ + Catalog* catalog = new Catalog(); + catalog->open( *it ); + ++it; + + for( QStringList::Iterator idxIt=indexList.begin(); idxIt!=indexList.end(); ++idxIt ) + catalog->addIndex( (*idxIt).utf8() ); + + m_catalogList.append( catalog ); + codeRepository()->registerCatalog( catalog ); + } + + setPcsVersion( KDEV_DB_VERSION ); +} + +KMimeType::List JavaSupportPart::mimeTypes( ) +{ + KMimeType::List list; + KMimeType::Ptr mime; + + mime = KMimeType::mimeType( "text/x-java" ); + if( mime ) + list << mime; + + return list; +} + +int JavaSupportPart::pcsVersion() +{ + KConfig* config = JavaSupportFactory::instance()->config(); + KConfigGroupSaver cgs( config, "PCS" ); + return config->readNumEntry( "Version", 0 ); +} + +void JavaSupportPart::setPcsVersion( int version ) +{ + KConfig* config = JavaSupportFactory::instance()->config(); + KConfigGroupSaver cgs( config, "PCS" ); + config->writeEntry( "Version", version ); + config->sync(); +} + +QString JavaSupportPart::formatTag( const Tag & /*inputTag*/ ) +{ + return QString::null; +} + +void JavaSupportPart::removeWithReferences( const QString & fileName ) +{ + kdDebug(9013) << "remove with references: " << fileName << endl; + m_timestamp.remove( fileName ); + if( !codeModel()->hasFile(fileName) ) + return; + + emit aboutToRemoveSourceInfo( fileName ); + + codeModel()->removeFile( codeModel()->fileByName(fileName) ); +} + +bool JavaSupportPart::isValidSource( const QString& fileName ) const +{ + QFileInfo fileInfo( fileName ); + return fileExtensions().contains( fileInfo.extension() ) && !QFile::exists(fileInfo.dirPath(true) + "/.kdev_ignore"); +} + +QString JavaSupportPart::formatModelItem( const CodeModelItem *item, bool shortDescription ) +{ + if (item->isFunction()) + { + const FunctionModel *model = static_cast<const FunctionModel*>(item); + QString function; + QString args; + ArgumentList argumentList = model->argumentList(); + for (ArgumentList::const_iterator it = argumentList.begin(); it != argumentList.end(); ++it) + { + args.isEmpty() ? args += "" : args += ", " ; + args += formatModelItem((*it).data()); + } + if( !shortDescription ) + function += model->resultType() + " "; + + function += model->name() + "(" + args + ")" + + (model->isAbstract() ? QString(" = 0") : QString("") ); + + return function; + } + else if (item->isVariable()) + { + const VariableModel *model = static_cast<const VariableModel*>(item); + if( shortDescription ) + return model->name(); + return model->type() + " " + model->name(); + } + else if (item->isArgument()) + { + const ArgumentModel *model = static_cast<const ArgumentModel*>(item); + QString arg; + if( !shortDescription ) + arg += model->type() + " "; + arg += model->name(); + if( !shortDescription ) + arg += model->defaultValue().isEmpty() ? QString("") : QString(" = ") + model->defaultValue(); + return arg.stripWhiteSpace(); + } + else + return KDevLanguageSupport::formatModelItem( item, shortDescription ); +} + +void JavaSupportPart::addClass( ) +{ + slotNewClass(); +} + +void JavaSupportPart::saveProjectSourceInfo( ) +{ + const FileList fileList = codeModel()->fileList(); + + if( !project() || fileList.isEmpty() ) + return; + + QFile f( project()->projectDirectory() + "/" + + project()->projectName() + ".kdevelop.pcs" ); + if( !f.open( IO_WriteOnly ) ) + return; + + QDataStream stream( &f ); + QMap<QString, uint> offsets; + + QString pcs( "PCS" ); + stream << pcs << KDEV_PCS_VERSION; + + stream << int( fileList.size() ); + for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it ){ + const FileDom dom = (*it); +#if QT_VERSION >= 0x030100 + stream << dom->name() << m_timestamp[ dom->name() ].toTime_t(); +#else + stream << dom->name() << toTime_t(m_timestamp[ dom->name() ]); +#endif + offsets.insert( dom->name(), stream.device()->at() ); + stream << (uint)0; // dummy offset + } + + for( FileList::ConstIterator it=fileList.begin(); it!=fileList.end(); ++it ){ + const FileDom dom = (*it); + int offset = stream.device()->at(); + + dom->write( stream ); + + int end = stream.device()->at(); + + stream.device()->at( offsets[dom->name()] ); + stream << offset; + stream.device()->at( end ); + } +} + +#include "javasupportpart.moc" diff --git a/languages/java/javasupportpart.h b/languages/java/javasupportpart.h new file mode 100644 index 00000000..e6280560 --- /dev/null +++ b/languages/java/javasupportpart.h @@ -0,0 +1,165 @@ +/*************************************************************************** + * Copyright (C) 1999 by Jonas Nordin * + * jonas.nordin@syncom.se * + * Copyright (C) 2000-2001 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2002-2003 by Roberto Raggi * + * roberto@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _JAVASUPPORTPART_H_ +#define _JAVASUPPORTPART_H_ + +#include <kdevcore.h> +#include <kdevlanguagesupport.h> + +#include <kdialogbase.h> +#include <qguardedptr.h> +#include <qstring.h> +#include <qwaitcondition.h> +#include <qdatetime.h> + +class Context; +class ProblemReporter; +class BackgroundParser; +class Catalog; +class QLabel; +class QProgressBar; +class QStringList; +class QListViewItem; +class KListView; +class Driver; + +namespace KParts { class Part; } +namespace KTextEditor +{ + class Document; + class View; + class EditInterface; + class SelectionInterface; + class ViewCursorInterface; +} + +class JavaSupportPart : public KDevLanguageSupport +{ + Q_OBJECT + +public: + JavaSupportPart( QObject *parent, const char *name, const QStringList &args ); + virtual ~JavaSupportPart(); + + bool isValid() const { return m_valid; } + + ProblemReporter* problemReporter() { return m_problemReporter; } + BackgroundParser* backgroundParser() { return m_backgroundParser; } + + const QPtrList<Catalog>& catalogList() { return m_catalogList; } + + bool isValidSource( const QString& fileName ) const; + QStringList fileExtensions( ) const; + + virtual void customEvent( QCustomEvent* ev ); + + virtual QStringList subclassWidget(const QString& formName); + virtual QStringList updateWidget(const QString& formName, const QString& fileName); + + KTextEditor::Document* findDocument( const KURL& url ); + + static KConfig *config(); + + virtual QString formatTag( const Tag& tag ); + virtual QString formatModelItem( const CodeModelItem *item, bool shortDescription=false ); + virtual void addClass(); + +signals: + void fileParsed( const QString& fileName ); + +protected: + virtual KDevLanguageSupport::Features features(); + virtual KMimeType::List mimeTypes(); + virtual QString formatClassName(const QString &name); + virtual QString unformatClassName(const QString &name); + virtual void addMethod( ClassDom klass ); + virtual void addAttribute( ClassDom klass ); + +private slots: + void activePartChanged(KParts::Part *part); + void partRemoved( KParts::Part* part ); + void projectOpened(); + void projectClosed(); + void savedFile(const KURL &fileName); + void configWidget(KDialogBase *dlg); + void projectConfigWidget(KDialogBase *dlg); + void contextMenu(QPopupMenu *popup, const Context *context); + void addedFilesToProject(const QStringList &fileList); + void removedFilesFromProject(const QStringList &fileList); + void changedFilesInProject( const QStringList & fileList ); + void slotProjectCompiled(); + void setupCatalog(); + + void slotNewClass(); + + void slotNeedTextHint( int, int, QString& ); + + /** + * loads, parses and creates both classstores needed + */ + void initialParse( ); + + /** + * only parses the current project + */ + bool parseProject( ); + +private: + + /** + * checks if a file has to be parsed + */ + void maybeParse( const QString& fileName ); + void removeWithReferences( const QString& fileName ); + + QStringList modifiedFileList(); + QString findSourceFile(); + int pcsVersion(); + void setPcsVersion( int version ); + + void saveProjectSourceInfo(); + + QString m_contextFileName; + + QGuardedPtr< ProblemReporter > m_problemReporter; + BackgroundParser* m_backgroundParser; + + KTextEditor::Document* m_activeDocument; + KTextEditor::View* m_activeView; + KTextEditor::SelectionInterface* m_activeSelection; + KTextEditor::EditInterface* m_activeEditor; + KTextEditor::ViewCursorInterface* m_activeViewCursor; + QString m_activeFileName; + + QWaitCondition m_eventConsumed; + bool m_projectClosed; + + QMap<QString, QDateTime> m_timestamp; + bool m_valid; + + QPtrList<Catalog> m_catalogList; + Driver* m_driver; + QString m_projectDirectory; + + ClassDom m_activeClass; + FunctionDom m_activeFunction; + VariableDom m_activeVariable; + + friend class KDevJavaSupportIface; + friend class JavaDriver; +}; + +#endif diff --git a/languages/java/javatemplates b/languages/java/javatemplates new file mode 100644 index 00000000..09373351 --- /dev/null +++ b/languages/java/javatemplates @@ -0,0 +1,3 @@ +<!DOCTYPE Templates> +<Templates> +</Templates> diff --git a/languages/java/kdevdeepcopy.h b/languages/java/kdevdeepcopy.h new file mode 100644 index 00000000..8e7d8fbe --- /dev/null +++ b/languages/java/kdevdeepcopy.h @@ -0,0 +1,12 @@ +#ifndef KDEVDEEPCOPY_H +#define KDEVDEEPCOPY_H + +#include <qstring.h> + +inline QString deepCopy( const QString& s ) +{ + QCString str = s.utf8(); + return QString::fromUtf8( str, str.length() ); +} + +#endif diff --git a/languages/java/kdevdriver.cpp b/languages/java/kdevdriver.cpp new file mode 100644 index 00000000..444217ff --- /dev/null +++ b/languages/java/kdevdriver.cpp @@ -0,0 +1,44 @@ + +#include "kdevdriver.h" +#include "JavaLexer.hpp" +#include <unistd.h> +#include <qfileinfo.h> + +KDevDriver::KDevDriver( JavaSupportPart* javaSupport ) + : m_javaSupport( javaSupport ) +{ +} + +JavaSupportPart* KDevDriver::javaSupport() +{ + return m_javaSupport; +} + +void KDevDriver::setupProject() +{ + QMap<QString, bool> map; + + { + QStringList fileList = m_javaSupport->project()->allFiles(); + QStringList::ConstIterator it = fileList.begin(); + while( it != fileList.end() ){ + QFileInfo info( *it ); + ++it; + + map.insert( info.dirPath(true), true ); + } + } + + { + QMap<QString, bool>::Iterator it = map.begin(); + while( it != map.end() ){ + addIncludePath( it.key() ); + ++it; + } + } +} + +void KDevDriver::setupLexer( JavaLexer* lexer ) +{ + Driver::setupLexer( lexer ); +} diff --git a/languages/java/kdevdriver.h b/languages/java/kdevdriver.h new file mode 100644 index 00000000..041129fa --- /dev/null +++ b/languages/java/kdevdriver.h @@ -0,0 +1,30 @@ + +#ifndef __kdevdriver_h +#define __kdevdriver_h + +#include "javasupportpart.h" + +#include <kdevproject.h> +#include <kdeversion.h> + +#include "driver.h" + +#include <cstdlib> +#include <unistd.h> + +class KDevDriver: public Driver +{ +public: + KDevDriver( JavaSupportPart* javaSupport ); + JavaSupportPart* javaSupport(); + void setupProject(); + +protected: + void setupLexer( JavaLexer* lexer ); + +private: + JavaSupportPart* m_javaSupport; +}; + +#endif + diff --git a/languages/java/kdevjavasupport.desktop b/languages/java/kdevjavasupport.desktop new file mode 100644 index 00000000..053ecfce --- /dev/null +++ b/languages/java/kdevjavasupport.desktop @@ -0,0 +1,85 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Java Support +Comment[ca]=Suport per a Java +Comment[da]=Java understøttelse +Comment[de]=Java-Unterstützung für KDevelop +Comment[el]=Υποστήριξη Java +Comment[es]=Soporte para Java +Comment[et]=Java toetus +Comment[eu]=Java euskarria +Comment[fa]=پشتیبانی جاوا +Comment[fr]=Prise en charge de Java +Comment[ga]=Tacaíocht Java +Comment[gl]=Soporte para Java +Comment[hi]=जावा समर्थन +Comment[hu]=Java-támogatás +Comment[is]=Java stuðningur +Comment[it]=Supporto per Java +Comment[ja]=Java サポート +Comment[nds]=Java-Ünnerstütten för KDevelop +Comment[ne]=जाभा समर्थन +Comment[nl]=Ondersteuning voor Java +Comment[pl]=Obsługa Javy +Comment[pt]=Suporte a Java +Comment[pt_BR]=Suporte ao Java +Comment[ru]=Поддержка языка Java +Comment[sk]=Java podpora +Comment[sl]=Podpora javi +Comment[sr]=Подршка за Java-у +Comment[sr@Latn]=Podrška za Java-u +Comment[sv]=Java-stöd +Comment[ta]=ஜாவா ஆதரவு +Comment[tg]=Ёрӣ намудани забони Java +Comment[tr]=Java Desteği +Comment[zh_CN]=Java 支持 +Comment[zh_TW]=Java 支援 +Name=KDevJavaSupport +Name[da]=KDevelop Java-understøttelse +Name[de]=Unterstützung für Java (KDevelop) +Name[hi]=के-डेव-जावा-समर्थन +Name[nds]=Java-Ünnerstütten för KDevelop +Name[pl]=KDevObsługaJavy +Name[sk]=KDev Java podpora +Name[sv]=KDevelop Java-stöd +Name[ta]=கெடெவ் ஜாவா ஆதரவு +Name[zh_TW]=KDevelop Java 支援 +GenericName=Java Support +GenericName[ca]=Suport per a Java +GenericName[da]=Java-understøttelse +GenericName[de]=Unterstützung für Java +GenericName[el]=Υποστήριξη Java +GenericName[es]=Soporte para Java +GenericName[et]=Java toetus +GenericName[eu]=Java euskarria +GenericName[fa]=پشتیبانی جاوا +GenericName[fr]=Prise en charge de JAVA +GenericName[ga]=Tacaíocht Java +GenericName[gl]=Soporte para Java +GenericName[hi]=जावा समर्थन +GenericName[hu]=Java-támogatás +GenericName[it]=Supporto Java +GenericName[ja]=Java サポート +GenericName[nds]=Ünnerstütten för Java +GenericName[ne]=जाभा समर्थन +GenericName[nl]=Ondersteuning voor Java +GenericName[pl]=Obsługa Javy +GenericName[pt]=Suporte a Java +GenericName[pt_BR]=Suporte ao Java +GenericName[ru]=Поддержка языка Java +GenericName[sk]=Java podpora +GenericName[sl]=Podpora javi +GenericName[sr]=Подршка за Java-у +GenericName[sr@Latn]=Podrška za Java-u +GenericName[sv]=Java-stöd +GenericName[ta]=ஜாவா ஆதரவு +GenericName[tg]=Ёрӣ намудани забони Java +GenericName[tr]=Java Desteği +GenericName[zh_CN]=Java 支持 +GenericName[zh_TW]=Java 支援 +ServiceTypes=KDevelop/LanguageSupport +X-KDE-Library=libkdevjavasupport +X-KDevelop-Version=5 +X-KDevelop-Language=Java +X-KDevelop-Args=Java diff --git a/languages/java/kdevjavasupport.rc b/languages/java/kdevjavasupport.rc new file mode 100644 index 00000000..e9b80d0d --- /dev/null +++ b/languages/java/kdevjavasupport.rc @@ -0,0 +1,4 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="KDevJavaSupport" version="4"> +</kpartgui> + diff --git a/languages/java/newclass_templates/Makefile.am b/languages/java/newclass_templates/Makefile.am new file mode 100644 index 00000000..d24c99ef --- /dev/null +++ b/languages/java/newclass_templates/Makefile.am @@ -0,0 +1,4 @@ +javasupportdatadir = ${kde_datadir}/kdevjavasupport +newclassdir = ${javasupportdatadir}/newclass + +newclass_DATA = java_source diff --git a/languages/java/newclass_templates/java_source b/languages/java/newclass_templates/java_source new file mode 100644 index 00000000..eeeb1ea0 --- /dev/null +++ b/languages/java/newclass_templates/java_source @@ -0,0 +1,9 @@ +#include "$HEADER$" + +$NAMESPACEBEG$ + +$CONSTRUCTORDEFINITIONS$ + +$DEFINITIONS$ + +$NAMESPACEEND$ diff --git a/languages/java/problemreporter.cpp b/languages/java/problemreporter.cpp new file mode 100644 index 00000000..12955662 --- /dev/null +++ b/languages/java/problemreporter.cpp @@ -0,0 +1,299 @@ +/* + Copyright (C) 2002 by Roberto Raggi <roberto@kdevelop.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + version 2, License as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include "problemreporter.h" +#include "javasupportpart.h" +#include "configproblemreporter.h" +#include "backgroundparser.h" + +#include <kdevpartcontroller.h> +#include <kdevmainwindow.h> + +#include <kdeversion.h> +#include <kparts/part.h> +#include <ktexteditor/editinterface.h> +#include <ktexteditor/document.h> +#include <ktexteditor/markinterface.h> + +#include <ktexteditor/markinterfaceextension.h> +#include <ktexteditor/view.h> + +#include <kdebug.h> +#include <klocale.h> +#include <kstatusbar.h> +#include <kurl.h> +#include <kapplication.h> +#include <kiconloader.h> +#include <kdialogbase.h> + +#include <kconfig.h> + +#include <qtimer.h> +#include <qregexp.h> +#include <qvbox.h> +#include <qfileinfo.h> +#include <qwhatsthis.h> +#include <qgroupbox.h> + + +class ProblemItem: public KListViewItem +{ +public: + ProblemItem( QListView* parent, const QString& level, const QString& problem, + const QString& file, const QString& line, const QString& column ) + : KListViewItem( parent, level, problem, file, line, column ) {} + + ProblemItem( QListViewItem* parent, const QString& level, const QString& problem, + const QString& file, const QString& line, const QString& column ) + : KListViewItem( parent, level, problem, file, line, column ) {} + + int compare( QListViewItem* item, int column, bool ascending ) const { + if( column == 2 || column == 3 ){ + int a = text( column ).toInt(); + int b = item->text( column ).toInt(); + if( a == b ) + return 0; + return( a > b ? 1 : -1 ); + } + return KListViewItem::compare( item, column, ascending ); + } + +}; + +ProblemReporter::ProblemReporter( JavaSupportPart* part, QWidget* parent, const char* name ) + : KListView( parent, name ? name : "problemreporter" ), + m_javaSupport( part ), + m_document( 0 ), + m_markIface( 0 ) +{ + QWhatsThis::add(this, i18n("<b>Problem reporter</b><p>This window shows various \"problems\" in your project. " + "It displays TODO entries, FIXME's and errors reported by a language parser. " + "To add a TODO or FIXME entry, just type<br>" + "<tt>//@todo my todo</tt><br>" + "<tt>//TODO: my todo</tt><br>" + "<tt>//FIXME fix this</tt>")); + + addColumn( i18n("Level") ); + addColumn( i18n("File") ); + addColumn( i18n("Line") ); + addColumn( i18n("Column") ); + addColumn( i18n("Problem") ); + setAllColumnsShowFocus( TRUE ); + + m_timer = new QTimer( this ); + + connect( part->partController(), SIGNAL(activePartChanged(KParts::Part*)), + this, SLOT(slotActivePartChanged(KParts::Part*)) ); + connect( part->partController(), SIGNAL(partAdded(KParts::Part*)), + this, SLOT(slotPartAdded(KParts::Part*)) ); + connect( part->partController(), SIGNAL(partRemoved(KParts::Part*)), + this, SLOT(slotPartRemoved(KParts::Part*)) ); + + connect( m_timer, SIGNAL(timeout()), this, SLOT(reparse()) ); + + connect( this, SIGNAL(executed(QListViewItem*)), + this, SLOT(slotSelected(QListViewItem*)) ); + + configure(); +} + +ProblemReporter::~ProblemReporter() +{ +} + +void ProblemReporter::slotActivePartChanged( KParts::Part* part ) +{ + if( !part ) + return; + + m_timer->stop(); + + if( m_document ) + disconnect( m_document, 0, this, 0 ); + + m_document = dynamic_cast<KTextEditor::Document*>( part ); + m_markIface = 0; + + if( !m_document ) + return; + + m_fileName = m_document->url().path(); + + if( !m_javaSupport->isValidSource(m_fileName) ) + return; + + connect( m_document, SIGNAL(textChanged()), this, SLOT(slotTextChanged()) ); + m_markIface = dynamic_cast<KTextEditor::MarkInterface*>( part ); + + if( !m_javaSupport->backgroundParser() ) + return; + + m_javaSupport->backgroundParser()->lock(); + bool needReparse = false; + if( !m_javaSupport->backgroundParser()->translationUnit(m_fileName) ) + needReparse = true; + m_javaSupport->backgroundParser()->unlock(); + + if( needReparse ) + reparse(); +} + +void ProblemReporter::slotTextChanged() +{ + if( m_active ) + m_timer->changeInterval( m_delay ); +} + +void ProblemReporter::removeAllProblems( const QString& filename ) +{ + QListViewItem* current = firstChild(); + while( current ){ + QListViewItem* i = current; + current = current->nextSibling(); + + if( i->text(1) == filename ) + delete( i ); + } + + if( m_document && m_markIface ){ + QPtrList<KTextEditor::Mark> marks = m_markIface->marks(); + QPtrListIterator<KTextEditor::Mark> it( marks ); + while( it.current() ){ + m_markIface->removeMark( it.current()->line, KTextEditor::MarkInterface::markType07 ); + ++it; + } + } +} + +void ProblemReporter::reparse() +{ + if( !m_javaSupport->isValid() ) + return; + + // @todo use the project database to decide which files to parse instead of this! + // ugly hack: do not parse non .java ending files + if ( !m_fileName.endsWith(".java") ) + return; + + m_timer->stop(); + + kdDebug(9013) << "ProblemReporter::reparse()" << endl; + m_javaSupport->backgroundParser()->addFile( m_fileName ); + kdDebug(9013) << "---> file added " << m_fileName << endl; +} + +void ProblemReporter::slotSelected( QListViewItem* item ) +{ + KURL url( item->text(1) ); + int line = item->text( 2 ).toInt(); + // int column = item->text( 3 ).toInt(); + m_javaSupport->partController()->editDocument( url, line-1 ); +// m_javaSupport->mainWindow()->lowerView( this ); +} + +void ProblemReporter::reportProblem( const QString& fileName, const Problem& p ) +{ + int markType = levelToMarkType( p.level() ); + if( markType != -1 && m_document && m_markIface && m_fileName == fileName ){ + m_markIface->addMark( p.line(), markType ); + } + + QString msg = p.text(); + msg = msg.replace( QRegExp("\n"), "" ); + + new ProblemItem( this, + levelToString( p.level() ), + fileName, + QString::number( p.line() + 1 ), + QString::number( p.column() + 1 ), + msg ); +} + +void ProblemReporter::configure() +{ + kdDebug(9013) << "ProblemReporter::configure()" << endl; + KConfig* config = kapp->config(); + config->setGroup( "General Options" ); + m_active = config->readBoolEntry( "EnableJavaBgParser", TRUE ); + m_delay = config->readNumEntry( "BgParserDelay", 500 ); +} + +void ProblemReporter::configWidget( KDialogBase* dlg ) +{ + QVBox *vbox = dlg->addVBoxPage(i18n("Java Parsing")); + ConfigureProblemReporter* w = new ConfigureProblemReporter( vbox ); + //FIXME adymo: unused functionality + w->groupBox3->hide(); + connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); + connect(dlg, SIGNAL(okClicked()), this, SLOT(configure())); +} + +void ProblemReporter::slotPartAdded( KParts::Part* part ) +{ + KTextEditor::MarkInterfaceExtension* iface = dynamic_cast<KTextEditor::MarkInterfaceExtension*>( part ); + + if( !iface ) + return; + + iface->setPixmap( KTextEditor::MarkInterface::markType07, SmallIcon("stop") ); +} + +void ProblemReporter::slotPartRemoved( KParts::Part* part ) +{ + kdDebug(9013) << "ProblemReporter::slotPartRemoved()" << endl; + if( part == m_document ){ + m_document = 0; + m_timer->stop(); + } +} + +QString ProblemReporter::levelToString( int level ) const +{ + switch( level ) + { + case Problem::Level_Error: + return QString::fromLatin1( "Error" ); + case Problem::Level_Warning: + return QString::fromLatin1( "Warning" ); + case Problem::Level_Todo: + return QString::fromLatin1( "Todo" ); + case Problem::Level_Fixme: + return QString::fromLatin1( "Fixme" ); + default: + return QString::null; + } +} + +int ProblemReporter::levelToMarkType( int level ) const +{ + switch( level ) + { + case Problem::Level_Error: + return KTextEditor::MarkInterface::markType07; + case Problem::Level_Warning: + return -1; + case Problem::Level_Todo: + return -1; + case Problem::Level_Fixme: + return -1; + default: + return -1; + } +} + +#include "problemreporter.moc" diff --git a/languages/java/problemreporter.h b/languages/java/problemreporter.h new file mode 100644 index 00000000..93835583 --- /dev/null +++ b/languages/java/problemreporter.h @@ -0,0 +1,74 @@ +/* + Copyright (C) 2002 by Roberto Raggi <roberto@kdevelop.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + version 2, License as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef PROBLEMSREPORTER_H +#define PROBLEMSREPORTER_H + +#include <klistview.h> +#include <qguardedptr.h> + +class JavaSupportPart; +class QTimer; +class KDialogBase; +class Problem; + +namespace KParts{ + class Part; +} + +namespace KTextEditor{ + class MarkInterface; + class Document; +} + +class ProblemReporter: public KListView{ + Q_OBJECT +public: + ProblemReporter( JavaSupportPart* part, QWidget* parent=0, const char* name=0 ); + virtual ~ProblemReporter(); + + void removeAllProblems( const QString& filename ); + void reportProblem( const QString& fileName, const Problem& p ); + +public slots: + void reparse(); + void configure(); + void configWidget( KDialogBase* ); + +private slots: + void slotPartAdded( KParts::Part* ); + void slotPartRemoved( KParts::Part* ); + void slotActivePartChanged( KParts::Part* ); + void slotTextChanged(); + void slotSelected( QListViewItem* ); + +private: + QString levelToString( int level ) const; + int levelToMarkType( int level ) const; + +private: + JavaSupportPart* m_javaSupport; + QGuardedPtr<KTextEditor::Document> m_document; + KTextEditor::MarkInterface* m_markIface; + QTimer* m_timer; + QString m_fileName; + int m_active; + int m_delay; +}; + +#endif |