From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- languages/pascal/Makefile.am | 33 + languages/pascal/PascalAST.hpp | 51 + languages/pascal/PascalLexer.cpp | 1309 +++ languages/pascal/PascalLexer.hpp | 121 + languages/pascal/PascalParser.cpp | 9744 ++++++++++++++++++++ languages/pascal/PascalParser.hpp | 422 + languages/pascal/PascalStoreWalker.cpp | 3409 +++++++ languages/pascal/PascalStoreWalker.hpp | 172 + languages/pascal/PascalStoreWalkerTokenTypes.hpp | 206 + languages/pascal/PascalStoreWalkerTokenTypes.txt | 188 + languages/pascal/PascalTokenTypes.hpp | 206 + languages/pascal/PascalTokenTypes.txt | 188 + languages/pascal/README.dox | 26 + languages/pascal/app_templates/Makefile.am | 3 + languages/pascal/app_templates/fpcgtk/.kdev_ignore | 0 languages/pascal/app_templates/fpcgtk/Makefile.am | 16 + languages/pascal/app_templates/fpcgtk/app.kdevelop | 86 + languages/pascal/app_templates/fpcgtk/fpcgtk | 9 + .../app_templates/fpcgtk/fpcgtk.kdevtemplate | 114 + languages/pascal/app_templates/fpcgtk/fpcgtk.png | Bin 0 -> 483 bytes languages/pascal/app_templates/fpcgtk/main.pp | 84 + .../pascal/app_templates/fpchello/.kdev_ignore | 0 .../pascal/app_templates/fpchello/Makefile.am | 16 + .../pascal/app_templates/fpchello/app.kdevelop | 86 + languages/pascal/app_templates/fpchello/fpchello | 9 + .../app_templates/fpchello/fpchello.kdevtemplate | 115 + .../pascal/app_templates/fpchello/fpchello.png | Bin 0 -> 483 bytes languages/pascal/app_templates/fpchello/main.pp | 5 + .../pascal/app_templates/fpcsharedlib/.kdev_ignore | 0 .../pascal/app_templates/fpcsharedlib/Makefile.am | 16 + .../pascal/app_templates/fpcsharedlib/app.kdevelop | 86 + .../pascal/app_templates/fpcsharedlib/fpcsharedlib | 9 + .../fpcsharedlib/fpcsharedlib.kdevtemplate | 115 + .../app_templates/fpcsharedlib/fpcsharedlib.png | Bin 0 -> 483 bytes .../pascal/app_templates/fpcsharedlib/main.pp | 11 + languages/pascal/app_templates/pascal.appwizard | 2 + .../pascal/app_templates/pascalhello/.kdev_ignore | 0 .../pascal/app_templates/pascalhello/Makefile.am | 16 + .../pascal/app_templates/pascalhello/app.kdevelop | 83 + languages/pascal/app_templates/pascalhello/main.pp | 5 + .../pascal/app_templates/pascalhello/pascalhello | 10 + .../pascalhello/pascalhello.kdevtemplate | 116 + .../app_templates/pascalhello/pascalhello.png | Bin 0 -> 10118 bytes languages/pascal/backgroundparser.cpp | 95 + languages/pascal/backgroundparser.h | 35 + languages/pascal/compiler/Makefile.am | 6 + languages/pascal/compiler/dccoptions/Makefile.am | 16 + .../compiler/dccoptions/dccoptionsplugin.cpp | 114 + .../pascal/compiler/dccoptions/dccoptionsplugin.h | 56 + .../compiler/dccoptions/kdevdccoptions.desktop | 54 + .../pascal/compiler/dccoptions/optiontabs.cpp | 399 + languages/pascal/compiler/dccoptions/optiontabs.h | 116 + languages/pascal/compiler/fpcoptions/Makefile.am | 20 + .../compiler/fpcoptions/fpcoptionsplugin.cpp | 126 + .../pascal/compiler/fpcoptions/fpcoptionsplugin.h | 63 + .../compiler/fpcoptions/kdevfpcoptions.desktop | 55 + .../pascal/compiler/fpcoptions/optiontabs.cpp | 657 ++ languages/pascal/compiler/fpcoptions/optiontabs.h | 161 + languages/pascal/configproblemreporter.ui | 88 + languages/pascal/doc/Makefile.am | 6 + languages/pascal/doc/pascal_bugs_fp.toc | 7 + languages/pascal/file_templates/Makefile.am | 2 + languages/pascal/file_templates/dpr | 12 + languages/pascal/file_templates/pas-program | 12 + languages/pascal/file_templates/pas-unit | 19 + languages/pascal/file_templates/pp-program | 12 + languages/pascal/file_templates/pp-unit | 19 + languages/pascal/kdevpascalsupport.desktop | 84 + languages/pascal/kdevpascalsupport.rc | 3 + languages/pascal/pascal.g | 1212 +++ languages/pascal/pascal.tree.g | 468 + languages/pascal/pascalsupport_part.cpp | 323 + languages/pascal/pascalsupport_part.h | 62 + languages/pascal/pascaltemplates | 30 + languages/pascal/problemreporter.cpp | 289 + languages/pascal/problemreporter.h | 78 + 76 files changed, 21786 insertions(+) create mode 100644 languages/pascal/Makefile.am create mode 100644 languages/pascal/PascalAST.hpp create mode 100644 languages/pascal/PascalLexer.cpp create mode 100644 languages/pascal/PascalLexer.hpp create mode 100644 languages/pascal/PascalParser.cpp create mode 100644 languages/pascal/PascalParser.hpp create mode 100644 languages/pascal/PascalStoreWalker.cpp create mode 100644 languages/pascal/PascalStoreWalker.hpp create mode 100644 languages/pascal/PascalStoreWalkerTokenTypes.hpp create mode 100644 languages/pascal/PascalStoreWalkerTokenTypes.txt create mode 100644 languages/pascal/PascalTokenTypes.hpp create mode 100644 languages/pascal/PascalTokenTypes.txt create mode 100644 languages/pascal/README.dox create mode 100644 languages/pascal/app_templates/Makefile.am create mode 100644 languages/pascal/app_templates/fpcgtk/.kdev_ignore create mode 100644 languages/pascal/app_templates/fpcgtk/Makefile.am create mode 100644 languages/pascal/app_templates/fpcgtk/app.kdevelop create mode 100644 languages/pascal/app_templates/fpcgtk/fpcgtk create mode 100644 languages/pascal/app_templates/fpcgtk/fpcgtk.kdevtemplate create mode 100644 languages/pascal/app_templates/fpcgtk/fpcgtk.png create mode 100644 languages/pascal/app_templates/fpcgtk/main.pp create mode 100644 languages/pascal/app_templates/fpchello/.kdev_ignore create mode 100644 languages/pascal/app_templates/fpchello/Makefile.am create mode 100644 languages/pascal/app_templates/fpchello/app.kdevelop create mode 100644 languages/pascal/app_templates/fpchello/fpchello create mode 100644 languages/pascal/app_templates/fpchello/fpchello.kdevtemplate create mode 100644 languages/pascal/app_templates/fpchello/fpchello.png create mode 100644 languages/pascal/app_templates/fpchello/main.pp create mode 100644 languages/pascal/app_templates/fpcsharedlib/.kdev_ignore create mode 100644 languages/pascal/app_templates/fpcsharedlib/Makefile.am create mode 100644 languages/pascal/app_templates/fpcsharedlib/app.kdevelop create mode 100644 languages/pascal/app_templates/fpcsharedlib/fpcsharedlib create mode 100644 languages/pascal/app_templates/fpcsharedlib/fpcsharedlib.kdevtemplate create mode 100644 languages/pascal/app_templates/fpcsharedlib/fpcsharedlib.png create mode 100644 languages/pascal/app_templates/fpcsharedlib/main.pp create mode 100644 languages/pascal/app_templates/pascal.appwizard create mode 100644 languages/pascal/app_templates/pascalhello/.kdev_ignore create mode 100644 languages/pascal/app_templates/pascalhello/Makefile.am create mode 100644 languages/pascal/app_templates/pascalhello/app.kdevelop create mode 100644 languages/pascal/app_templates/pascalhello/main.pp create mode 100644 languages/pascal/app_templates/pascalhello/pascalhello create mode 100644 languages/pascal/app_templates/pascalhello/pascalhello.kdevtemplate create mode 100644 languages/pascal/app_templates/pascalhello/pascalhello.png create mode 100644 languages/pascal/backgroundparser.cpp create mode 100644 languages/pascal/backgroundparser.h create mode 100644 languages/pascal/compiler/Makefile.am create mode 100644 languages/pascal/compiler/dccoptions/Makefile.am create mode 100644 languages/pascal/compiler/dccoptions/dccoptionsplugin.cpp create mode 100644 languages/pascal/compiler/dccoptions/dccoptionsplugin.h create mode 100644 languages/pascal/compiler/dccoptions/kdevdccoptions.desktop create mode 100644 languages/pascal/compiler/dccoptions/optiontabs.cpp create mode 100644 languages/pascal/compiler/dccoptions/optiontabs.h create mode 100644 languages/pascal/compiler/fpcoptions/Makefile.am create mode 100644 languages/pascal/compiler/fpcoptions/fpcoptionsplugin.cpp create mode 100644 languages/pascal/compiler/fpcoptions/fpcoptionsplugin.h create mode 100644 languages/pascal/compiler/fpcoptions/kdevfpcoptions.desktop create mode 100644 languages/pascal/compiler/fpcoptions/optiontabs.cpp create mode 100644 languages/pascal/compiler/fpcoptions/optiontabs.h create mode 100644 languages/pascal/configproblemreporter.ui create mode 100644 languages/pascal/doc/Makefile.am create mode 100644 languages/pascal/doc/pascal_bugs_fp.toc create mode 100644 languages/pascal/file_templates/Makefile.am create mode 100644 languages/pascal/file_templates/dpr create mode 100644 languages/pascal/file_templates/pas-program create mode 100644 languages/pascal/file_templates/pas-unit create mode 100644 languages/pascal/file_templates/pp-program create mode 100644 languages/pascal/file_templates/pp-unit create mode 100644 languages/pascal/kdevpascalsupport.desktop create mode 100644 languages/pascal/kdevpascalsupport.rc create mode 100644 languages/pascal/pascal.g create mode 100644 languages/pascal/pascal.tree.g create mode 100644 languages/pascal/pascalsupport_part.cpp create mode 100644 languages/pascal/pascalsupport_part.h create mode 100644 languages/pascal/pascaltemplates create mode 100644 languages/pascal/problemreporter.cpp create mode 100644 languages/pascal/problemreporter.h (limited to 'languages/pascal') diff --git a/languages/pascal/Makefile.am b/languages/pascal/Makefile.am new file mode 100644 index 00000000..5abaa01b --- /dev/null +++ b/languages/pascal/Makefile.am @@ -0,0 +1,33 @@ +KDE_CXXFLAGS = $(USE_EXCEPTIONS) + +INCLUDES = -I$(top_srcdir)/lib/antlr -I$(top_srcdir)/lib/catalog \ + -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \ + $(all_includes) +SUBDIRS = file_templates app_templates compiler doc + +kde_module_LTLIBRARIES = libkdevpascalsupport.la +libkdevpascalsupport_la_LDFLAGS = $(LEXLIB) $(all_libraries) $(KDE_PLUGIN) +libkdevpascalsupport_la_LIBADD = $(top_builddir)/lib/libkdevelop.la $(top_builddir)/lib/antlr/src/libantlr.la $(top_builddir)/lib/catalog/libkdevcatalog.la + +libkdevpascalsupport_la_SOURCES = pascalsupport_part.cpp PascalLexer.cpp PascalParser.cpp PascalStoreWalker.cpp backgroundparser.cpp configproblemreporter.ui problemreporter.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevpascalsupport.desktop + +rcdir = $(kde_datadir)/kdevpascalsupport +rc_DATA = kdevpascalsupport.rc + +genparser: + antlr pascal.g && antlr pascal.tree.g + +## The following rules assume that you have Java and ANTLR installed, +#PascalLexer.hpp PascalLexer.cpp PascalParser.hpp PascalParser.cpp: pascal.g +# antlr pascal.g + +#PascalStoreWalker.hpp PascalStoreWalker.cpp: pascal.tree.g +# antlr pascal.tree.g + +templatedir = ${kde_datadir}/kdevabbrev/templates +template_DATA = pascaltemplates diff --git a/languages/pascal/PascalAST.hpp b/languages/pascal/PascalAST.hpp new file mode 100644 index 00000000..3df4ea50 --- /dev/null +++ b/languages/pascal/PascalAST.hpp @@ -0,0 +1,51 @@ +#ifndef PASCALAST_HPP +#define PASCALAST_HPP + +#include + +class PascalAST; +typedef antlr::ASTRefCount RefPascalAST; + +class PascalAST : public antlr::CommonAST { +public: + PascalAST() + : m_line(0), m_column(0) {} + + ~PascalAST() {} + + 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::RefToken t ) { + antlr::CommonAST::initialize(t); + m_line = t->getLine() - 1; + m_column = t->getColumn() - 1; + } + + void initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt) { + setType(t); + setText(txt); + m_line = 0; + m_column = 0; + } + + void addChild( RefPascalAST c ) { + antlr::RefAST n( c.get() ); + antlr::BaseAST::addChild( n ); + } + + static antlr::RefAST factory( void ) { + RefPascalAST n(new PascalAST); + return n.get(); + } + +private: + int m_line; + int m_column; +}; + + +#endif diff --git a/languages/pascal/PascalLexer.cpp b/languages/pascal/PascalLexer.cpp new file mode 100644 index 00000000..28f532f8 --- /dev/null +++ b/languages/pascal/PascalLexer.cpp @@ -0,0 +1,1309 @@ +/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalLexer.cpp"$ */ +#include "PascalLexer.hpp" +#include +#include +#include +#include +#include +#include +#include + +#line 1 "pascal.g" +#line 13 "PascalLexer.cpp" +PascalLexer::PascalLexer(ANTLR_USE_NAMESPACE(std)istream& in) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(new ANTLR_USE_NAMESPACE(antlr)CharBuffer(in),false) +{ + initLiterals(); +} + +PascalLexer::PascalLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(ib,false) +{ + initLiterals(); +} + +PascalLexer::PascalLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(state,false) +{ + initLiterals(); +} + +void PascalLexer::initLiterals() +{ + literals["until"] = 146; + literals["xor"] = 123; + literals["abstract"] = 99; + literals["shortint"] = 69; + literals["with"] = 150; + literals["packed"] = 91; + literals["inherited"] = 172; + literals["break"] = 168; + literals["smallint"] = 70; + literals["safecall"] = 64; + literals["constructor"] = 102; + literals["continue"] = 169; + literals["uses"] = 30; + literals["for"] = 147; + literals["else"] = 142; + literals["is"] = 119; + literals["of"] = 51; + literals["and"] = 128; + literals["integer"] = 68; + literals["byte"] = 73; + literals["nil"] = 161; + literals["begin"] = 34; + literals["interface"] = 32; + literals["as"] = 165; + literals["div"] = 126; + literals["write"] = 110; + literals["qword"] = 76; + literals["procedure"] = 47; + literals["shl"] = 129; + literals["var"] = 45; + literals["private"] = 100; + literals["function"] = 49; + literals["unit"] = 31; + literals["downto"] = 149; + literals["name"] = 29; + literals["resourcestring"] = 42; + literals["register"] = 57; + literals["popstack"] = 61; + literals["label"] = 40; + literals["try"] = 155; + literals["raise"] = 154; + literals["not"] = 131; + literals["record"] = 92; + literals["forward"] = 48; + literals["in"] = 118; + literals["except"] = 156; + literals["file"] = 95; + literals["operator"] = 153; + literals["pascal"] = 58; + literals["finalization"] = 39; + literals["cdecl"] = 59; + literals["extended"] = 86; + literals["external"] = 52; + literals["destructor"] = 103; + literals["real"] = 83; + literals["virtual"] = 98; + literals["chr"] = 160; + literals["near"] = 65; + literals["object"] = 97; + literals["public"] = 53; + literals["repeat"] = 145; + literals["library"] = 23; + literals["false"] = 133; + literals["longint"] = 71; + literals["saveregisters"] = 62; + literals["to"] = 148; + literals["asm"] = 166; + literals["case"] = 93; + literals["export"] = 56; + literals["true"] = 132; + literals["do"] = 144; + literals["stdcall"] = 60; + literals["program"] = 35; + literals["absolute"] = 164; + literals["override"] = 105; + literals["then"] = 141; + literals["set"] = 94; + literals["protected"] = 101; + literals["or"] = 122; + literals["word"] = 74; + literals["finally"] = 157; + literals["char"] = 80; + literals["if"] = 140; + literals["far"] = 66; + literals["const"] = 41; + literals["index"] = 28; + literals["assembler"] = 167; + literals["cardinal"] = 75; + literals["string"] = 88; + literals["dispose"] = 170; + literals["read"] = 109; + literals["default"] = 111; + literals["new"] = 173; + literals["array"] = 50; + literals["self"] = 174; + literals["end"] = 25; + literals["single"] = 84; + literals["property"] = 108; + literals["mod"] = 127; + literals["goto"] = 139; + literals["on"] = 158; + literals["comp"] = 87; + literals["initialization"] = 38; + literals["class"] = 104; + literals["int64"] = 72; + literals["published"] = 107; + literals["nodefault"] = 112; + literals["inline"] = 63; + literals["while"] = 143; + literals["boolean"] = 77; + literals["type"] = 44; + literals["double"] = 85; + literals["implementation"] = 33; + literals["exports"] = 26; + literals["alias"] = 54; + literals["exit"] = 171; + literals["shr"] = 130; +} + +ANTLR_USE_NAMESPACE(antlr)RefToken PascalLexer::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 0x2c /* ',' */ : + { + mCOMMA(true); + theRetToken=_returnToken; + break; + } + case 0x3b /* ';' */ : + { + mSEMI(true); + theRetToken=_returnToken; + break; + } + case 0x3d /* '=' */ : + { + mEQUAL(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 0x5e /* '^' */ : + { + mPOINTER(true); + theRetToken=_returnToken; + break; + } + case 0x40 /* '@' */ : + { + mAT(true); + theRetToken=_returnToken; + break; + } + case 0x7d /* '}' */ : + { + mRCURLY(true); + theRetToken=_returnToken; + break; + } + case 0x9 /* '\t' */ : + case 0xa /* '\n' */ : + case 0xc /* '\14' */ : + case 0xd /* '\r' */ : + case 0x20 /* ' ' */ : + { + mWS(true); + theRetToken=_returnToken; + break; + } + 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 0x27 /* '\'' */ : + { + mSTRING_LITERAL(true); + theRetToken=_returnToken; + 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' */ : + { + mNUM_INT(true); + theRetToken=_returnToken; + break; + } + default: + if ((LA(1) == 0x3a /* ':' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mASSIGN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3e /* '>' */ )) { + mNOT_EQUAL(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mLE(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mGE(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x28 /* '(' */ ) && (LA(2) == 0x2e /* '.' */ )) { + mLBRACK2(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2e /* '.' */ ) && (LA(2) == 0x29 /* ')' */ )) { + mRBRACK2(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2b /* '+' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mPLUSEQ(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2d /* '-' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mMINUSEQ(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2a /* '*' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mSTAREQ(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2f /* '/' */ ) && (LA(2) == 0x3d /* '=' */ )) { + mSLASHQE(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x28 /* '(' */ ) && (LA(2) == 0x2a /* '*' */ )) { + mCOMMENT_1(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x7b /* '{' */ ) && ((LA(2) >= 0x0 /* '\0' */ && LA(2) <= 0xff))) { + mCOMMENT_2(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2f /* '/' */ ) && (LA(2) == 0x2f /* '/' */ )) { + mCOMMENT_3(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) == 0x2f /* '/' */ ) && (true)) { + mSLASH(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3a /* ':' */ ) && (true)) { + mCOLON(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3c /* '<' */ ) && (true)) { + mLTH(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3e /* '>' */ ) && (true)) { + mGT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x28 /* '(' */ ) && (true)) { + mLPAREN(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x2e /* '.' */ ) && (true)) { + mDOT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x7b /* '{' */ ) && (true)) { + mLCURLY(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 PascalLexer::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 PascalLexer::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 PascalLexer::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 PascalLexer::mSLASH(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SLASH; + 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 PascalLexer::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(":="); + 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 PascalLexer::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 PascalLexer::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 PascalLexer::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 PascalLexer::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('=' /* 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 PascalLexer::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 PascalLexer::mLTH(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LTH; + 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 PascalLexer::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 PascalLexer::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 PascalLexer::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('>' /* 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 PascalLexer::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 PascalLexer::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 PascalLexer::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 PascalLexer::mLBRACK2(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LBRACK2; + 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 PascalLexer::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 PascalLexer::mRBRACK2(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = RBRACK2; + 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 PascalLexer::mPOINTER(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = POINTER; + 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 PascalLexer::mAT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = AT; + 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 PascalLexer::mDOT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = DOT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('.' /* charlit */ ); + { + if ((LA(1) == 0x2e /* '.' */ )) { + match('.' /* charlit */ ); +#line 1124 "pascal.g" + _ttype = DOTDOT; +#line 719 "PascalLexer.cpp" + } + else { + } + + } + 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 PascalLexer::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("{"); + 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 PascalLexer::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("}"); + 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 PascalLexer::mPLUSEQ(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = PLUSEQ; + 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 PascalLexer::mMINUSEQ(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = MINUSEQ; + 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 PascalLexer::mSTAREQ(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = STAREQ; + 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 PascalLexer::mSLASHQE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SLASHQE; + 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 PascalLexer::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; + + { + 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' */ )) { + match("\r\n"); + } + else if ((LA(1) == 0xd /* '\r' */ ) && (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 1142 "pascal.g" + newline(); +#line 859 "PascalLexer.cpp" + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } +#line 1144 "pascal.g" + _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; +#line 870 "PascalLexer.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 PascalLexer::mCOMMENT_1(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COMMENT_1; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("(*"); + { // ( ... )* + for (;;) { + if ((LA(1) == 0xd /* '\r' */ ) && (LA(2) == 0xa /* '\n' */ ) && ((LA(3) >= 0x0 /* '\0' */ && LA(3) <= 0xff)) && ((LA(4) >= 0x0 /* '\0' */ && LA(4) <= 0xff))) { + match('\r' /* charlit */ ); + match('\n' /* charlit */ ); +#line 1152 "pascal.g" + newline(); +#line 892 "PascalLexer.cpp" + } + else if (((LA(1) == 0x2a /* '*' */ ) && ((LA(2) >= 0x0 /* '\0' */ && LA(2) <= 0xff)) && ((LA(3) >= 0x0 /* '\0' */ && LA(3) <= 0xff)))&&( LA(2) != ')' )) { + match('*' /* charlit */ ); + } + else if ((LA(1) == 0xd /* '\r' */ ) && ((LA(2) >= 0x0 /* '\0' */ && LA(2) <= 0xff)) && ((LA(3) >= 0x0 /* '\0' */ && LA(3) <= 0xff)) && (true)) { + match('\r' /* charlit */ ); +#line 1153 "pascal.g" + newline(); +#line 901 "PascalLexer.cpp" + } + else if ((LA(1) == 0xa /* '\n' */ )) { + match('\n' /* charlit */ ); +#line 1154 "pascal.g" + newline(); +#line 907 "PascalLexer.cpp" + } + else if ((_tokenSet_0.member(LA(1)))) { + { + match(_tokenSet_0); + } + } + else { + goto _loop427; + } + + } + _loop427:; + } // ( ... )* + match("*)"); +#line 1158 "pascal.g" + _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; +#line 924 "PascalLexer.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 PascalLexer::mCOMMENT_2(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COMMENT_2; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('{' /* charlit */ ); + { // ( ... )* + for (;;) { + if ((LA(1) == 0xd /* '\r' */ ) && (LA(2) == 0xa /* '\n' */ ) && ((LA(3) >= 0x0 /* '\0' */ && LA(3) <= 0xff)) && (true)) { + match('\r' /* charlit */ ); + match('\n' /* charlit */ ); +#line 1164 "pascal.g" + newline(); +#line 946 "PascalLexer.cpp" + } + else if ((LA(1) == 0xd /* '\r' */ ) && ((LA(2) >= 0x0 /* '\0' */ && LA(2) <= 0xff)) && (true) && (true)) { + match('\r' /* charlit */ ); +#line 1165 "pascal.g" + newline(); +#line 952 "PascalLexer.cpp" + } + else if ((LA(1) == 0xa /* '\n' */ )) { + match('\n' /* charlit */ ); +#line 1166 "pascal.g" + newline(); +#line 958 "PascalLexer.cpp" + } + else if ((_tokenSet_1.member(LA(1)))) { + { + match(_tokenSet_1); + } + } + else { + goto _loop431; + } + + } + _loop431:; + } // ( ... )* + match('}' /* charlit */ ); +#line 1170 "pascal.g" + _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; +#line 975 "PascalLexer.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 PascalLexer::mCOMMENT_3(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COMMENT_3; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("//"); + { // ( ... )* + for (;;) { + if ((_tokenSet_2.member(LA(1)))) { + matchNot('\n' /* charlit */ ); + } + else { + goto _loop434; + } + + } + _loop434:; + } // ( ... )* + match('\n' /* charlit */ ); +#line 1175 "pascal.g" + _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; +#line 1005 "PascalLexer.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 PascalLexer::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; + + { + matchRange('a','z'); + } + { // ( ... )* + 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 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 0x5f /* '_' */ : + { + match('_' /* charlit */ ); + break; + } + default: + { + goto _loop438; + } + } + } + _loop438:; + } // ( ... )* + _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 PascalLexer::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) == 0x27 /* '\'' */ ) && (LA(2) == 0x27 /* '\'' */ )) { + match("\'\'"); + } + else if ((_tokenSet_3.member(LA(1)))) { + { + match(_tokenSet_3); + } + } + else { + goto _loop442; + } + + } + _loop442:; + } // ( ... )* + 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; +} + +/** a numeric literal. Form is (from Wirth) + * digits + * digits . digits + * digits . digits exponent + * digits exponent + */ +void PascalLexer::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; + + { // ( ... )+ + int _cnt445=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + matchRange('0','9'); + } + else { + if ( _cnt445>=1 ) { goto _loop445; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt445++; + } + _loop445:; + } // ( ... )+ + { + if ((LA(1) == 0x65 /* 'e' */ )) { + mEXPONENT(false); +#line 1204 "pascal.g" + _ttype = NUM_REAL; +#line 1153 "PascalLexer.cpp" + } + else { + { + if (((LA(1) == 0x2e /* '.' */ ))&&((LA(2)!='.')&&(LA(2)!=')'))) { + match('.' /* charlit */ ); +#line 1201 "pascal.g" + _ttype = NUM_REAL; +#line 1161 "PascalLexer.cpp" + { // ( ... )+ + int _cnt449=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + matchRange('0','9'); + } + else { + if ( _cnt449>=1 ) { goto _loop449; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt449++; + } + _loop449:; + } // ( ... )+ + { + if ((LA(1) == 0x65 /* 'e' */ )) { + mEXPONENT(false); + } + else { + } + + } + } + else { + } + + } + } + + } + 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 PascalLexer::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; + + { + match('e' /* charlit */ ); + } + { + 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 _cnt455=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + matchRange('0','9'); + } + else { + if ( _cnt455>=1 ) { goto _loop455; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt455++; + } + _loop455:; + } // ( ... )+ + 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 PascalLexer::_tokenSet_0_data_[] = { 4294958079UL, 4294966271UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x0 0x1 0x2 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 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e +// 0x9f 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa 0xab 0xac +// 0xad 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9 0xba +// 0xbb 0xbc 0xbd +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalLexer::_tokenSet_0(_tokenSet_0_data_,16); +const unsigned long PascalLexer::_tokenSet_1_data_[] = { 4294958079UL, 4294967295UL, 4294967295UL, 3758096383UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x0 0x1 0x2 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 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e +// 0x9f 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa 0xab 0xac +// 0xad 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9 0xba +// 0xbb 0xbc 0xbd +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalLexer::_tokenSet_1(_tokenSet_1_data_,16); +const unsigned long PascalLexer::_tokenSet_2_data_[] = { 4294966271UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 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 [ 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 0x98 0x99 0x9a 0x9b 0x9c +// 0x9d 0x9e 0x9f 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa +// 0xab 0xac 0xad 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 +// 0xb9 0xba 0xbb 0xbc 0xbd +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalLexer::_tokenSet_2(_tokenSet_2_data_,16); +const unsigned long PascalLexer::_tokenSet_3_data_[] = { 4294967295UL, 4294967167UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x0 0x1 0x2 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 [ 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 0x98 0x99 0x9a 0x9b 0x9c +// 0x9d 0x9e 0x9f 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa +// 0xab 0xac 0xad 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 +// 0xb9 0xba 0xbb 0xbc 0xbd +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalLexer::_tokenSet_3(_tokenSet_3_data_,16); + diff --git a/languages/pascal/PascalLexer.hpp b/languages/pascal/PascalLexer.hpp new file mode 100644 index 00000000..f63ac84d --- /dev/null +++ b/languages/pascal/PascalLexer.hpp @@ -0,0 +1,121 @@ +#ifndef INC_PascalLexer_hpp_ +#define INC_PascalLexer_hpp_ + +#line 29 "pascal.g" + + #include "problemreporter.h" + #include "PascalAST.hpp" + + #include + #include + + #define SET_POSITION(ast,t)\ + { \ + RefPascalAST(ast)->setLine( t->getLine() );\ + RefPascalAST(ast)->setColumn( t->getColumn() ); \ + } + +#line 19 "PascalLexer.hpp" +#include +/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalLexer.hpp"$ */ +#include +#include +#include +#include "PascalTokenTypes.hpp" +#include +class CUSTOM_API PascalLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public PascalTokenTypes +{ +#line 1067 "pascal.g" + +private: + ProblemReporter* m_problemReporter; + unsigned int m_numberOfErrors; + +public: + void resetErrors() { m_numberOfErrors = 0; } + unsigned int numberOfErrors() const { return m_numberOfErrors; } + void setProblemReporter( ProblemReporter* r ) { m_problemReporter = r; } + + virtual void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_problemReporter->reportError( ex.getMessage().c_str(), + ex.getFilename().c_str(), + ex.getLine(), + ex.getColumn() ); + ++m_numberOfErrors; + } + + virtual void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_problemReporter->reportError( errorMessage.c_str(), + getFilename().c_str(), + getLine(), getColumn() ); + ++m_numberOfErrors; + } + + virtual void reportWarning( const ANTLR_USE_NAMESPACE(std)string& warnMessage ){ + m_problemReporter->reportWarning( warnMessage.c_str(), + getFilename().c_str(), + getLine(), getColumn() ); + } +#line 30 "PascalLexer.hpp" +private: + void initLiterals(); +public: + bool getCaseSensitiveLiterals() const + { + return false; + } +public: + PascalLexer(ANTLR_USE_NAMESPACE(std)istream& in); + PascalLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); + PascalLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); + ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); + public: void mPLUS(bool _createToken); + public: void mMINUS(bool _createToken); + public: void mSTAR(bool _createToken); + public: void mSLASH(bool _createToken); + public: void mASSIGN(bool _createToken); + public: void mCOMMA(bool _createToken); + public: void mSEMI(bool _createToken); + public: void mCOLON(bool _createToken); + public: void mEQUAL(bool _createToken); + public: void mNOT_EQUAL(bool _createToken); + public: void mLTH(bool _createToken); + public: void mLE(bool _createToken); + public: void mGE(bool _createToken); + public: void mGT(bool _createToken); + public: void mLPAREN(bool _createToken); + public: void mRPAREN(bool _createToken); + public: void mLBRACK(bool _createToken); + public: void mLBRACK2(bool _createToken); + public: void mRBRACK(bool _createToken); + public: void mRBRACK2(bool _createToken); + public: void mPOINTER(bool _createToken); + public: void mAT(bool _createToken); + public: void mDOT(bool _createToken); + public: void mLCURLY(bool _createToken); + public: void mRCURLY(bool _createToken); + public: void mPLUSEQ(bool _createToken); + public: void mMINUSEQ(bool _createToken); + public: void mSTAREQ(bool _createToken); + public: void mSLASHQE(bool _createToken); + public: void mWS(bool _createToken); + public: void mCOMMENT_1(bool _createToken); + public: void mCOMMENT_2(bool _createToken); + public: void mCOMMENT_3(bool _createToken); + public: void mIDENT(bool _createToken); + public: void mSTRING_LITERAL(bool _createToken); + public: void mNUM_INT(bool _createToken); + protected: void mEXPONENT(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; +}; + +#endif /*INC_PascalLexer_hpp_*/ diff --git a/languages/pascal/PascalParser.cpp b/languages/pascal/PascalParser.cpp new file mode 100644 index 00000000..172f4a49 --- /dev/null +++ b/languages/pascal/PascalParser.cpp @@ -0,0 +1,9744 @@ +/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalParser.cpp"$ */ +#include "PascalParser.hpp" +#include +#include +#include +#line 1 "pascal.g" +#line 8 "PascalParser.cpp" +PascalParser::PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,k) +{ +} + +PascalParser::PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,2) +{ +} + +PascalParser::PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(lexer,k) +{ +} + +PascalParser::PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(lexer,2) +{ +} + +PascalParser::PascalParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(state,2) +{ +} + +void PascalParser::compilationUnit() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST compilationUnit_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case PROGRAM: + { + program(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + compilationUnit_AST = RefPascalAST(currentAST.root); + break; + } + case LIBRARY: + { + library(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + compilationUnit_AST = RefPascalAST(currentAST.root); + break; + } + case UNIT: + { + unit(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + compilationUnit_AST = RefPascalAST(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_0); + } else { + throw; + } + } + returnAST = compilationUnit_AST; +} + +void PascalParser::program() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST program_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + programHeading(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case USES: + { + usesClause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case BEGIN: + case LABEL: + case CONST: + case RESOURCESTRING: + case TYPE: + case VAR: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + block(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(DOT); + program_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_0); + } else { + throw; + } + } + returnAST = program_AST; +} + +void PascalParser::library() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST library_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp2_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp2_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp2_AST)); + } + match(LIBRARY); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + { + switch ( LA(1)) { + case USES: + { + usesClause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case EXPORTS: + case BEGIN: + case LABEL: + case CONST: + case RESOURCESTRING: + case TYPE: + case VAR: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + libraryBlock(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + exportsClause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(END); + match(DOT); + library_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_0); + } else { + throw; + } + } + returnAST = library_AST; +} + +void PascalParser::unit() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST unit_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp6_AST = RefPascalAST(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(UNIT); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + interfacePart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + implementationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case INITIALIZATION: + { + { + initializationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case FINALIZATION: + { + finalizationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + break; + } + case BEGIN: + { + realizationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(END); + unit_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_0); + } else { + throw; + } + } + returnAST = unit_AST; +} + +void PascalParser::programHeading() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST programHeading_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp9_AST = RefPascalAST(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(PROGRAM); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case LPAREN: + { + match(LPAREN); + identifierList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + programHeading_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } + returnAST = programHeading_AST; +} + +void PascalParser::usesClause() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST usesClause_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp13_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp13_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp13_AST)); + } + match(USES); + identifierList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + usesClause_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_2); + } else { + throw; + } + } + returnAST = usesClause_AST; +} + +void PascalParser::block() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST block_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + declarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + statementPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + block_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_3); + } else { + throw; + } + } + returnAST = block_AST; +} + +void PascalParser::identifier() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST identifier_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp15_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp15_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp15_AST)); + } + match(IDENT); + identifier_AST = RefPascalAST(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 PascalParser::libraryBlock() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST libraryBlock_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + declarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case BEGIN: + { + statementPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case EXPORTS: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + libraryBlock_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_5); + } else { + throw; + } + } + returnAST = libraryBlock_AST; +} + +void PascalParser::exportsClause() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST exportsClause_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp16_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp16_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp16_AST)); + } + match(EXPORTS); + exportsList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + exportsClause_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_6); + } else { + throw; + } + } + returnAST = exportsClause_AST; +} + +void PascalParser::declarationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST declarationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case LABEL: + { + labelDeclarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case CONST: + { + constantDeclarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case RESOURCESTRING: + { + resourcestringDeclarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case TYPE: + { + typeDeclarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case VAR: + { + variableDeclarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + { + procedureAndFunctionDeclarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop41; + } + } + } + _loop41:; + } // ( ... )* + declarationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_7); + } else { + throw; + } + } + returnAST = declarationPart_AST; +} + +void PascalParser::statementPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST statementPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + compoundStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + statementPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_3); + } else { + throw; + } + } + returnAST = statementPart_AST; +} + +void PascalParser::exportsList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST exportsList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + exportsEntry(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + exportsEntry(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop11; + } + + } + _loop11:; + } // ( ... )* + { + switch ( LA(1)) { + case SEMI: + { + match(SEMI); + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + exportsList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_6); + } else { + throw; + } + } + returnAST = exportsList_AST; +} + +void PascalParser::exportsEntry() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST exportsEntry_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case LITERAL_index: + { + RefPascalAST tmp19_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp19_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp19_AST)); + } + match(LITERAL_index); + integerConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case END: + case COMMA: + case LITERAL_name: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case LITERAL_name: + { + RefPascalAST tmp20_AST = RefPascalAST(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_name); + stringConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case END: + case COMMA: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + exportsEntry_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_8); + } else { + throw; + } + } + returnAST = exportsEntry_AST; +} + +void PascalParser::integerConstant() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST integerConstant_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefPascalAST s_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefPascalAST n_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case NUM_INT: + { + unsignedInteger(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + integerConstant_AST = RefPascalAST(currentAST.root); + break; + } + case PLUS: + case MINUS: + { + sign(); + if (inputState->guessing==0) { + s_AST = returnAST; + } + unsignedInteger(); + if (inputState->guessing==0) { + n_AST = returnAST; + } + if ( inputState->guessing==0 ) { + integerConstant_AST = RefPascalAST(currentAST.root); +#line 880 "pascal.g" + integerConstant_AST=RefPascalAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(n_AST)))); +#line 780 "PascalParser.cpp" + currentAST.root = integerConstant_AST; + if ( integerConstant_AST!=RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + integerConstant_AST->getFirstChild() != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = integerConstant_AST->getFirstChild(); + else + currentAST.child = integerConstant_AST; + currentAST.advanceChildToEnd(); + } + 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_9); + } else { + throw; + } + } + returnAST = integerConstant_AST; +} + +void PascalParser::stringConstant() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST stringConstant_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case STRING_LITERAL: + { + string(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + stringConstant_AST = RefPascalAST(currentAST.root); + break; + } + case CHR: + { + constantChr(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + stringConstant_AST = RefPascalAST(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 = stringConstant_AST; +} + +void PascalParser::identifierList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST identifierList_AST = RefPascalAST(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) == COMMA)) { + match(COMMA); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop378; + } + + } + _loop378:; + } // ( ... )* + if ( inputState->guessing==0 ) { + identifierList_AST = RefPascalAST(currentAST.root); +#line 867 "pascal.g" + identifierList_AST = RefPascalAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(IDLIST)))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(identifierList_AST)))); +#line 880 "PascalParser.cpp" + currentAST.root = identifierList_AST; + if ( identifierList_AST!=RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + identifierList_AST->getFirstChild() != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = identifierList_AST->getFirstChild(); + else + currentAST.child = identifierList_AST; + currentAST.advanceChildToEnd(); + } + identifierList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_11); + } else { + throw; + } + } + returnAST = identifierList_AST; +} + +void PascalParser::interfacePart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST interfacePart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp22_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp22_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp22_AST)); + } + match(INTERFACE); + { + switch ( LA(1)) { + case USES: + { + usesClause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IMPLEMENTATION: + case CONST: + case TYPE: + case PROCEDURE: + case FUNCTION: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case CONST: + { + constantDeclarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case TYPE: + { + typeDeclarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PROCEDURE: + case FUNCTION: + { + procedureHeadersPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + goto _loop24; + } + } + } + _loop24:; + } // ( ... )* + interfacePart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_12); + } else { + throw; + } + } + returnAST = interfacePart_AST; +} + +void PascalParser::implementationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST implementationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp23_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp23_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp23_AST)); + } + match(IMPLEMENTATION); + { + switch ( LA(1)) { + case USES: + { + usesClause(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + case BEGIN: + case INITIALIZATION: + case LABEL: + case CONST: + case RESOURCESTRING: + case TYPE: + case VAR: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + declarationPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + implementationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_13); + } else { + throw; + } + } + returnAST = implementationPart_AST; +} + +void PascalParser::initializationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST initializationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp24_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp24_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp24_AST)); + } + match(INITIALIZATION); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop34; + } + + } + _loop34:; + } // ( ... )* + initializationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_14); + } else { + throw; + } + } + returnAST = initializationPart_AST; +} + +void PascalParser::finalizationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST finalizationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp26_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp26_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp26_AST)); + } + match(FINALIZATION); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop37; + } + + } + _loop37:; + } // ( ... )* + finalizationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_6); + } else { + throw; + } + } + returnAST = finalizationPart_AST; +} + +void PascalParser::realizationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST realizationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp28_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp28_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp28_AST)); + } + match(BEGIN); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop29; + } + + } + _loop29:; + } // ( ... )* + realizationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_6); + } else { + throw; + } + } + returnAST = realizationPart_AST; +} + +void PascalParser::constantDeclarationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST constantDeclarationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp30_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp30_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp30_AST)); + } + match(CONST); + { // ( ... )+ + int _cnt47=0; + for (;;) { + if ((LA(1) == IDENT) && (LA(2) == EQUAL)) { + constantDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((LA(1) == IDENT) && (LA(2) == COLON)) { + typedConstantDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + if ( _cnt47>=1 ) { goto _loop47; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt47++; + } + _loop47:; + } // ( ... )+ + constantDeclarationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_2); + } else { + throw; + } + } + returnAST = constantDeclarationPart_AST; +} + +void PascalParser::typeDeclarationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST typeDeclarationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp31_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp31_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp31_AST)); + } + match(TYPE); + { // ( ... )+ + int _cnt54=0; + for (;;) { + if ((LA(1) == IDENT)) { + typeDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + if ( _cnt54>=1 ) { goto _loop54; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt54++; + } + _loop54:; + } // ( ... )+ + typeDeclarationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_2); + } else { + throw; + } + } + returnAST = typeDeclarationPart_AST; +} + +void PascalParser::procedureHeadersPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST procedureHeadersPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case PROCEDURE: + { + procedureHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + procedureHeadersPart_AST = RefPascalAST(currentAST.root); + break; + } + case FUNCTION: + { + functionHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + procedureHeadersPart_AST = RefPascalAST(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_15); + } else { + throw; + } + } + returnAST = procedureHeadersPart_AST; +} + +void PascalParser::statement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST statement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case NUM_INT: + { + label(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + break; + } + case BEGIN: + case CASE: + case GOTO: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + case RAISE: + case TRY: + case IDENT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case GOTO: + case RAISE: + case IDENT: + { + simpleStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case BEGIN: + case CASE: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + case TRY: + { + structuredStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + statement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = statement_AST; +} + +void PascalParser::labelDeclarationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST labelDeclarationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp33_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp33_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp33_AST)); + } + match(LABEL); + label(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + label(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop44; + } + + } + _loop44:; + } // ( ... )* + match(SEMI); + labelDeclarationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_17); + } else { + throw; + } + } + returnAST = labelDeclarationPart_AST; +} + +void PascalParser::resourcestringDeclarationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST resourcestringDeclarationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp36_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp36_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp36_AST)); + } + match(RESOURCESTRING); + { // ( ... )* + for (;;) { + if ((LA(1) == IDENT)) { + stringConstantDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop50; + } + + } + _loop50:; + } // ( ... )* + resourcestringDeclarationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_17); + } else { + throw; + } + } + returnAST = resourcestringDeclarationPart_AST; +} + +void PascalParser::variableDeclarationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST variableDeclarationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp37_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp37_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp37_AST)); + } + match(VAR); + variableDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI) && (LA(2) == IDENT)) { + match(SEMI); + variableDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop57; + } + + } + _loop57:; + } // ( ... )* + match(SEMI); + variableDeclarationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_17); + } else { + throw; + } + } + returnAST = variableDeclarationPart_AST; +} + +void PascalParser::procedureAndFunctionDeclarationPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST procedureAndFunctionDeclarationPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + procedureAndFunctionDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + procedureAndFunctionDeclarationPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_17); + } else { + throw; + } + } + returnAST = procedureAndFunctionDeclarationPart_AST; +} + +void PascalParser::label() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST label_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + unsignedInteger(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + label_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_18); + } else { + throw; + } + } + returnAST = label_AST; +} + +void PascalParser::constantDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST constantDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(EQUAL); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + constantDeclaration_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_19); + } else { + throw; + } + } + returnAST = constantDeclaration_AST; +} + +void PascalParser::typedConstantDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST typedConstantDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(EQUAL); + typedConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + typedConstantDeclaration_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_19); + } else { + throw; + } + } + returnAST = typedConstantDeclaration_AST; +} + +void PascalParser::stringConstantDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST stringConstantDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(EQUAL); + string(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + stringConstantDeclaration_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_20); + } else { + throw; + } + } + returnAST = stringConstantDeclaration_AST; +} + +void PascalParser::string() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST string_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp46_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp46_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp46_AST)); + } + match(STRING_LITERAL); + string_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_21); + } else { + throw; + } + } + returnAST = string_AST; +} + +void PascalParser::typeDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST typeDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(EQUAL); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + typeDeclaration_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_19); + } else { + throw; + } + } + returnAST = typeDeclaration_AST; +} + +void PascalParser::variableDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST variableDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)RefToken c = ANTLR_USE_NAMESPACE(antlr)nullToken; + RefPascalAST c_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifierList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + 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 246 "pascal.g" + c_AST->setType(VARDECL); +#line 1741 "PascalParser.cpp" + } + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + variableDeclaration_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_22); + } else { + throw; + } + } + returnAST = variableDeclaration_AST; +} + +void PascalParser::type() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST type_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case INTEGER: + case SHORTINT: + case SMALLINT: + case LONGINT: + case INT64: + case BYTE: + case WORD: + case CARDINAL: + case QWORD: + case BOOLEAN: + case BYTEBOOL: + case LONGBOOL: + case CHAR: + case REAL: + case SINGLE: + case DOUBLE: + case EXTENDED: + case COMP: + { + simpleType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_AST = RefPascalAST(currentAST.root); + break; + } + case NUM_INT: + case PLUS: + case MINUS: + case STRING_LITERAL: + case CHR: + case NUM_REAL: + case IDENT: + { + subrangeTypeOrTypeIdentifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_AST = RefPascalAST(currentAST.root); + break; + } + case LPAREN: + { + enumeratedType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_AST = RefPascalAST(currentAST.root); + break; + } + case STRING: + { + stringType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_AST = RefPascalAST(currentAST.root); + break; + } + case ARRAY: + case PACKED: + case RECORD: + case SET: + case FILE: + case OBJECT: + case CLASS: + { + structuredType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_AST = RefPascalAST(currentAST.root); + break; + } + case POINTER: + { + pointerType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_AST = RefPascalAST(currentAST.root); + break; + } + case PROCEDURE: + case FUNCTION: + { + proceduralType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + type_AST = RefPascalAST(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_23); + } else { + throw; + } + } + returnAST = type_AST; +} + +void PascalParser::procedureAndFunctionDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST procedureAndFunctionDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case PROCEDURE: + { + procedureDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + procedureAndFunctionDeclaration_AST = RefPascalAST(currentAST.root); + break; + } + case FUNCTION: + { + functionDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + procedureAndFunctionDeclaration_AST = RefPascalAST(currentAST.root); + break; + } + case CONSTRUCTOR: + { + constructorDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + procedureAndFunctionDeclaration_AST = RefPascalAST(currentAST.root); + break; + } + case DESTRUCTOR: + { + destructorDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + procedureAndFunctionDeclaration_AST = RefPascalAST(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_17); + } else { + throw; + } + } + returnAST = procedureAndFunctionDeclaration_AST; +} + +void PascalParser::procedureDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST procedureDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + procedureHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subroutineBlock(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + procedureDeclaration_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_17); + } else { + throw; + } + } + returnAST = procedureDeclaration_AST; +} + +void PascalParser::functionDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST functionDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + functionHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subroutineBlock(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + functionDeclaration_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_17); + } else { + throw; + } + } + returnAST = functionDeclaration_AST; +} + +void PascalParser::constructorDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST constructorDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + constructorHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + subroutineBlock(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + constructorDeclaration_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_17); + } else { + throw; + } + } + returnAST = constructorDeclaration_AST; +} + +void PascalParser::destructorDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST destructorDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + destructorHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + subroutineBlock(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + destructorDeclaration_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_17); + } else { + throw; + } + } + returnAST = destructorDeclaration_AST; +} + +void PascalParser::compoundStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST compoundStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + if ((LA(1) == BEGIN) && (LA(2) == END)) { + match(BEGIN); + match(END); + compoundStatement_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == BEGIN) && (LA(2) == SEMI)) { + match(BEGIN); + { // ( ... )+ + int _cnt312=0; + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + } + else { + if ( _cnt312>=1 ) { goto _loop312; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt312++; + } + _loop312:; + } // ( ... )+ + match(END); + compoundStatement_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == BEGIN) && (_tokenSet_24.member(LA(2)))) { + match(BEGIN); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + { + switch ( LA(1)) { + case BEGIN: + case NUM_INT: + case CASE: + case GOTO: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + case RAISE: + case TRY: + case IDENT: + { + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + else { + goto _loop315; + } + + } + _loop315:; + } // ( ... )* + match(END); + compoundStatement_AST = RefPascalAST(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_25); + } else { + throw; + } + } + returnAST = compoundStatement_AST; +} + +void PascalParser::procedureHeader() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST procedureHeader_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp61_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp61_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp61_AST)); + } + match(PROCEDURE); + { + if ((LA(1) == IDENT) && (LA(2) == SEMI || LA(2) == LPAREN)) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((LA(1) == IDENT) && (LA(2) == COLON)) { + qualifiedMethodIdentifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + { + switch ( LA(1)) { + case LPAREN: + { + formalParameterList(); + 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); + { // ( ... )* + for (;;) { + if (((LA(1) >= PUBLIC && LA(1) <= FAR))) { + modifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + } + else { + goto _loop68; + } + + } + _loop68:; + } // ( ... )* + procedureHeader_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_26); + } else { + throw; + } + } + returnAST = procedureHeader_AST; +} + +void PascalParser::subroutineBlock() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST subroutineBlock_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case BEGIN: + case LABEL: + case CONST: + case RESOURCESTRING: + case TYPE: + case VAR: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + { + block(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subroutineBlock_AST = RefPascalAST(currentAST.root); + break; + } + case EXTERNAL: + { + externalDirective(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subroutineBlock_AST = RefPascalAST(currentAST.root); + break; + } + case FORWARD: + { + match(FORWARD); + subroutineBlock_AST = RefPascalAST(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_27); + } else { + throw; + } + } + returnAST = subroutineBlock_AST; +} + +void PascalParser::functionHeader() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST functionHeader_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + bool synPredMatched74 = false; + if (((LA(1) == FUNCTION) && (LA(2) == IDENT))) { + int _m74 = mark(); + synPredMatched74 = true; + inputState->guessing++; + try { + { + match(FUNCTION); + identifier(); + match(COLON); + type(); + match(SEMI); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched74 = false; + } + rewind(_m74); + inputState->guessing--; + } + if ( synPredMatched74 ) { + RefPascalAST tmp65_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp65_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp65_AST)); + } + match(FUNCTION); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + { // ( ... )* + for (;;) { + if (((LA(1) >= PUBLIC && LA(1) <= FAR))) { + modifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + } + else { + goto _loop76; + } + + } + _loop76:; + } // ( ... )* + functionHeader_AST = RefPascalAST(currentAST.root); + } + else { + bool synPredMatched78 = false; + if (((LA(1) == FUNCTION) && (LA(2) == IDENT))) { + int _m78 = mark(); + synPredMatched78 = true; + inputState->guessing++; + try { + { + match(FUNCTION); + identifier(); + match(COLON); + match(COLON); + identifier(); + match(COLON); + type(); + match(SEMI); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched78 = false; + } + rewind(_m78); + inputState->guessing--; + } + if ( synPredMatched78 ) { + RefPascalAST tmp69_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp69_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp69_AST)); + } + match(FUNCTION); + qualifiedMethodIdentifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + { // ( ... )* + for (;;) { + if (((LA(1) >= PUBLIC && LA(1) <= FAR))) { + modifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + } + else { + goto _loop80; + } + + } + _loop80:; + } // ( ... )* + functionHeader_AST = RefPascalAST(currentAST.root); + } + else { + bool synPredMatched82 = false; + if (((LA(1) == FUNCTION) && (LA(2) == IDENT))) { + int _m82 = mark(); + synPredMatched82 = true; + inputState->guessing++; + try { + { + match(FUNCTION); + identifier(); + match(COLON); + match(COLON); + identifier(); + match(LPAREN); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched82 = false; + } + rewind(_m82); + inputState->guessing--; + } + if ( synPredMatched82 ) { + RefPascalAST tmp73_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp73_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp73_AST)); + } + match(FUNCTION); + qualifiedMethodIdentifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formalParameterList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + { // ( ... )* + for (;;) { + if (((LA(1) >= PUBLIC && LA(1) <= FAR))) { + modifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + } + else { + goto _loop84; + } + + } + _loop84:; + } // ( ... )* + functionHeader_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == FUNCTION) && (LA(2) == IDENT)) { + RefPascalAST tmp77_AST = RefPascalAST(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(FUNCTION); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + formalParameterList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + { // ( ... )* + for (;;) { + if (((LA(1) >= PUBLIC && LA(1) <= FAR))) { + modifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + } + else { + goto _loop86; + } + + } + _loop86:; + } // ( ... )* + functionHeader_AST = RefPascalAST(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_26); + } else { + throw; + } + } + returnAST = functionHeader_AST; +} + +void PascalParser::qualifiedMethodIdentifier() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST qualifiedMethodIdentifier_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + match(COLON); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + qualifiedMethodIdentifier_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_28); + } else { + throw; + } + } + returnAST = qualifiedMethodIdentifier_AST; +} + +void PascalParser::formalParameterList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST formalParameterList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(LPAREN); + parameterDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + parameterDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop96; + } + + } + _loop96:; + } // ( ... )* + match(RPAREN); + formalParameterList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_29); + } else { + throw; + } + } + returnAST = formalParameterList_AST; +} + +void PascalParser::modifiers() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST modifiers_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case PUBLIC: + { + match(PUBLIC); + modifiers_AST = RefPascalAST(currentAST.root); + break; + } + case ALIAS: + { + { + match(ALIAS); + stringConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + modifiers_AST = RefPascalAST(currentAST.root); + break; + } + case INTERRUPT: + { + match(INTERRUPT); + modifiers_AST = RefPascalAST(currentAST.root); + break; + } + case REGISTER: + case PASCAL: + case CDECL: + case STDCALL: + case POPSTACK: + case SAVEREGISTERS: + case INLINE: + case SAFECALL: + case NEAR: + case FAR: + { + callModifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + modifiers_AST = RefPascalAST(currentAST.root); + break; + } + case EXPORT: + { + match(EXPORT); + modifiers_AST = RefPascalAST(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_22); + } else { + throw; + } + } + returnAST = modifiers_AST; +} + +void PascalParser::externalDirective() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST externalDirective_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp90_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp90_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp90_AST)); + } + match(EXTERNAL); + { + switch ( LA(1)) { + case STRING_LITERAL: + case CHR: + { + stringConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case LITERAL_name: + { + { + RefPascalAST tmp91_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp91_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp91_AST)); + } + match(LITERAL_name); + stringConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + break; + } + case LITERAL_index: + { + { + RefPascalAST tmp92_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp92_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp92_AST)); + } + match(LITERAL_index); + integerConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + break; + } + case ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE: + case SEMI: + case END: + case EXPORTS: + case BEGIN: + case INITIALIZATION: + case LABEL: + case CONST: + case RESOURCESTRING: + case TYPE: + case VAR: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE: + case SEMI: + case END: + case EXPORTS: + case BEGIN: + case INITIALIZATION: + case LABEL: + case CONST: + case RESOURCESTRING: + case TYPE: + case VAR: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + externalDirective_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_27); + } else { + throw; + } + } + returnAST = externalDirective_AST; +} + +void PascalParser::functionHeaderEnding() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST functionHeaderEnding_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case COLON: + { + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + { // ( ... )* + for (;;) { + if (((LA(1) >= PUBLIC && LA(1) <= FAR))) { + modifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + } + else { + goto _loop91; + } + + } + _loop91:; + } // ( ... )* + functionHeaderEnding_AST = RefPascalAST(currentAST.root); + break; + } + case LPAREN: + { + formalParameterList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + { // ( ... )* + for (;;) { + if (((LA(1) >= PUBLIC && LA(1) <= FAR))) { + modifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + } + else { + goto _loop93; + } + + } + _loop93:; + } // ( ... )* + functionHeaderEnding_AST = RefPascalAST(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_0); + } else { + throw; + } + } + returnAST = functionHeaderEnding_AST; +} + +void PascalParser::parameterDeclaration() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST parameterDeclaration_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case IDENT: + { + valueParameter(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + parameterDeclaration_AST = RefPascalAST(currentAST.root); + break; + } + case VAR: + { + variableParameter(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + parameterDeclaration_AST = RefPascalAST(currentAST.root); + break; + } + case CONST: + { + constantParameter(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + parameterDeclaration_AST = RefPascalAST(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_30); + } else { + throw; + } + } + returnAST = parameterDeclaration_AST; +} + +void PascalParser::valueParameter() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST valueParameter_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + bool synPredMatched100 = false; + if (((LA(1) == IDENT) && (LA(2) == COMMA || LA(2) == COLON))) { + int _m100 = mark(); + synPredMatched100 = true; + inputState->guessing++; + try { + { + identifierList(); + match(COLON); + match(ARRAY); + match(OF); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched100 = false; + } + rewind(_m100); + inputState->guessing--; + } + if ( synPredMatched100 ) { + identifierList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + match(ARRAY); + match(OF); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + valueParameter_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == IDENT) && (LA(2) == COMMA || LA(2) == COLON)) { + identifierList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + valueParameter_AST = RefPascalAST(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_30); + } else { + throw; + } + } + returnAST = valueParameter_AST; +} + +void PascalParser::variableParameter() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST variableParameter_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp103_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp103_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp103_AST)); + } + match(VAR); + identifierList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case COLON: + { + untypedParameterPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case RPAREN: + case RBRACK: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + variableParameter_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_30); + } else { + throw; + } + } + returnAST = variableParameter_AST; +} + +void PascalParser::constantParameter() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST constantParameter_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp104_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp104_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp104_AST)); + } + match(CONST); + identifierList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case COLON: + { + untypedParameterPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case RPAREN: + case RBRACK: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + constantParameter_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_30); + } else { + throw; + } + } + returnAST = constantParameter_AST; +} + +void PascalParser::untypedParameterPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST untypedParameterPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + bool synPredMatched105 = false; + if (((LA(1) == COLON) && (LA(2) == ARRAY))) { + int _m105 = mark(); + synPredMatched105 = true; + inputState->guessing++; + try { + { + match(COLON); + match(ARRAY); + match(OF); + type(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched105 = false; + } + rewind(_m105); + inputState->guessing--; + } + if ( synPredMatched105 ) { + match(COLON); + match(ARRAY); + match(OF); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + untypedParameterPart_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == COLON) && (_tokenSet_31.member(LA(2)))) { + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + untypedParameterPart_AST = RefPascalAST(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_30); + } else { + throw; + } + } + returnAST = untypedParameterPart_AST; +} + +void PascalParser::callModifiers() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST callModifiers_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case REGISTER: + { + match(REGISTER); + callModifiers_AST = RefPascalAST(currentAST.root); + break; + } + case PASCAL: + { + match(PASCAL); + callModifiers_AST = RefPascalAST(currentAST.root); + break; + } + case CDECL: + { + match(CDECL); + callModifiers_AST = RefPascalAST(currentAST.root); + break; + } + case STDCALL: + { + match(STDCALL); + callModifiers_AST = RefPascalAST(currentAST.root); + break; + } + case POPSTACK: + { + match(POPSTACK); + callModifiers_AST = RefPascalAST(currentAST.root); + break; + } + case SAVEREGISTERS: + { + match(SAVEREGISTERS); + callModifiers_AST = RefPascalAST(currentAST.root); + break; + } + case INLINE: + { + match(INLINE); + callModifiers_AST = RefPascalAST(currentAST.root); + break; + } + case SAFECALL: + { + match(SAFECALL); + callModifiers_AST = RefPascalAST(currentAST.root); + break; + } + case NEAR: + { + match(NEAR); + callModifiers_AST = RefPascalAST(currentAST.root); + break; + } + case FAR: + { + match(FAR); + callModifiers_AST = RefPascalAST(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_23); + } else { + throw; + } + } + returnAST = callModifiers_AST; +} + +void PascalParser::expression() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST expression_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + simpleExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case EQUAL: + case LE: + case GE: + case LTH: + case GT: + case NOT_EQUAL: + case IN: + case IS: + { + expressionSign(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + simpleExpression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case DOT: + case SEMI: + case END: + case COMMA: + case RPAREN: + case FINALIZATION: + case OF: + case DOTDOT: + case RBRACK: + case THEN: + case ELSE: + case DO: + case UNTIL: + case TO: + case DOWNTO: + case RBRACK2: + case EXCEPT: + case FINALLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + expression_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_32); + } else { + throw; + } + } + returnAST = expression_AST; +} + +void PascalParser::typedConstant() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST typedConstant_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + bool synPredMatched120 = false; + if (((_tokenSet_33.member(LA(1))) && (_tokenSet_34.member(LA(2))))) { + int _m120 = mark(); + synPredMatched120 = true; + inputState->guessing++; + try { + { + constant(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched120 = false; + } + rewind(_m120); + inputState->guessing--; + } + if ( synPredMatched120 ) { + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + typedConstant_AST = RefPascalAST(currentAST.root); + } + else { + bool synPredMatched122 = false; + if (((LA(1) == LPAREN) && (LA(2) == IDENT))) { + int _m122 = mark(); + synPredMatched122 = true; + inputState->guessing++; + try { + { + match(LPAREN); + identifier(); + match(COLON); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched122 = false; + } + rewind(_m122); + inputState->guessing--; + } + if ( synPredMatched122 ) { + recordConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + typedConstant_AST = RefPascalAST(currentAST.root); + } + else { + bool synPredMatched124 = false; + if (((LA(1) == LPAREN) && (_tokenSet_35.member(LA(2))))) { + int _m124 = mark(); + synPredMatched124 = true; + inputState->guessing++; + try { + { + arrayConstant(); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched124 = false; + } + rewind(_m124); + inputState->guessing--; + } + if ( synPredMatched124 ) { + arrayConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + typedConstant_AST = RefPascalAST(currentAST.root); + } + else if ((_tokenSet_36.member(LA(1))) && (_tokenSet_37.member(LA(2)))) { + proceduralConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + typedConstant_AST = RefPascalAST(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_22); + } else { + throw; + } + } + returnAST = typedConstant_AST; +} + +void PascalParser::constant() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST constant_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefPascalAST s_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefPascalAST n_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefPascalAST s2_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + RefPascalAST id_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case NUM_INT: + case NUM_REAL: + { + unsignedNumber(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + constant_AST = RefPascalAST(currentAST.root); + break; + } + case IDENT: + { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + constant_AST = RefPascalAST(currentAST.root); + break; + } + case STRING_LITERAL: + { + string(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + constant_AST = RefPascalAST(currentAST.root); + break; + } + case CHR: + { + constantChr(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + constant_AST = RefPascalAST(currentAST.root); + break; + } + default: + if ((LA(1) == PLUS || LA(1) == MINUS) && (LA(2) == NUM_INT || LA(2) == NUM_REAL)) { + sign(); + if (inputState->guessing==0) { + s_AST = returnAST; + } + unsignedNumber(); + if (inputState->guessing==0) { + n_AST = returnAST; + } + if ( inputState->guessing==0 ) { + constant_AST = RefPascalAST(currentAST.root); +#line 901 "pascal.g" + constant_AST=RefPascalAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(s_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(n_AST)))); +#line 3461 "PascalParser.cpp" + currentAST.root = constant_AST; + if ( constant_AST!=RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + constant_AST->getFirstChild() != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = constant_AST->getFirstChild(); + else + currentAST.child = constant_AST; + currentAST.advanceChildToEnd(); + } + } + else if ((LA(1) == PLUS || LA(1) == MINUS) && (LA(2) == IDENT)) { + sign(); + if (inputState->guessing==0) { + s2_AST = returnAST; + } + identifier(); + if (inputState->guessing==0) { + id_AST = returnAST; + } + if ( inputState->guessing==0 ) { + constant_AST = RefPascalAST(currentAST.root); +#line 903 "pascal.g" + constant_AST=RefPascalAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(s2_AST))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(id_AST)))); +#line 3484 "PascalParser.cpp" + currentAST.root = constant_AST; + if ( constant_AST!=RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + constant_AST->getFirstChild() != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = constant_AST->getFirstChild(); + else + currentAST.child = constant_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_38); + } else { + throw; + } + } + returnAST = constant_AST; +} + +void PascalParser::recordConstant() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST recordConstant_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(LPAREN); + { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + } + else { + goto _loop134; + } + + } + _loop134:; + } // ( ... )* + match(RPAREN); + recordConstant_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_22); + } else { + throw; + } + } + returnAST = recordConstant_AST; +} + +void PascalParser::arrayConstant() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST arrayConstant_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(LPAREN); + { + switch ( LA(1)) { + case NUM_INT: + case PLUS: + case MINUS: + case STRING_LITERAL: + case CHR: + case NUM_REAL: + case IDENT: + { + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case LPAREN: + { + arrayConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + { + switch ( LA(1)) { + case NUM_INT: + case PLUS: + case MINUS: + case STRING_LITERAL: + case CHR: + case NUM_REAL: + case IDENT: + { + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case LPAREN: + { + arrayConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + else { + goto _loop129; + } + + } + _loop129:; + } // ( ... )* + match(RPAREN); + arrayConstant_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_39); + } else { + throw; + } + } + returnAST = arrayConstant_AST; +} + +void PascalParser::proceduralConstant() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST proceduralConstant_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + proceduralConstant_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_22); + } else { + throw; + } + } + returnAST = proceduralConstant_AST; +} + +void PascalParser::addressConstant() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST addressConstant_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp127_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp127_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp127_AST)); + } + match(NUM_INT); + addressConstant_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = addressConstant_AST; +} + +void PascalParser::simpleType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST simpleType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case INTEGER: + case SHORTINT: + case SMALLINT: + case LONGINT: + case INT64: + case BYTE: + case WORD: + case CARDINAL: + case QWORD: + case BOOLEAN: + case BYTEBOOL: + case LONGBOOL: + case CHAR: + { + ordinalType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + simpleType_AST = RefPascalAST(currentAST.root); + break; + } + case REAL: + case SINGLE: + case DOUBLE: + case EXTENDED: + case COMP: + { + realType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + simpleType_AST = RefPascalAST(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_23); + } else { + throw; + } + } + returnAST = simpleType_AST; +} + +void PascalParser::subrangeTypeOrTypeIdentifier() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST subrangeTypeOrTypeIdentifier_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case DOTDOT: + { + match(DOTDOT); + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case RPAREN: + case EQUAL: + case RBRACK: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + subrangeTypeOrTypeIdentifier_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = subrangeTypeOrTypeIdentifier_AST; +} + +void PascalParser::enumeratedType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST enumeratedType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + bool synPredMatched147 = false; + if (((LA(1) == LPAREN) && (LA(2) == IDENT))) { + int _m147 = mark(); + synPredMatched147 = true; + inputState->guessing++; + try { + { + match(LPAREN); + identifier(); + match(ASSIGN); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched147 = false; + } + rewind(_m147); + inputState->guessing--; + } + if ( synPredMatched147 ) { + match(LPAREN); + assignedEnumList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + enumeratedType_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == LPAREN) && (LA(2) == IDENT)) { + match(LPAREN); + identifierList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + enumeratedType_AST = RefPascalAST(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_40); + } else { + throw; + } + } + returnAST = enumeratedType_AST; +} + +void PascalParser::stringType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST stringType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp133_AST = RefPascalAST(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(STRING); + { + switch ( LA(1)) { + case LBRACK: + { + match(LBRACK); + unsignedInteger(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RBRACK); + break; + } + case SEMI: + case RPAREN: + case EQUAL: + case RBRACK: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + stringType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = stringType_AST; +} + +void PascalParser::structuredType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST structuredType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case PACKED: + { + match(PACKED); + break; + } + case ARRAY: + case RECORD: + case SET: + case FILE: + case OBJECT: + case CLASS: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case ARRAY: + { + arrayType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case RECORD: + { + recordType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case OBJECT: + { + objectType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case CLASS: + { + classType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SET: + { + setType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case FILE: + { + fileType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + structuredType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = structuredType_AST; +} + +void PascalParser::pointerType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST pointerType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp137_AST = RefPascalAST(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(POINTER); + typeIdentifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + pointerType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = pointerType_AST; +} + +void PascalParser::proceduralType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST proceduralType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + bool synPredMatched185 = false; + if (((LA(1) == PROCEDURE || LA(1) == FUNCTION) && (LA(2) == IDENT))) { + int _m185 = mark(); + synPredMatched185 = true; + inputState->guessing++; + try { + { + proceduralTypePart1(); + match(SEMI); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched185 = false; + } + rewind(_m185); + inputState->guessing--; + } + if ( synPredMatched185 ) { + proceduralTypePart1(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + callModifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + proceduralType_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == PROCEDURE || LA(1) == FUNCTION) && (LA(2) == IDENT)) { + proceduralTypePart1(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + proceduralType_AST = RefPascalAST(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_23); + } else { + throw; + } + } + returnAST = proceduralType_AST; +} + +void PascalParser::ordinalType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST ordinalType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case INTEGER: + { + match(INTEGER); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case SHORTINT: + { + match(SHORTINT); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case SMALLINT: + { + match(SMALLINT); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case LONGINT: + { + match(LONGINT); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case INT64: + { + match(INT64); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case BYTE: + { + match(BYTE); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case WORD: + { + match(WORD); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case CARDINAL: + { + match(CARDINAL); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case QWORD: + { + match(QWORD); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case BOOLEAN: + { + match(BOOLEAN); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case BYTEBOOL: + { + match(BYTEBOOL); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case LONGBOOL: + { + match(LONGBOOL); + ordinalType_AST = RefPascalAST(currentAST.root); + break; + } + case CHAR: + { + match(CHAR); + ordinalType_AST = RefPascalAST(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_40); + } else { + throw; + } + } + returnAST = ordinalType_AST; +} + +void PascalParser::realType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST realType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case REAL: + { + match(REAL); + realType_AST = RefPascalAST(currentAST.root); + break; + } + case SINGLE: + { + match(SINGLE); + realType_AST = RefPascalAST(currentAST.root); + break; + } + case DOUBLE: + { + match(DOUBLE); + realType_AST = RefPascalAST(currentAST.root); + break; + } + case EXTENDED: + { + match(EXTENDED); + realType_AST = RefPascalAST(currentAST.root); + break; + } + case COMP: + { + match(COMP); + realType_AST = RefPascalAST(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_23); + } else { + throw; + } + } + returnAST = realType_AST; +} + +void PascalParser::typeIdentifier() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST typeIdentifier_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + typeIdentifier_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_41); + } else { + throw; + } + } + returnAST = typeIdentifier_AST; +} + +void PascalParser::subrangeType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST subrangeType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(DOTDOT); + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + subrangeType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_0); + } else { + throw; + } + } + returnAST = subrangeType_AST; +} + +void PascalParser::assignedEnumList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST assignedEnumList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(ASSIGN); + expression(); + 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)); + } + match(ASSIGN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + } + else { + goto _loop152; + } + + } + _loop152:; + } // ( ... )* + assignedEnumList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_42); + } else { + throw; + } + } + returnAST = assignedEnumList_AST; +} + +void PascalParser::unsignedInteger() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST unsignedInteger_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp161_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp161_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp161_AST)); + } + match(NUM_INT); + unsignedInteger_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_43); + } else { + throw; + } + } + returnAST = unsignedInteger_AST; +} + +void PascalParser::arrayType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST arrayType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp162_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp162_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp162_AST)); + } + match(ARRAY); + match(LBRACK); + arrayIndexType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + arrayIndexType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop161; + } + + } + _loop161:; + } // ( ... )* + match(RBRACK); + match(OF); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + arrayType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = arrayType_AST; +} + +void PascalParser::recordType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST recordType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp167_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp167_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp167_AST)); + } + match(RECORD); + { // ( ... )* + for (;;) { + if ((LA(1) == CASE || LA(1) == IDENT)) { + fieldList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop168; + } + + } + _loop168:; + } // ( ... )* + match(END); + recordType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = recordType_AST; +} + +void PascalParser::objectType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST objectType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp169_AST = RefPascalAST(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(OBJECT); + { + switch ( LA(1)) { + case LPAREN: + { + heritage(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case PUBLIC: + case PRIVATE: + case PROTECTED: + case CONSTRUCTOR: + case DESTRUCTOR: + case IDENT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case IDENT: + { + componentList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PUBLIC: + case PRIVATE: + case PROTECTED: + { + objectVisibilitySpecifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(END); + objectType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = objectType_AST; +} + +void PascalParser::classType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST classType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp171_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp171_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp171_AST)); + } + match(CLASS); + { + switch ( LA(1)) { + case LPAREN: + { + heritage(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case PUBLIC: + case PRIVATE: + case PROTECTED: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PUBLISHED: + case PROPERTY: + case IDENT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + case IDENT: + { + classComponentList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PUBLIC: + case PRIVATE: + case PROTECTED: + case PUBLISHED: + { + classVisibilitySpecifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(END); + classType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = classType_AST; +} + +void PascalParser::setType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST setType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp173_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp173_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp173_AST)); + } + match(SET); + match(OF); + ordinalType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + setType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = setType_AST; +} + +void PascalParser::fileType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST fileType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp175_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp175_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp175_AST)); + } + match(FILE); + match(OF); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + fileType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = fileType_AST; +} + +void PascalParser::arrayIndexType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST arrayIndexType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + if (((LA(1) >= INTEGER && LA(1) <= CHAR))) { + ordinalType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + arrayIndexType_AST = RefPascalAST(currentAST.root); + } + else { + bool synPredMatched164 = false; + if (((_tokenSet_36.member(LA(1))) && (_tokenSet_44.member(LA(2))))) { + int _m164 = mark(); + synPredMatched164 = true; + inputState->guessing++; + try { + { + expression(); + match(DOTDOT); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched164 = false; + } + rewind(_m164); + inputState->guessing--; + } + if ( synPredMatched164 ) { + arraySubrangeType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + arrayIndexType_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == LPAREN) && (LA(2) == IDENT)) { + enumeratedType(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + arrayIndexType_AST = RefPascalAST(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_45); + } else { + throw; + } + } + returnAST = arrayIndexType_AST; +} + +void PascalParser::arraySubrangeType() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST arraySubrangeType_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(DOTDOT); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + arraySubrangeType_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_45); + } else { + throw; + } + } + returnAST = arraySubrangeType_AST; +} + +void PascalParser::fieldList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST fieldList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case IDENT: + { + fixedField(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + fieldList_AST = RefPascalAST(currentAST.root); + break; + } + case CASE: + { + variantPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + fieldList_AST = RefPascalAST(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_46); + } else { + throw; + } + } + returnAST = fieldList_AST; +} + +void PascalParser::fixedField() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST fixedField_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifierList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + fixedField_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_46); + } else { + throw; + } + } + returnAST = fixedField_AST; +} + +void PascalParser::variantPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST variantPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp180_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp180_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp180_AST)); + } + match(CASE); + { + if ((LA(1) == IDENT) && (LA(2) == COLON)) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + } + else if ((LA(1) == IDENT) && (LA(2) == OF)) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(OF); + variant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + variant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop174; + } + + } + _loop174:; + } // ( ... )* + variantPart_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_46); + } else { + throw; + } + } + returnAST = variantPart_AST; +} + +void PascalParser::variant() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST variant_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { // ( ... )+ + int _cnt177=0; + for (;;) { + if ((_tokenSet_33.member(LA(1)))) { + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COMMA); + } + else { + if ( _cnt177>=1 ) { goto _loop177; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt177++; + } + _loop177:; + } // ( ... )+ + match(COLON); + match(LPAREN); + { // ( ... )* + for (;;) { + if ((LA(1) == CASE || LA(1) == IDENT)) { + fieldList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop179; + } + + } + _loop179:; + } // ( ... )* + match(RPAREN); + variant_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_47); + } else { + throw; + } + } + returnAST = variant_AST; +} + +void PascalParser::proceduralTypePart1() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST proceduralTypePart1_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case FUNCTION: + { + functionHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PROCEDURE: + { + procedureHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case OF: + { + match(OF); + match(OBJECT); + break; + } + case SEMI: + case RPAREN: + case EQUAL: + case RBRACK: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + proceduralTypePart1_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_23); + } else { + throw; + } + } + returnAST = proceduralTypePart1_AST; +} + +void PascalParser::heritage() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST heritage_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(LPAREN); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + heritage_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_48); + } else { + throw; + } + } + returnAST = heritage_AST; +} + +void PascalParser::componentList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST componentList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case IDENT: + { + { // ( ... )+ + int _cnt196=0; + for (;;) { + if ((LA(1) == IDENT)) { + fieldDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + if ( _cnt196>=1 ) { goto _loop196; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt196++; + } + _loop196:; + } // ( ... )+ + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + { + { // ( ... )+ + int _cnt199=0; + for (;;) { + if ((_tokenSet_49.member(LA(1)))) { + methodDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + if ( _cnt199>=1 ) { goto _loop199; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt199++; + } + _loop199:; + } // ( ... )+ + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + componentList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_6); + } else { + throw; + } + } + returnAST = componentList_AST; +} + +void PascalParser::objectVisibilitySpecifier() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST objectVisibilitySpecifier_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case PRIVATE: + { + match(PRIVATE); + objectVisibilitySpecifier_AST = RefPascalAST(currentAST.root); + break; + } + case PROTECTED: + { + match(PROTECTED); + objectVisibilitySpecifier_AST = RefPascalAST(currentAST.root); + break; + } + case PUBLIC: + { + match(PUBLIC); + objectVisibilitySpecifier_AST = RefPascalAST(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_6); + } else { + throw; + } + } + returnAST = objectVisibilitySpecifier_AST; +} + +void PascalParser::fieldDefinition() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST fieldDefinition_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifierList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + fieldDefinition_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_50); + } else { + throw; + } + } + returnAST = fieldDefinition_AST; +} + +void PascalParser::methodDefinition() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST methodDefinition_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case FUNCTION: + { + functionHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PROCEDURE: + { + procedureHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case CONSTRUCTOR: + { + constructorHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case DESTRUCTOR: + { + destructorHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + methodDirectives(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + methodDefinition_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_51); + } else { + throw; + } + } + returnAST = methodDefinition_AST; +} + +void PascalParser::constructorHeader() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST constructorHeader_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp198_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp198_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp198_AST)); + } + match(CONSTRUCTOR); + { + if ((LA(1) == IDENT) && (LA(2) == LPAREN)) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((LA(1) == IDENT) && (LA(2) == COLON)) { + qualifiedMethodIdentifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + formalParameterList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + constructorHeader_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_22); + } else { + throw; + } + } + returnAST = constructorHeader_AST; +} + +void PascalParser::destructorHeader() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST destructorHeader_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp199_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp199_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp199_AST)); + } + match(DESTRUCTOR); + { + if ((LA(1) == IDENT) && (LA(2) == LPAREN)) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((LA(1) == IDENT) && (LA(2) == COLON)) { + qualifiedMethodIdentifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + formalParameterList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + destructorHeader_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_22); + } else { + throw; + } + } + returnAST = destructorHeader_AST; +} + +void PascalParser::methodDirectives() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST methodDirectives_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case VIRTUAL: + { + match(VIRTUAL); + match(SEMI); + { + switch ( LA(1)) { + case ABSTRACT: + { + match(ABSTRACT); + match(SEMI); + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case REGISTER: + case PASCAL: + case CDECL: + case STDCALL: + case POPSTACK: + case SAVEREGISTERS: + case INLINE: + case SAFECALL: + case NEAR: + case FAR: + case CONSTRUCTOR: + case DESTRUCTOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case REGISTER: + case PASCAL: + case CDECL: + case STDCALL: + case POPSTACK: + case SAVEREGISTERS: + case INLINE: + case SAFECALL: + case NEAR: + case FAR: + case CONSTRUCTOR: + case DESTRUCTOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case REGISTER: + case PASCAL: + case CDECL: + case STDCALL: + case POPSTACK: + case SAVEREGISTERS: + case INLINE: + case SAFECALL: + case NEAR: + case FAR: + { + callModifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + methodDirectives_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_51); + } else { + throw; + } + } + returnAST = methodDirectives_AST; +} + +void PascalParser::classComponentList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST classComponentList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case IDENT: + { + { // ( ... )+ + int _cnt220=0; + for (;;) { + if ((LA(1) == IDENT)) { + fieldDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + if ( _cnt220>=1 ) { goto _loop220; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt220++; + } + _loop220:; + } // ( ... )+ + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + { + { // ( ... )+ + int _cnt224=0; + for (;;) { + if ((_tokenSet_52.member(LA(1)))) { + { + switch ( LA(1)) { + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + { + classMethodDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PROPERTY: + { + propertyDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + else { + if ( _cnt224>=1 ) { goto _loop224; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + + _cnt224++; + } + _loop224:; + } // ( ... )+ + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + classComponentList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_6); + } else { + throw; + } + } + returnAST = classComponentList_AST; +} + +void PascalParser::classVisibilitySpecifier() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST classVisibilitySpecifier_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case PRIVATE: + { + match(PRIVATE); + classVisibilitySpecifier_AST = RefPascalAST(currentAST.root); + break; + } + case PROTECTED: + { + match(PROTECTED); + classVisibilitySpecifier_AST = RefPascalAST(currentAST.root); + break; + } + case PUBLIC: + { + match(PUBLIC); + classVisibilitySpecifier_AST = RefPascalAST(currentAST.root); + break; + } + case PUBLISHED: + { + match(PUBLISHED); + classVisibilitySpecifier_AST = RefPascalAST(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_6); + } else { + throw; + } + } + returnAST = classVisibilitySpecifier_AST; +} + +void PascalParser::classMethodDefinition() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST classMethodDefinition_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case PROCEDURE: + case FUNCTION: + case CLASS: + { + { + { + switch ( LA(1)) { + case CLASS: + { + match(CLASS); + break; + } + case PROCEDURE: + case FUNCTION: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case FUNCTION: + { + functionHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PROCEDURE: + { + procedureHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + break; + } + case CONSTRUCTOR: + { + constructorHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case DESTRUCTOR: + { + destructorHeader(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(SEMI); + classMethodDirectives(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + classMethodDefinition_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_53); + } else { + throw; + } + } + returnAST = classMethodDefinition_AST; +} + +void PascalParser::propertyDefinition() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST propertyDefinition_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp211_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp211_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp211_AST)); + } + match(PROPERTY); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case COLON: + case LBRACK: + { + propertyInterface(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + case LITERAL_read: + case LITERAL_write: + case DEFAULT: + case LITERAL_nodefault: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + propertySpecifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + propertyDefinition_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_53); + } else { + throw; + } + } + returnAST = propertyDefinition_AST; +} + +void PascalParser::classMethodDirectives() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST classMethodDirectives_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case VIRTUAL: + case OVERRIDE: + case MESSAGE: + { + directiveVariants(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case REGISTER: + case PASCAL: + case CDECL: + case STDCALL: + case POPSTACK: + case SAVEREGISTERS: + case INLINE: + case SAFECALL: + case NEAR: + case FAR: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case REGISTER: + case PASCAL: + case CDECL: + case STDCALL: + case POPSTACK: + case SAVEREGISTERS: + case INLINE: + case SAFECALL: + case NEAR: + case FAR: + { + callModifiers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + classMethodDirectives_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_53); + } else { + throw; + } + } + returnAST = classMethodDirectives_AST; +} + +void PascalParser::directiveVariants() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST directiveVariants_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case VIRTUAL: + { + { + match(VIRTUAL); + { + switch ( LA(1)) { + case ABSTRACT: + { + match(ABSTRACT); + match(SEMI); + break; + } + case SEMI: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + directiveVariants_AST = RefPascalAST(currentAST.root); + break; + } + case OVERRIDE: + { + match(OVERRIDE); + directiveVariants_AST = RefPascalAST(currentAST.root); + break; + } + case MESSAGE: + { + { + match(MESSAGE); + { + switch ( LA(1)) { + case NUM_INT: + case PLUS: + case MINUS: + { + integerConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case STRING_LITERAL: + case CHR: + { + stringConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + directiveVariants_AST = RefPascalAST(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_22); + } else { + throw; + } + } + returnAST = directiveVariants_AST; +} + +void PascalParser::propertyInterface() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST propertyInterface_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case LBRACK: + { + propertyParameterList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case COLON: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(COLON); + typeIdentifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case LITERAL_index: + { + RefPascalAST tmp220_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp220_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp220_AST)); + } + match(LITERAL_index); + integerConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + case LITERAL_read: + case LITERAL_write: + case DEFAULT: + case LITERAL_nodefault: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + propertyInterface_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_54); + } else { + throw; + } + } + returnAST = propertyInterface_AST; +} + +void PascalParser::propertySpecifiers() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST propertySpecifiers_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case LITERAL_read: + { + readSpecifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + case LITERAL_write: + case DEFAULT: + case LITERAL_nodefault: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case LITERAL_write: + { + writeSpecifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + case DEFAULT: + case LITERAL_nodefault: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case DEFAULT: + case LITERAL_nodefault: + { + defaultSpecifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + propertySpecifiers_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_53); + } else { + throw; + } + } + returnAST = propertySpecifiers_AST; +} + +void PascalParser::propertyParameterList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST propertyParameterList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(LBRACK); + parameterDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + parameterDeclaration(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop246; + } + + } + _loop246:; + } // ( ... )* + match(RBRACK); + propertyParameterList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_55); + } else { + throw; + } + } + returnAST = propertyParameterList_AST; +} + +void PascalParser::readSpecifier() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST readSpecifier_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp224_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp224_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp224_AST)); + } + match(LITERAL_read); + fieldOrMethod(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + readSpecifier_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_56); + } else { + throw; + } + } + returnAST = readSpecifier_AST; +} + +void PascalParser::writeSpecifier() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST writeSpecifier_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp225_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp225_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp225_AST)); + } + match(LITERAL_write); + fieldOrMethod(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + writeSpecifier_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_57); + } else { + throw; + } + } + returnAST = writeSpecifier_AST; +} + +void PascalParser::defaultSpecifier() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST defaultSpecifier_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case DEFAULT: + { + { + RefPascalAST tmp226_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp226_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp226_AST)); + } + match(DEFAULT); + { + switch ( LA(1)) { + case NUM_INT: + case PLUS: + case MINUS: + case STRING_LITERAL: + case CHR: + case NUM_REAL: + case IDENT: + { + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + case PROCEDURE: + case FUNCTION: + case CONSTRUCTOR: + case DESTRUCTOR: + case CLASS: + case PROPERTY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + defaultSpecifier_AST = RefPascalAST(currentAST.root); + break; + } + case LITERAL_nodefault: + { + RefPascalAST tmp227_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp227_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp227_AST)); + } + match(LITERAL_nodefault); + defaultSpecifier_AST = RefPascalAST(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_53); + } else { + throw; + } + } + returnAST = defaultSpecifier_AST; +} + +void PascalParser::fieldOrMethod() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST fieldOrMethod_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + fieldOrMethod_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_56); + } else { + throw; + } + } + returnAST = fieldOrMethod_AST; +} + +void PascalParser::simpleExpression() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST simpleExpression_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + term(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if (((LA(1) >= PLUS && LA(1) <= XOR))) { + { + switch ( LA(1)) { + case PLUS: + { + match(PLUS); + break; + } + case MINUS: + { + match(MINUS); + break; + } + case OR: + { + match(OR); + break; + } + case XOR: + { + match(XOR); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + term(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop263; + } + + } + _loop263:; + } // ( ... )* + simpleExpression_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_58); + } else { + throw; + } + } + returnAST = simpleExpression_AST; +} + +void PascalParser::expressionSign() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST expressionSign_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case LE: + { + match(LE); + expressionSign_AST = RefPascalAST(currentAST.root); + break; + } + case GE: + { + match(GE); + expressionSign_AST = RefPascalAST(currentAST.root); + break; + } + case LTH: + { + match(LTH); + expressionSign_AST = RefPascalAST(currentAST.root); + break; + } + case GT: + { + match(GT); + expressionSign_AST = RefPascalAST(currentAST.root); + break; + } + case NOT_EQUAL: + { + match(NOT_EQUAL); + expressionSign_AST = RefPascalAST(currentAST.root); + break; + } + case IN: + { + match(IN); + expressionSign_AST = RefPascalAST(currentAST.root); + break; + } + case IS: + { + match(IS); + expressionSign_AST = RefPascalAST(currentAST.root); + break; + } + case EQUAL: + { + match(EQUAL); + expressionSign_AST = RefPascalAST(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_36); + } else { + throw; + } + } + returnAST = expressionSign_AST; +} + +void PascalParser::term() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST term_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + factor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if (((LA(1) >= STAR && LA(1) <= SHR))) { + { + switch ( LA(1)) { + case STAR: + { + match(STAR); + break; + } + case SLASH: + { + match(SLASH); + break; + } + case DIV: + { + match(DIV); + break; + } + case MOD: + { + match(MOD); + break; + } + case AND: + { + match(AND); + break; + } + case SHL: + { + match(SHL); + break; + } + case SHR: + { + match(SHR); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + factor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop267; + } + + } + _loop267:; + } // ( ... )* + term_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_59); + } else { + throw; + } + } + returnAST = term_AST; +} + +void PascalParser::factor() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST factor_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case LPAREN: + { + { + match(LPAREN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + } + factor_AST = RefPascalAST(currentAST.root); + break; + } + case NUM_INT: + case STRING_LITERAL: + case CHR: + case NIL: + case NUM_REAL: + { + unsignedConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + factor_AST = RefPascalAST(currentAST.root); + break; + } + case NOT: + { + { + match(NOT); + factor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + factor_AST = RefPascalAST(currentAST.root); + break; + } + case PLUS: + case MINUS: + { + { + { + switch ( LA(1)) { + case PLUS: + { + match(PLUS); + break; + } + case MINUS: + { + match(MINUS); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + factor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + factor_AST = RefPascalAST(currentAST.root); + break; + } + case LBRACK: + { + setConstructor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + factor_AST = RefPascalAST(currentAST.root); + break; + } + case AT: + { + addressFactor(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + factor_AST = RefPascalAST(currentAST.root); + break; + } + case TRUE: + { + RefPascalAST tmp252_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp252_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp252_AST)); + } + match(TRUE); + factor_AST = RefPascalAST(currentAST.root); + break; + } + case FALSE: + { + RefPascalAST tmp253_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp253_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp253_AST)); + } + match(FALSE); + factor_AST = RefPascalAST(currentAST.root); + break; + } + default: + if ((LA(1) == IDENT) && (_tokenSet_60.member(LA(2)))) { + identifierOrValueTypecastOrFunctionCall(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + factor_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == IDENT) && (LA(2) == LBRACK)) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(LBRACK); + 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 _loop274; + } + + } + _loop274:; + } // ( ... )* + match(RBRACK); + factor_AST = RefPascalAST(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_61); + } else { + throw; + } + } + returnAST = factor_AST; +} + +void PascalParser::identifierOrValueTypecastOrFunctionCall() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST identifierOrValueTypecastOrFunctionCall_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + bool synPredMatched277 = false; + if (((LA(1) == IDENT) && (LA(2) == LPAREN))) { + int _m277 = mark(); + synPredMatched277 = true; + inputState->guessing++; + try { + { + identifier(); + match(LPAREN); + expression(); + match(COMMA); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched277 = false; + } + rewind(_m277); + inputState->guessing--; + } + if ( synPredMatched277 ) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(LPAREN); + expressions(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + identifierOrValueTypecastOrFunctionCall_AST = RefPascalAST(currentAST.root); + } + else { + bool synPredMatched279 = false; + if (((LA(1) == IDENT) && (LA(2) == LPAREN))) { + int _m279 = mark(); + synPredMatched279 = true; + inputState->guessing++; + try { + { + identifier(); + match(LPAREN); + expression(); + match(RPAREN); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched279 = false; + } + rewind(_m279); + inputState->guessing--; + } + if ( synPredMatched279 ) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(LPAREN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + identifierOrValueTypecastOrFunctionCall_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == IDENT) && (_tokenSet_61.member(LA(2)))) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + identifierOrValueTypecastOrFunctionCall_AST = RefPascalAST(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_61); + } else { + throw; + } + } + returnAST = identifierOrValueTypecastOrFunctionCall_AST; +} + +void PascalParser::unsignedConstant() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST unsignedConstant_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case NUM_INT: + case NUM_REAL: + { + unsignedNumber(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unsignedConstant_AST = RefPascalAST(currentAST.root); + break; + } + case CHR: + { + constantChr(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unsignedConstant_AST = RefPascalAST(currentAST.root); + break; + } + case STRING_LITERAL: + { + string(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unsignedConstant_AST = RefPascalAST(currentAST.root); + break; + } + case NIL: + { + match(NIL); + unsignedConstant_AST = RefPascalAST(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 = unsignedConstant_AST; +} + +void PascalParser::setConstructor() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST setConstructor_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(LBRACK); + { + switch ( LA(1)) { + case LPAREN: + case NUM_INT: + case LBRACK: + case PLUS: + case MINUS: + case NOT: + case TRUE: + case FALSE: + case AT: + case STRING_LITERAL: + case CHR: + case NIL: + case NUM_REAL: + case IDENT: + { + setGroup(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + setGroup(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop290; + } + + } + _loop290:; + } // ( ... )* + break; + } + case RBRACK: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(RBRACK); + setConstructor_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_61); + } else { + throw; + } + } + returnAST = setConstructor_AST; +} + +void PascalParser::addressFactor() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST addressFactor_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(AT); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + addressFactor_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_61); + } else { + throw; + } + } + returnAST = addressFactor_AST; +} + +void PascalParser::expressions() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST expressions_AST = RefPascalAST(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 _loop286; + } + + } + _loop286:; + } // ( ... )* + expressions_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_42); + } else { + throw; + } + } + returnAST = expressions_AST; +} + +void PascalParser::functionCall() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST functionCall_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case LPAREN: + { + actualParameterList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case END: + case FINALIZATION: + case AT: + case ELSE: + case UNTIL: + case EXCEPT: + case FINALLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + functionCall_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_62); + } else { + throw; + } + } + returnAST = functionCall_AST; +} + +void PascalParser::actualParameterList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST actualParameterList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(LPAREN); + { + switch ( LA(1)) { + case LPAREN: + case NUM_INT: + case LBRACK: + case PLUS: + case MINUS: + case NOT: + case TRUE: + case FALSE: + case AT: + case STRING_LITERAL: + case CHR: + case NIL: + case NUM_REAL: + case IDENT: + { + expressions(); + 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()); + } + } + } + match(RPAREN); + actualParameterList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_62); + } else { + throw; + } + } + returnAST = actualParameterList_AST; +} + +void PascalParser::setGroup() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST setGroup_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case DOT: + { + match(DOT); + match(DOT); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case COMMA: + case RBRACK: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + setGroup_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_45); + } else { + throw; + } + } + returnAST = setGroup_AST; +} + +void PascalParser::valueTypecast() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST valueTypecast_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + typeIdentifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(LPAREN); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + valueTypecast_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_0); + } else { + throw; + } + } + returnAST = valueTypecast_AST; +} + +void PascalParser::simpleStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST simpleStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case GOTO: + { + gotoStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + simpleStatement_AST = RefPascalAST(currentAST.root); + break; + } + case RAISE: + { + raiseStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + simpleStatement_AST = RefPascalAST(currentAST.root); + break; + } + default: + if ((LA(1) == IDENT) && (_tokenSet_63.member(LA(2)))) { + assignmentStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + simpleStatement_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == IDENT) && (_tokenSet_64.member(LA(2)))) { + procedureStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + simpleStatement_AST = RefPascalAST(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_16); + } else { + throw; + } + } + returnAST = simpleStatement_AST; +} + +void PascalParser::structuredStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST structuredStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case BEGIN: + { + compoundStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + structuredStatement_AST = RefPascalAST(currentAST.root); + break; + } + case WHILE: + case REPEAT: + case FOR: + { + repetitiveStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + structuredStatement_AST = RefPascalAST(currentAST.root); + break; + } + case CASE: + case IF: + { + conditionalStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + structuredStatement_AST = RefPascalAST(currentAST.root); + break; + } + case TRY: + { + exceptionStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + structuredStatement_AST = RefPascalAST(currentAST.root); + break; + } + case WITH: + { + withStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + structuredStatement_AST = RefPascalAST(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_16); + } else { + throw; + } + } + returnAST = structuredStatement_AST; +} + +void PascalParser::assignmentStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST assignmentStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifierOrArrayIdentifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + assignmentOperator(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + assignmentStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = assignmentStatement_AST; +} + +void PascalParser::procedureStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST procedureStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case LPAREN: + { + actualParameterList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case END: + case FINALIZATION: + case ELSE: + case UNTIL: + case EXCEPT: + case FINALLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + procedureStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = procedureStatement_AST; +} + +void PascalParser::gotoStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST gotoStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(GOTO); + label(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + gotoStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = gotoStatement_AST; +} + +void PascalParser::raiseStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST raiseStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp274_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp274_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp274_AST)); + } + match(RAISE); + { + switch ( LA(1)) { + case IDENT: + { + functionCall(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case AT: + { + match(AT); + addressConstant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case END: + case FINALIZATION: + case ELSE: + case UNTIL: + case EXCEPT: + case FINALLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case SEMI: + case END: + case FINALIZATION: + case ELSE: + case UNTIL: + case EXCEPT: + case FINALLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + raiseStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = raiseStatement_AST; +} + +void PascalParser::identifierOrArrayIdentifier() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST identifierOrArrayIdentifier_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + if ((LA(1) == IDENT) && (_tokenSet_65.member(LA(2)))) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + identifierOrArrayIdentifier_AST = RefPascalAST(currentAST.root); + } + else if ((LA(1) == IDENT) && (LA(2) == LBRACK)) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(LBRACK); + 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 _loop302; + } + + } + _loop302:; + } // ( ... )* + match(RBRACK); + identifierOrArrayIdentifier_AST = RefPascalAST(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_65); + } else { + throw; + } + } + returnAST = identifierOrArrayIdentifier_AST; +} + +void PascalParser::assignmentOperator() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST assignmentOperator_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case ASSIGN: + { + match(ASSIGN); + assignmentOperator_AST = RefPascalAST(currentAST.root); + break; + } + case PLUSEQ: + { + RefPascalAST tmp280_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp280_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp280_AST)); + } + match(PLUSEQ); + assignmentOperator_AST = RefPascalAST(currentAST.root); + break; + } + case MINUSEQ: + { + RefPascalAST tmp281_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp281_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp281_AST)); + } + match(MINUSEQ); + assignmentOperator_AST = RefPascalAST(currentAST.root); + break; + } + case STAREQ: + { + RefPascalAST tmp282_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp282_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp282_AST)); + } + match(STAREQ); + assignmentOperator_AST = RefPascalAST(currentAST.root); + break; + } + case SLASHQE: + { + RefPascalAST tmp283_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp283_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp283_AST)); + } + match(SLASHQE); + assignmentOperator_AST = RefPascalAST(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_36); + } else { + throw; + } + } + returnAST = assignmentOperator_AST; +} + +void PascalParser::repetitiveStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST repetitiveStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case FOR: + { + forStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + repetitiveStatement_AST = RefPascalAST(currentAST.root); + break; + } + case REPEAT: + { + repeatStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + repetitiveStatement_AST = RefPascalAST(currentAST.root); + break; + } + case WHILE: + { + whileStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + repetitiveStatement_AST = RefPascalAST(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_16); + } else { + throw; + } + } + returnAST = repetitiveStatement_AST; +} + +void PascalParser::conditionalStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST conditionalStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case IF: + { + ifStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + conditionalStatement_AST = RefPascalAST(currentAST.root); + break; + } + case CASE: + { + caseStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + conditionalStatement_AST = RefPascalAST(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_16); + } else { + throw; + } + } + returnAST = conditionalStatement_AST; +} + +void PascalParser::exceptionStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST exceptionStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + tryStatement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + exceptionStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = exceptionStatement_AST; +} + +void PascalParser::withStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST withStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp284_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp284_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp284_AST)); + } + match(WITH); + recordVariableList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(DO); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + withStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = withStatement_AST; +} + +void PascalParser::ifStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST ifStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp286_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp286_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp286_AST)); + } + match(IF); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(THEN); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + if ((LA(1) == ELSE) && (_tokenSet_24.member(LA(2)))) { + match(ELSE); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else if ((_tokenSet_16.member(LA(1))) && (_tokenSet_66.member(LA(2)))) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + ifStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = ifStatement_AST; +} + +void PascalParser::caseStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST caseStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp289_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp289_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp289_AST)); + } + match(CASE); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(OF); + caseListElement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI) && (_tokenSet_33.member(LA(2)))) { + match(SEMI); + caseListElement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop320; + } + + } + _loop320:; + } // ( ... )* + { + switch ( LA(1)) { + case SEMI: + { + match(SEMI); + match(ELSE); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop323; + } + + } + _loop323:; + } // ( ... )* + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(END); + caseStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = caseStatement_AST; +} + +void PascalParser::forStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST forStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp296_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp296_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp296_AST)); + } + match(FOR); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(ASSIGN); + forList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(DO); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + forStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = forStatement_AST; +} + +void PascalParser::repeatStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST repeatStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp299_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp299_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp299_AST)); + } + match(REPEAT); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + { + switch ( LA(1)) { + case BEGIN: + case NUM_INT: + case CASE: + case GOTO: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + case RAISE: + case TRY: + case IDENT: + { + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case SEMI: + case UNTIL: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + else { + goto _loop332; + } + + } + _loop332:; + } // ( ... )* + match(UNTIL); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + repeatStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = repeatStatement_AST; +} + +void PascalParser::whileStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST whileStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp302_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp302_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp302_AST)); + } + match(WHILE); + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(DO); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + whileStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = whileStatement_AST; +} + +void PascalParser::caseListElement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST caseListElement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + constList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + RefPascalAST tmp304_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp304_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp304_AST)); + } + match(COLON); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + caseListElement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_67); + } else { + throw; + } + } + returnAST = caseListElement_AST; +} + +void PascalParser::constList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST constList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + constant(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop327; + } + + } + _loop327:; + } // ( ... )* + if ( inputState->guessing==0 ) { + constList_AST = RefPascalAST(currentAST.root); +#line 746 "pascal.g" + constList_AST = RefPascalAST(astFactory->make((new ANTLR_USE_NAMESPACE(antlr)ASTArray(2))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(astFactory->create(CONSTLIST)))->add(ANTLR_USE_NAMESPACE(antlr)RefAST(constList_AST)))); +#line 8219 "PascalParser.cpp" + currentAST.root = constList_AST; + if ( constList_AST!=RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) && + constList_AST->getFirstChild() != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + currentAST.child = constList_AST->getFirstChild(); + else + currentAST.child = constList_AST; + currentAST.advanceChildToEnd(); + } + constList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_55); + } else { + throw; + } + } + returnAST = constList_AST; +} + +void PascalParser::forList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST forList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + initialValue(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { + switch ( LA(1)) { + case TO: + { + RefPascalAST tmp306_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp306_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp306_AST)); + } + match(TO); + break; + } + case DOWNTO: + { + RefPascalAST tmp307_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp307_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp307_AST)); + } + match(DOWNTO); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + finalValue(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + forList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_68); + } else { + throw; + } + } + returnAST = forList_AST; +} + +void PascalParser::initialValue() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST initialValue_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + initialValue_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_69); + } else { + throw; + } + } + returnAST = initialValue_AST; +} + +void PascalParser::finalValue() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST finalValue_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + expression(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + finalValue_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_68); + } else { + throw; + } + } + returnAST = finalValue_AST; +} + +void PascalParser::recordVariableList() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST recordVariableList_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + variable(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == COMMA)) { + match(COMMA); + variable(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop341; + } + + } + _loop341:; + } // ( ... )* + recordVariableList_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_68); + } else { + throw; + } + } + returnAST = recordVariableList_AST; +} + +/** A variable is an id with a suffix and can look like: + * id + * id[expr,...] + * id.id + * id.id[expr,...] + * id^ + * id^.id + * id^.id[expr,...] + * ... + * + * LL has a really hard time with this construct as it's naturally + * left-recursive. We have to turn into a simple loop rather than + * recursive loop, hence, the suffixes. I keep in the same rule + * for easy tree construction. + */ +void PascalParser::variable() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST variable_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case AT: + { + RefPascalAST tmp309_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp309_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp309_AST)); + } + match(AT); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case IDENT: + { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case LBRACK: + { + RefPascalAST tmp310_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp310_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp310_AST)); + } + match(LBRACK); + 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 _loop346; + } + + } + _loop346:; + } // ( ... )* + match(RBRACK); + break; + } + case LBRACK2: + { + RefPascalAST tmp313_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp313_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp313_AST)); + } + match(LBRACK2); + 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 _loop348; + } + + } + _loop348:; + } // ( ... )* + match(RBRACK2); + break; + } + case DOT: + { + RefPascalAST tmp316_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp316_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp316_AST)); + } + match(DOT); + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case POINTER: + { + RefPascalAST tmp317_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp317_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp317_AST)); + } + match(POINTER); + break; + } + default: + { + goto _loop349; + } + } + } + _loop349:; + } // ( ... )* + variable_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_70); + } else { + throw; + } + } + returnAST = variable_AST; +} + +void PascalParser::operatorDefinition() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST operatorDefinition_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp318_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp318_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp318_AST)); + } + match(OPERATOR); + { + switch ( LA(1)) { + case ASSIGN: + { + assignmentOperatorDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case PLUS: + case MINUS: + case STAR: + case SLASH: + { + arithmeticOperatorDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case EQUAL: + case LE: + case GE: + case LTH: + case GT: + { + comparisonOperatorDefinition(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + type(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(SEMI); + subroutineBlock(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + operatorDefinition_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_0); + } else { + throw; + } + } + returnAST = operatorDefinition_AST; +} + +void PascalParser::assignmentOperatorDefinition() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST assignmentOperatorDefinition_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(ASSIGN); + match(LPAREN); + valueParameter(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + assignmentOperatorDefinition_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_71); + } else { + throw; + } + } + returnAST = assignmentOperatorDefinition_AST; +} + +void PascalParser::arithmeticOperatorDefinition() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST arithmeticOperatorDefinition_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case PLUS: + { + match(PLUS); + break; + } + case MINUS: + { + match(MINUS); + break; + } + case SLASH: + { + match(SLASH); + break; + } + default: + if ((LA(1) == STAR) && (LA(2) == LPAREN)) { + match(STAR); + } + else if ((LA(1) == STAR) && (LA(2) == STAR)) { + { + match(STAR); + match(STAR); + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(LPAREN); + formalParameterList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + arithmeticOperatorDefinition_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_71); + } else { + throw; + } + } + returnAST = arithmeticOperatorDefinition_AST; +} + +void PascalParser::comparisonOperatorDefinition() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST comparisonOperatorDefinition_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + { + switch ( LA(1)) { + case EQUAL: + { + match(EQUAL); + break; + } + case LE: + { + match(LE); + break; + } + case GE: + { + match(GE); + break; + } + case GT: + { + match(GT); + break; + } + case LTH: + { + match(LTH); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(LPAREN); + formalParameterList(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + comparisonOperatorDefinition_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_71); + } else { + throw; + } + } + returnAST = comparisonOperatorDefinition_AST; +} + +void PascalParser::tryStatement() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST tryStatement_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp339_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp339_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp339_AST)); + } + match(TRY); + { + switch ( LA(1)) { + case BEGIN: + case NUM_INT: + case CASE: + case GOTO: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + case RAISE: + case TRY: + case IDENT: + { + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case EXCEPT: + case FINALLY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + exceptOrFinallyPart(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(END); + tryStatement_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_16); + } else { + throw; + } + } + returnAST = tryStatement_AST; +} + +void PascalParser::statements() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST statements_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop369; + } + + } + _loop369:; + } // ( ... )* + statements_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_72); + } else { + throw; + } + } + returnAST = statements_AST; +} + +void PascalParser::exceptOrFinallyPart() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST exceptOrFinallyPart_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case EXCEPT: + { + match(EXCEPT); + { + switch ( LA(1)) { + case BEGIN: + case NUM_INT: + case CASE: + case GOTO: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + case RAISE: + case TRY: + case ON: + case IDENT: + { + exceptionHandlers(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + exceptOrFinallyPart_AST = RefPascalAST(currentAST.root); + break; + } + case FINALLY: + { + match(FINALLY); + { + switch ( LA(1)) { + case BEGIN: + case NUM_INT: + case CASE: + case GOTO: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + case RAISE: + case TRY: + case IDENT: + { + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + exceptOrFinallyPart_AST = RefPascalAST(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_6); + } else { + throw; + } + } + returnAST = exceptOrFinallyPart_AST; +} + +void PascalParser::exceptionHandlers() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST exceptionHandlers_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case BEGIN: + case NUM_INT: + case CASE: + case GOTO: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + case RAISE: + case TRY: + case IDENT: + { + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + exceptionHandlers_AST = RefPascalAST(currentAST.root); + break; + } + case ON: + { + exceptionHandler(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + { // ( ... )* + for (;;) { + if ((LA(1) == SEMI)) { + match(SEMI); + exceptionHandler(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + } + else { + goto _loop372; + } + + } + _loop372:; + } // ( ... )* + { + switch ( LA(1)) { + case ELSE: + { + match(ELSE); + statements(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + break; + } + case END: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + exceptionHandlers_AST = RefPascalAST(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_6); + } else { + throw; + } + } + returnAST = exceptionHandlers_AST; +} + +void PascalParser::exceptionHandler() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST exceptionHandler_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + match(ON); + { + if ((LA(1) == IDENT) && (LA(2) == COLON)) { + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(COLON); + } + else if ((LA(1) == IDENT) && (LA(2) == DO)) { + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + identifier(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(DO); + statement(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + exceptionHandler_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_73); + } else { + throw; + } + } + returnAST = exceptionHandler_AST; +} + +void PascalParser::sign() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST sign_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case PLUS: + { + RefPascalAST tmp349_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp349_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp349_AST)); + } + match(PLUS); + sign_AST = RefPascalAST(currentAST.root); + break; + } + case MINUS: + { + RefPascalAST tmp350_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp350_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp350_AST)); + } + match(MINUS); + sign_AST = RefPascalAST(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_74); + } else { + throw; + } + } + returnAST = sign_AST; +} + +void PascalParser::constantChr() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST constantChr_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp351_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp351_AST = astFactory->create(LT(1)); + astFactory->makeASTRoot(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp351_AST)); + } + match(CHR); + match(LPAREN); + unsignedInteger(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + match(RPAREN); + constantChr_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_75); + } else { + throw; + } + } + returnAST = constantChr_AST; +} + +void PascalParser::unsignedNumber() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST unsignedNumber_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + switch ( LA(1)) { + case NUM_INT: + { + unsignedInteger(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unsignedNumber_AST = RefPascalAST(currentAST.root); + break; + } + case NUM_REAL: + { + unsignedReal(); + if (inputState->guessing==0) { + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST)); + } + unsignedNumber_AST = RefPascalAST(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_76); + } else { + throw; + } + } + returnAST = unsignedNumber_AST; +} + +void PascalParser::unsignedReal() { + returnAST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + ANTLR_USE_NAMESPACE(antlr)ASTPair currentAST; + RefPascalAST unsignedReal_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + + try { // for error handling + RefPascalAST tmp354_AST = RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST); + if ( inputState->guessing == 0 ) { + tmp354_AST = astFactory->create(LT(1)); + astFactory->addASTChild(currentAST, ANTLR_USE_NAMESPACE(antlr)RefAST(tmp354_AST)); + } + match(NUM_REAL); + unsignedReal_AST = RefPascalAST(currentAST.root); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_76); + } else { + throw; + } + } + returnAST = unsignedReal_AST; +} + +void PascalParser::initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ) +{ + factory.setMaxNodeType(189); +} +const char* PascalParser::tokenNames[] = { + "<0>", + "EOF", + "<2>", + "NULL_TREE_LOOKAHEAD", + "BLOCK", + "IDLIST", + "ELIST", + "FUNC_CALL", + "PROC_CALL", + "SCALARTYPE", + "TYPELIST", + "VARIANT_TAG", + "VARIANT_TAG_NO_ID", + "VARIANT_CASE", + "CONSTLIST", + "FIELDLIST", + "ARGDECLS", + "VARDECL", + "ARGDECL", + "ARGLIST", + "TYPEDECL", + "FIELD", + "DOT", + "\"library\"", + "SEMI", + "\"end\"", + "\"exports\"", + "COMMA", + "\"index\"", + "\"name\"", + "\"uses\"", + "\"unit\"", + "\"interface\"", + "\"implementation\"", + "\"begin\"", + "\"program\"", + "LPAREN", + "RPAREN", + "\"initialization\"", + "\"finalization\"", + "\"label\"", + "\"const\"", + "\"resourcestring\"", + "EQUAL", + "\"type\"", + "\"var\"", + "COLON", + "\"procedure\"", + "\"forward\"", + "\"function\"", + "\"array\"", + "\"of\"", + "\"external\"", + "\"public\"", + "\"alias\"", + "INTERRUPT", + "\"export\"", + "\"register\"", + "\"pascal\"", + "\"cdecl\"", + "\"stdcall\"", + "\"popstack\"", + "\"saveregisters\"", + "\"inline\"", + "\"safecall\"", + "\"near\"", + "\"far\"", + "NUM_INT", + "\"integer\"", + "\"shortint\"", + "\"smallint\"", + "\"longint\"", + "\"int64\"", + "\"byte\"", + "\"word\"", + "\"cardinal\"", + "\"qword\"", + "\"boolean\"", + "BYTEBOOL", + "LONGBOOL", + "\"char\"", + "DOTDOT", + "ASSIGN", + "\"real\"", + "\"single\"", + "\"double\"", + "\"extended\"", + "\"comp\"", + "\"string\"", + "LBRACK", + "RBRACK", + "\"packed\"", + "\"record\"", + "\"case\"", + "\"set\"", + "\"file\"", + "POINTER", + "\"object\"", + "\"virtual\"", + "\"abstract\"", + "\"private\"", + "\"protected\"", + "\"constructor\"", + "\"destructor\"", + "\"class\"", + "\"override\"", + "MESSAGE", + "\"published\"", + "\"property\"", + "\"read\"", + "\"write\"", + "\"default\"", + "\"nodefault\"", + "LE", + "GE", + "LTH", + "GT", + "NOT_EQUAL", + "\"in\"", + "\"is\"", + "PLUS", + "MINUS", + "\"or\"", + "\"xor\"", + "STAR", + "SLASH", + "\"div\"", + "\"mod\"", + "\"and\"", + "\"shl\"", + "\"shr\"", + "\"not\"", + "\"true\"", + "\"false\"", + "AT", + "PLUSEQ", + "MINUSEQ", + "STAREQ", + "SLASHQE", + "\"goto\"", + "\"if\"", + "\"then\"", + "\"else\"", + "\"while\"", + "\"do\"", + "\"repeat\"", + "\"until\"", + "\"for\"", + "\"to\"", + "\"downto\"", + "\"with\"", + "LBRACK2", + "RBRACK2", + "\"operator\"", + "\"raise\"", + "\"try\"", + "\"except\"", + "\"finally\"", + "\"on\"", + "STRING_LITERAL", + "\"chr\"", + "\"nil\"", + "NUM_REAL", + "IDENT", + "\"absolute\"", + "\"as\"", + "\"asm\"", + "\"assembler\"", + "\"break\"", + "\"continue\"", + "\"dispose\"", + "\"exit\"", + "\"inherited\"", + "\"new\"", + "\"self\"", + "METHOD", + "ADDSUBOR", + "ASSIGNEQUAL", + "SIGN", + "FUNC", + "NODE_NOT_EMIT", + "MYASTVAR", + "LF", + "LCURLY", + "RCURLY", + "WS", + "COMMENT_1", + "COMMENT_2", + "COMMENT_3", + "EXPONENT", + 0 +}; + +const unsigned long PascalParser::_tokenSet_0_data_[] = { 2UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_0(_tokenSet_0_data_,6); +const unsigned long PascalParser::_tokenSet_1_data_[] = { 1073741824UL, 177924UL, 0UL, 192UL, 0UL, 0UL, 0UL, 0UL }; +// "uses" "begin" "label" "const" "resourcestring" "type" "var" "procedure" +// "function" "constructor" "destructor" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_1(_tokenSet_1_data_,8); +const unsigned long PascalParser::_tokenSet_2_data_[] = { 100663296UL, 177990UL, 0UL, 192UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "exports" "implementation" "begin" "initialization" "label" "const" +// "resourcestring" "type" "var" "procedure" "function" "constructor" "destructor" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_2(_tokenSet_2_data_,8); +const unsigned long PascalParser::_tokenSet_3_data_[] = { 121634818UL, 177988UL, 0UL, 192UL, 0UL, 0UL, 0UL, 0UL }; +// EOF DOT SEMI "end" "exports" "begin" "initialization" "label" "const" +// "resourcestring" "type" "var" "procedure" "function" "constructor" "destructor" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_3(_tokenSet_3_data_,8); +const unsigned long PascalParser::_tokenSet_4_data_[] = { 994050050UL, 706736UL, 101056512UL, 4294963649UL, 833972167UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF DOT SEMI "end" COMMA "index" "name" LPAREN RPAREN "finalization" +// EQUAL COLON "procedure" "function" "of" DOTDOT ASSIGN LBRACK RBRACK +// POINTER "constructor" "destructor" "class" "property" "read" "write" +// "default" "nodefault" LE GE LTH GT NOT_EQUAL "in" "is" PLUS MINUS "or" +// "xor" STAR SLASH "div" "mod" "and" "shl" "shr" AT PLUSEQ MINUSEQ STAREQ +// SLASHQE "then" "else" "do" "until" "to" "downto" LBRACK2 RBRACK2 "except" +// "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_4(_tokenSet_4_data_,12); +const unsigned long PascalParser::_tokenSet_5_data_[] = { 67108864UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "exports" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_5(_tokenSet_5_data_,6); +const unsigned long PascalParser::_tokenSet_6_data_[] = { 33554432UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "end" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_6(_tokenSet_6_data_,6); +const unsigned long PascalParser::_tokenSet_7_data_[] = { 100663296UL, 68UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "exports" "begin" "initialization" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_7(_tokenSet_7_data_,6); +const unsigned long PascalParser::_tokenSet_8_data_[] = { 184549376UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "end" COMMA +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_8(_tokenSet_8_data_,6); +const unsigned long PascalParser::_tokenSet_9_data_[] = { 788529154UL, 177988UL, 0UL, 127424UL, 0UL, 0UL, 0UL, 0UL }; +// EOF SEMI "end" "exports" COMMA "name" "begin" "initialization" "label" +// "const" "resourcestring" "type" "var" "procedure" "function" "constructor" +// "destructor" "class" "property" "read" "write" "default" "nodefault" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_9(_tokenSet_9_data_,8); +const unsigned long PascalParser::_tokenSet_10_data_[] = { 1056964610UL, 177988UL, 0UL, 192UL, 0UL, 0UL, 0UL, 0UL }; +// EOF SEMI "end" "exports" COMMA "index" "name" "begin" "initialization" +// "label" "const" "resourcestring" "type" "var" "procedure" "function" +// "constructor" "destructor" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_10(_tokenSet_10_data_,8); +const unsigned long PascalParser::_tokenSet_11_data_[] = { 16777216UL, 16416UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RPAREN COLON RBRACK +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_11(_tokenSet_11_data_,8); +const unsigned long PascalParser::_tokenSet_12_data_[] = { 0UL, 2UL, 0UL, 0UL, 0UL, 0UL }; +// "implementation" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_12(_tokenSet_12_data_,6); +const unsigned long PascalParser::_tokenSet_13_data_[] = { 33554432UL, 68UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "begin" "initialization" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_13(_tokenSet_13_data_,6); +const unsigned long PascalParser::_tokenSet_14_data_[] = { 33554432UL, 128UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "finalization" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_14(_tokenSet_14_data_,6); +const unsigned long PascalParser::_tokenSet_15_data_[] = { 0UL, 168450UL, 0UL, 0UL, 0UL, 0UL }; +// "implementation" "const" "type" "procedure" "function" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_15(_tokenSet_15_data_,6); +const unsigned long PascalParser::_tokenSet_16_data_[] = { 50331648UL, 128UL, 0UL, 0UL, 805584896UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "end" "finalization" "else" "until" "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_16(_tokenSet_16_data_,12); +const unsigned long PascalParser::_tokenSet_17_data_[] = { 100663296UL, 177988UL, 0UL, 192UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "exports" "begin" "initialization" "label" "const" "resourcestring" +// "type" "var" "procedure" "function" "constructor" "destructor" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_17(_tokenSet_17_data_,8); +const unsigned long PascalParser::_tokenSet_18_data_[] = { 184549376UL, 16512UL, 0UL, 0UL, 805584896UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "end" COMMA "finalization" COLON "else" "until" "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_18(_tokenSet_18_data_,12); +const unsigned long PascalParser::_tokenSet_19_data_[] = { 100663296UL, 177990UL, 0UL, 192UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "exports" "implementation" "begin" "initialization" "label" "const" +// "resourcestring" "type" "var" "procedure" "function" "constructor" "destructor" +// IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_19(_tokenSet_19_data_,12); +const unsigned long PascalParser::_tokenSet_20_data_[] = { 100663296UL, 177988UL, 0UL, 192UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "exports" "begin" "initialization" "label" "const" "resourcestring" +// "type" "var" "procedure" "function" "constructor" "destructor" IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_20(_tokenSet_20_data_,12); +const unsigned long PascalParser::_tokenSet_21_data_[] = { 1061158914UL, 720868UL, 67239936UL, 4294840768UL, 825581575UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF DOT SEMI "end" "exports" COMMA "index" "name" "begin" RPAREN "initialization" +// "finalization" "label" "const" "resourcestring" EQUAL "type" "var" COLON +// "procedure" "function" "of" DOTDOT RBRACK "constructor" "destructor" +// "class" "property" LE GE LTH GT NOT_EQUAL "in" "is" PLUS MINUS "or" +// "xor" STAR SLASH "div" "mod" "and" "shl" "shr" "then" "else" "do" "until" +// "to" "downto" RBRACK2 "except" "finally" IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_21(_tokenSet_21_data_,12); +const unsigned long PascalParser::_tokenSet_22_data_[] = { 16777216UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_22(_tokenSet_22_data_,6); +const unsigned long PascalParser::_tokenSet_23_data_[] = { 16777216UL, 2080UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RPAREN EQUAL RBRACK +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_23(_tokenSet_23_data_,8); +const unsigned long PascalParser::_tokenSet_24_data_[] = { 0UL, 4UL, 536870920UL, 0UL, 206215168UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "begin" NUM_INT "case" "goto" "if" "while" "repeat" "for" "with" "raise" +// "try" IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_24(_tokenSet_24_data_,12); +const unsigned long PascalParser::_tokenSet_25_data_[] = { 121634818UL, 178116UL, 0UL, 192UL, 805584896UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF DOT SEMI "end" "exports" "begin" "initialization" "finalization" +// "label" "const" "resourcestring" "type" "var" "procedure" "function" +// "constructor" "destructor" "else" "until" "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_25(_tokenSet_25_data_,12); +const unsigned long PascalParser::_tokenSet_26_data_[] = { 16777216UL, 1818406UL, 67108864UL, 192UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "implementation" "begin" RPAREN "label" "const" "resourcestring" +// EQUAL "type" "var" "procedure" "forward" "function" "of" "external" +// RBRACK "constructor" "destructor" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_26(_tokenSet_26_data_,8); +const unsigned long PascalParser::_tokenSet_27_data_[] = { 117440514UL, 177988UL, 0UL, 192UL, 0UL, 0UL, 0UL, 0UL }; +// EOF SEMI "end" "exports" "begin" "initialization" "label" "const" "resourcestring" +// "type" "var" "procedure" "function" "constructor" "destructor" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_27(_tokenSet_27_data_,8); +const unsigned long PascalParser::_tokenSet_28_data_[] = { 16777216UL, 16400UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LPAREN COLON +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_28(_tokenSet_28_data_,6); +const unsigned long PascalParser::_tokenSet_29_data_[] = { 16777216UL, 16416UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RPAREN COLON +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_29(_tokenSet_29_data_,6); +const unsigned long PascalParser::_tokenSet_30_data_[] = { 16777216UL, 32UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI RPAREN RBRACK +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_30(_tokenSet_30_data_,8); +const unsigned long PascalParser::_tokenSet_31_data_[] = { 0UL, 426000UL, 3657039864UL, 50331907UL, 2147483648UL, 13UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// LPAREN "procedure" "function" "array" NUM_INT "integer" "shortint" "smallint" +// "longint" "int64" "byte" "word" "cardinal" "qword" "boolean" BYTEBOOL +// LONGBOOL "char" "real" "single" "double" "extended" "comp" "string" +// "packed" "record" "set" "file" POINTER "object" "class" PLUS MINUS STRING_LITERAL +// "chr" NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_31(_tokenSet_31_data_,12); +const unsigned long PascalParser::_tokenSet_32_data_[] = { 188743680UL, 524448UL, 67239936UL, 0UL, 825581568UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// DOT SEMI "end" COMMA RPAREN "finalization" "of" DOTDOT RBRACK "then" +// "else" "do" "until" "to" "downto" RBRACK2 "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_32(_tokenSet_32_data_,12); +const unsigned long PascalParser::_tokenSet_33_data_[] = { 0UL, 0UL, 8UL, 50331648UL, 2147483648UL, 13UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// NUM_INT PLUS MINUS STRING_LITERAL "chr" NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_33(_tokenSet_33_data_,12); +const unsigned long PascalParser::_tokenSet_34_data_[] = { 16777216UL, 16UL, 8UL, 0UL, 0UL, 12UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LPAREN NUM_INT NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_34(_tokenSet_34_data_,12); +const unsigned long PascalParser::_tokenSet_35_data_[] = { 0UL, 16UL, 8UL, 50331648UL, 2147483648UL, 13UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// LPAREN NUM_INT PLUS MINUS STRING_LITERAL "chr" NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_35(_tokenSet_35_data_,12); +const unsigned long PascalParser::_tokenSet_36_data_[] = { 0UL, 16UL, 33554440UL, 50331648UL, 2147483768UL, 15UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// LPAREN NUM_INT LBRACK PLUS MINUS "not" "true" "false" AT STRING_LITERAL +// "chr" "nil" NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_36(_tokenSet_36_data_,12); +const unsigned long PascalParser::_tokenSet_37_data_[] = { 16777216UL, 2064UL, 100663304UL, 4294836224UL, 2147483775UL, 15UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI LPAREN EQUAL NUM_INT LBRACK RBRACK LE GE LTH GT NOT_EQUAL "in" +// "is" PLUS MINUS "or" "xor" STAR SLASH "div" "mod" "and" "shl" "shr" +// "not" "true" "false" AT STRING_LITERAL "chr" "nil" NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_37(_tokenSet_37_data_,12); +const unsigned long PascalParser::_tokenSet_38_data_[] = { 184549378UL, 182304UL, 67239936UL, 4544UL, 0UL, 0UL, 0UL, 0UL }; +// EOF SEMI "end" COMMA RPAREN EQUAL COLON "procedure" "function" DOTDOT +// RBRACK "constructor" "destructor" "class" "property" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_38(_tokenSet_38_data_,8); +const unsigned long PascalParser::_tokenSet_39_data_[] = { 150994944UL, 32UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI COMMA RPAREN +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_39(_tokenSet_39_data_,6); +const unsigned long PascalParser::_tokenSet_40_data_[] = { 150994944UL, 2080UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI COMMA RPAREN EQUAL RBRACK +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_40(_tokenSet_40_data_,8); +const unsigned long PascalParser::_tokenSet_41_data_[] = { 318767104UL, 165936UL, 67108864UL, 127424UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "end" "index" LPAREN RPAREN EQUAL "procedure" "function" RBRACK +// "constructor" "destructor" "class" "property" "read" "write" "default" +// "nodefault" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_41(_tokenSet_41_data_,8); +const unsigned long PascalParser::_tokenSet_42_data_[] = { 0UL, 32UL, 0UL, 0UL, 0UL, 0UL }; +// RPAREN +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_42(_tokenSet_42_data_,6); +const unsigned long PascalParser::_tokenSet_43_data_[] = { 792723458UL, 720868UL, 67239936UL, 4294963648UL, 825581575UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF DOT SEMI "end" "exports" COMMA "name" "begin" RPAREN "initialization" +// "finalization" "label" "const" "resourcestring" EQUAL "type" "var" COLON +// "procedure" "function" "of" DOTDOT RBRACK "constructor" "destructor" +// "class" "property" "read" "write" "default" "nodefault" LE GE LTH GT +// NOT_EQUAL "in" "is" PLUS MINUS "or" "xor" STAR SLASH "div" "mod" "and" +// "shl" "shr" "then" "else" "do" "until" "to" "downto" RBRACK2 "except" +// "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_43(_tokenSet_43_data_,12); +const unsigned long PascalParser::_tokenSet_44_data_[] = { 0UL, 2064UL, 100794376UL, 4294836224UL, 2147483775UL, 15UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// LPAREN EQUAL NUM_INT DOTDOT LBRACK RBRACK LE GE LTH GT NOT_EQUAL "in" +// "is" PLUS MINUS "or" "xor" STAR SLASH "div" "mod" "and" "shl" "shr" +// "not" "true" "false" AT STRING_LITERAL "chr" "nil" NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_44(_tokenSet_44_data_,12); +const unsigned long PascalParser::_tokenSet_45_data_[] = { 134217728UL, 0UL, 67108864UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// COMMA RBRACK +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_45(_tokenSet_45_data_,8); +const unsigned long PascalParser::_tokenSet_46_data_[] = { 33554432UL, 32UL, 536870912UL, 0UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "end" RPAREN "case" IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_46(_tokenSet_46_data_,12); +const unsigned long PascalParser::_tokenSet_47_data_[] = { 50331648UL, 32UL, 536870912UL, 0UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "end" RPAREN "case" IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_47(_tokenSet_47_data_,12); +const unsigned long PascalParser::_tokenSet_48_data_[] = { 33554432UL, 2260992UL, 0UL, 6640UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "procedure" "function" "public" "private" "protected" "constructor" +// "destructor" "class" "published" "property" IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_48(_tokenSet_48_data_,12); +const unsigned long PascalParser::_tokenSet_49_data_[] = { 0UL, 163840UL, 0UL, 192UL, 0UL, 0UL, 0UL, 0UL }; +// "procedure" "function" "constructor" "destructor" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_49(_tokenSet_49_data_,8); +const unsigned long PascalParser::_tokenSet_50_data_[] = { 33554432UL, 163840UL, 0UL, 4544UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "procedure" "function" "constructor" "destructor" "class" "property" +// IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_50(_tokenSet_50_data_,12); +const unsigned long PascalParser::_tokenSet_51_data_[] = { 33554432UL, 163840UL, 0UL, 192UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "procedure" "function" "constructor" "destructor" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_51(_tokenSet_51_data_,8); +const unsigned long PascalParser::_tokenSet_52_data_[] = { 0UL, 163840UL, 0UL, 4544UL, 0UL, 0UL, 0UL, 0UL }; +// "procedure" "function" "constructor" "destructor" "class" "property" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_52(_tokenSet_52_data_,8); +const unsigned long PascalParser::_tokenSet_53_data_[] = { 33554432UL, 163840UL, 0UL, 4544UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "procedure" "function" "constructor" "destructor" "class" "property" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_53(_tokenSet_53_data_,8); +const unsigned long PascalParser::_tokenSet_54_data_[] = { 33554432UL, 163840UL, 0UL, 127424UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "procedure" "function" "constructor" "destructor" "class" "property" +// "read" "write" "default" "nodefault" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_54(_tokenSet_54_data_,8); +const unsigned long PascalParser::_tokenSet_55_data_[] = { 0UL, 16384UL, 0UL, 0UL, 0UL, 0UL }; +// COLON +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_55(_tokenSet_55_data_,6); +const unsigned long PascalParser::_tokenSet_56_data_[] = { 33554432UL, 163840UL, 0UL, 119232UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "procedure" "function" "constructor" "destructor" "class" "property" +// "write" "default" "nodefault" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_56(_tokenSet_56_data_,8); +const unsigned long PascalParser::_tokenSet_57_data_[] = { 33554432UL, 163840UL, 0UL, 102848UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "procedure" "function" "constructor" "destructor" "class" "property" +// "default" "nodefault" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_57(_tokenSet_57_data_,8); +const unsigned long PascalParser::_tokenSet_58_data_[] = { 188743680UL, 526496UL, 67239936UL, 16646144UL, 825581568UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// DOT SEMI "end" COMMA RPAREN "finalization" EQUAL "of" DOTDOT RBRACK +// LE GE LTH GT NOT_EQUAL "in" "is" "then" "else" "do" "until" "to" "downto" +// RBRACK2 "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_58(_tokenSet_58_data_,12); +const unsigned long PascalParser::_tokenSet_59_data_[] = { 188743680UL, 526496UL, 67239936UL, 268304384UL, 825581568UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// DOT SEMI "end" COMMA RPAREN "finalization" EQUAL "of" DOTDOT RBRACK +// LE GE LTH GT NOT_EQUAL "in" "is" PLUS MINUS "or" "xor" "then" "else" +// "do" "until" "to" "downto" RBRACK2 "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_59(_tokenSet_59_data_,12); +const unsigned long PascalParser::_tokenSet_60_data_[] = { 188743680UL, 526512UL, 67239936UL, 4294836224UL, 825581575UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// DOT SEMI "end" COMMA LPAREN RPAREN "finalization" EQUAL "of" DOTDOT +// RBRACK LE GE LTH GT NOT_EQUAL "in" "is" PLUS MINUS "or" "xor" STAR SLASH +// "div" "mod" "and" "shl" "shr" "then" "else" "do" "until" "to" "downto" +// RBRACK2 "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_60(_tokenSet_60_data_,12); +const unsigned long PascalParser::_tokenSet_61_data_[] = { 188743680UL, 526496UL, 67239936UL, 4294836224UL, 825581575UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// DOT SEMI "end" COMMA RPAREN "finalization" EQUAL "of" DOTDOT RBRACK +// LE GE LTH GT NOT_EQUAL "in" "is" PLUS MINUS "or" "xor" STAR SLASH "div" +// "mod" "and" "shl" "shr" "then" "else" "do" "until" "to" "downto" RBRACK2 +// "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_61(_tokenSet_61_data_,12); +const unsigned long PascalParser::_tokenSet_62_data_[] = { 50331648UL, 128UL, 0UL, 0UL, 805584960UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "end" "finalization" AT "else" "until" "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_62(_tokenSet_62_data_,12); +const unsigned long PascalParser::_tokenSet_63_data_[] = { 0UL, 0UL, 33816576UL, 0UL, 1920UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// ASSIGN LBRACK PLUSEQ MINUSEQ STAREQ SLASHQE +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_63(_tokenSet_63_data_,12); +const unsigned long PascalParser::_tokenSet_64_data_[] = { 50331648UL, 144UL, 0UL, 0UL, 805584896UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "end" LPAREN "finalization" "else" "until" "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_64(_tokenSet_64_data_,12); +const unsigned long PascalParser::_tokenSet_65_data_[] = { 0UL, 0UL, 262144UL, 0UL, 1920UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// ASSIGN PLUSEQ MINUSEQ STAREQ SLASHQE +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_65(_tokenSet_65_data_,12); +const unsigned long PascalParser::_tokenSet_66_data_[] = { 121634818UL, 178132UL, 570425352UL, 50331840UL, 4233025656UL, 15UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF DOT SEMI "end" "exports" "begin" LPAREN "initialization" "finalization" +// "label" "const" "resourcestring" "type" "var" "procedure" "function" +// NUM_INT LBRACK "case" "constructor" "destructor" PLUS MINUS "not" "true" +// "false" AT "goto" "if" "else" "while" "repeat" "until" "for" "with" +// "raise" "try" "except" "finally" "on" STRING_LITERAL "chr" "nil" NUM_REAL +// IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_66(_tokenSet_66_data_,12); +const unsigned long PascalParser::_tokenSet_67_data_[] = { 50331648UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "end" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_67(_tokenSet_67_data_,6); +const unsigned long PascalParser::_tokenSet_68_data_[] = { 0UL, 0UL, 0UL, 0UL, 65536UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "do" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_68(_tokenSet_68_data_,12); +const unsigned long PascalParser::_tokenSet_69_data_[] = { 0UL, 0UL, 0UL, 0UL, 3145728UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "to" "downto" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_69(_tokenSet_69_data_,12); +const unsigned long PascalParser::_tokenSet_70_data_[] = { 134217728UL, 0UL, 0UL, 0UL, 65536UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// COMMA "do" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_70(_tokenSet_70_data_,12); +const unsigned long PascalParser::_tokenSet_71_data_[] = { 0UL, 0UL, 0UL, 0UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_71(_tokenSet_71_data_,12); +const unsigned long PascalParser::_tokenSet_72_data_[] = { 33554432UL, 0UL, 0UL, 0UL, 805306368UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// "end" "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_72(_tokenSet_72_data_,12); +const unsigned long PascalParser::_tokenSet_73_data_[] = { 50331648UL, 0UL, 0UL, 0UL, 16384UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SEMI "end" "else" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_73(_tokenSet_73_data_,12); +const unsigned long PascalParser::_tokenSet_74_data_[] = { 0UL, 0UL, 8UL, 0UL, 0UL, 12UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// NUM_INT NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_74(_tokenSet_74_data_,12); +const unsigned long PascalParser::_tokenSet_75_data_[] = { 1061158914UL, 720868UL, 67239936UL, 4294840768UL, 825581575UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF DOT SEMI "end" "exports" COMMA "index" "name" "begin" RPAREN "initialization" +// "finalization" "label" "const" "resourcestring" EQUAL "type" "var" COLON +// "procedure" "function" "of" DOTDOT RBRACK "constructor" "destructor" +// "class" "property" LE GE LTH GT NOT_EQUAL "in" "is" PLUS MINUS "or" +// "xor" STAR SLASH "div" "mod" "and" "shl" "shr" "then" "else" "do" "until" +// "to" "downto" RBRACK2 "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_75(_tokenSet_75_data_,12); +const unsigned long PascalParser::_tokenSet_76_data_[] = { 188743682UL, 706720UL, 67239936UL, 4294840768UL, 825581575UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// EOF DOT SEMI "end" COMMA RPAREN "finalization" EQUAL COLON "procedure" +// "function" "of" DOTDOT RBRACK "constructor" "destructor" "class" "property" +// LE GE LTH GT NOT_EQUAL "in" "is" PLUS MINUS "or" "xor" STAR SLASH "div" +// "mod" "and" "shl" "shr" "then" "else" "do" "until" "to" "downto" RBRACK2 +// "except" "finally" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalParser::_tokenSet_76(_tokenSet_76_data_,12); + + diff --git a/languages/pascal/PascalParser.hpp b/languages/pascal/PascalParser.hpp new file mode 100644 index 00000000..d37d76c5 --- /dev/null +++ b/languages/pascal/PascalParser.hpp @@ -0,0 +1,422 @@ +#ifndef INC_PascalParser_hpp_ +#define INC_PascalParser_hpp_ + +#line 29 "pascal.g" + + #include "problemreporter.h" + #include "PascalAST.hpp" + + #include + #include + + #define SET_POSITION(ast,t)\ + { \ + RefPascalAST(ast)->setLine( t->getLine() );\ + RefPascalAST(ast)->setColumn( t->getColumn() ); \ + } + +#line 19 "PascalParser.hpp" +#include +/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalParser.hpp"$ */ +#include +#include +#include "PascalTokenTypes.hpp" +#include + +class CUSTOM_API PascalParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public PascalTokenTypes +{ +#line 90 "pascal.g" + +private: + unsigned int m_numberOfErrors; + ProblemReporter* m_problemReporter; + +public: + void resetErrors() { m_numberOfErrors = 0; } + unsigned int numberOfErrors() const { return m_numberOfErrors; } + void setProblemReporter( ProblemReporter* r ) { m_problemReporter = r; } + + void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_problemReporter->reportError( ex.getMessage().c_str(), + ex.getFilename().c_str(), + ex.getLine(), + ex.getColumn() ); + ++m_numberOfErrors; + } + + void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_problemReporter->reportError( errorMessage.c_str(), + getFilename().c_str(), + LT(1)->getLine(), + LT(1)->getColumn() ); + ++m_numberOfErrors; + } + + void reportMessage( const ANTLR_USE_NAMESPACE(std)string& message ){ + m_problemReporter->reportMessage( message.c_str(), + getFilename().c_str(), + LT(1)->getLine(), + LT(1)->getColumn() ); + } +#line 30 "PascalParser.hpp" +public: + void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); +protected: + PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); +public: + PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); +protected: + PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); +public: + PascalParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); + PascalParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); + int getNumTokens() const + { + return PascalParser::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return PascalParser::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return PascalParser::tokenNames; + } + public: void compilationUnit(); + public: void program(); + public: void library(); + public: void unit(); + public: void programHeading(); + public: void usesClause(); + public: void block(); + public: void identifier(); + public: void libraryBlock(); + public: void exportsClause(); + public: void declarationPart(); + public: void statementPart(); + public: void exportsList(); + public: void exportsEntry(); + public: void integerConstant(); + public: void stringConstant(); + public: void identifierList(); + public: void interfacePart(); + public: void implementationPart(); + public: void initializationPart(); + public: void finalizationPart(); + public: void realizationPart(); + public: void constantDeclarationPart(); + public: void typeDeclarationPart(); + public: void procedureHeadersPart(); + public: void statement(); + public: void labelDeclarationPart(); + public: void resourcestringDeclarationPart(); + public: void variableDeclarationPart(); + public: void procedureAndFunctionDeclarationPart(); + public: void label(); + public: void constantDeclaration(); + public: void typedConstantDeclaration(); + public: void stringConstantDeclaration(); + public: void string(); + public: void typeDeclaration(); + public: void variableDeclaration(); + public: void type(); + public: void procedureAndFunctionDeclaration(); + public: void procedureDeclaration(); + public: void functionDeclaration(); + public: void constructorDeclaration(); + public: void destructorDeclaration(); + public: void compoundStatement(); + public: void procedureHeader(); + public: void subroutineBlock(); + public: void functionHeader(); + public: void qualifiedMethodIdentifier(); + public: void formalParameterList(); + public: void modifiers(); + public: void externalDirective(); + public: void functionHeaderEnding(); + public: void parameterDeclaration(); + public: void valueParameter(); + public: void variableParameter(); + public: void constantParameter(); + public: void untypedParameterPart(); + public: void callModifiers(); + public: void expression(); + public: void typedConstant(); + public: void constant(); + public: void recordConstant(); + public: void arrayConstant(); + public: void proceduralConstant(); + public: void addressConstant(); + public: void simpleType(); + public: void subrangeTypeOrTypeIdentifier(); + public: void enumeratedType(); + public: void stringType(); + public: void structuredType(); + public: void pointerType(); + public: void proceduralType(); + public: void ordinalType(); + public: void realType(); + public: void typeIdentifier(); + public: void subrangeType(); + public: void assignedEnumList(); + public: void unsignedInteger(); + public: void arrayType(); + public: void recordType(); + public: void objectType(); + public: void classType(); + public: void setType(); + public: void fileType(); + public: void arrayIndexType(); + public: void arraySubrangeType(); + public: void fieldList(); + public: void fixedField(); + public: void variantPart(); + public: void variant(); + public: void proceduralTypePart1(); + public: void heritage(); + public: void componentList(); + public: void objectVisibilitySpecifier(); + public: void fieldDefinition(); + public: void methodDefinition(); + public: void constructorHeader(); + public: void destructorHeader(); + public: void methodDirectives(); + public: void classComponentList(); + public: void classVisibilitySpecifier(); + public: void classMethodDefinition(); + public: void propertyDefinition(); + public: void classMethodDirectives(); + public: void directiveVariants(); + public: void propertyInterface(); + public: void propertySpecifiers(); + public: void propertyParameterList(); + public: void readSpecifier(); + public: void writeSpecifier(); + public: void defaultSpecifier(); + public: void fieldOrMethod(); + public: void simpleExpression(); + public: void expressionSign(); + public: void term(); + public: void factor(); + public: void identifierOrValueTypecastOrFunctionCall(); + public: void unsignedConstant(); + public: void setConstructor(); + public: void addressFactor(); + public: void expressions(); + public: void functionCall(); + public: void actualParameterList(); + public: void setGroup(); + public: void valueTypecast(); + public: void simpleStatement(); + public: void structuredStatement(); + public: void assignmentStatement(); + public: void procedureStatement(); + public: void gotoStatement(); + public: void raiseStatement(); + public: void identifierOrArrayIdentifier(); + public: void assignmentOperator(); + public: void repetitiveStatement(); + public: void conditionalStatement(); + public: void exceptionStatement(); + public: void withStatement(); + public: void ifStatement(); + public: void caseStatement(); + public: void forStatement(); + public: void repeatStatement(); + public: void whileStatement(); + public: void caseListElement(); + public: void constList(); + public: void forList(); + public: void initialValue(); + public: void finalValue(); + public: void recordVariableList(); + public: void variable(); + public: void operatorDefinition(); + public: void assignmentOperatorDefinition(); + public: void arithmeticOperatorDefinition(); + public: void comparisonOperatorDefinition(); + public: void tryStatement(); + public: void statements(); + public: void exceptOrFinallyPart(); + public: void exceptionHandlers(); + public: void exceptionHandler(); + public: void sign(); + public: void constantChr(); + public: void unsignedNumber(); + public: void unsignedReal(); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefPascalAST returnAST; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 190; +#else + enum { + NUM_TOKENS = 190 + }; +#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; + static const unsigned long _tokenSet_67_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_67; + static const unsigned long _tokenSet_68_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_68; + static const unsigned long _tokenSet_69_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_69; + static const unsigned long _tokenSet_70_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_70; + static const unsigned long _tokenSet_71_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_71; + static const unsigned long _tokenSet_72_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_72; + static const unsigned long _tokenSet_73_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_73; + static const unsigned long _tokenSet_74_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_74; + static const unsigned long _tokenSet_75_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_75; + static const unsigned long _tokenSet_76_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_76; +}; + +#endif /*INC_PascalParser_hpp_*/ diff --git a/languages/pascal/PascalStoreWalker.cpp b/languages/pascal/PascalStoreWalker.cpp new file mode 100644 index 00000000..96c69fe4 --- /dev/null +++ b/languages/pascal/PascalStoreWalker.cpp @@ -0,0 +1,3409 @@ +/* $ANTLR 2.7.7 (20061129): "pascal.tree.g" -> "PascalStoreWalker.cpp"$ */ +#include "PascalStoreWalker.hpp" +#include +#include +#include +#include +#include +#include +#line 1 "pascal.tree.g" +#line 11 "PascalStoreWalker.cpp" +PascalStoreWalker::PascalStoreWalker() + : ANTLR_USE_NAMESPACE(antlr)TreeParser() { +} + +void PascalStoreWalker::program(RefPascalAST _t) { + RefPascalAST program_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + programHeading(_t); + _t = _retTree; + block(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::programHeading(RefPascalAST _t) { + RefPascalAST programHeading_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROGRAM: + { + RefPascalAST __t3 = _t; + RefPascalAST tmp1_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROGRAM); + _t = _t->getFirstChild(); + RefPascalAST tmp2_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + identifierList(_t); + _t = _retTree; + _t = __t3; + _t = _t->getNextSibling(); + break; + } + case UNIT: + { + RefPascalAST __t4 = _t; + RefPascalAST tmp3_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),UNIT); + _t = _t->getFirstChild(); + RefPascalAST tmp4_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + _t = __t4; + _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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::block(RefPascalAST _t) { + RefPascalAST block_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { // ( ... )* + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case LABEL: + { + labelDeclarationPart(_t); + _t = _retTree; + break; + } + case CONST: + { + constantDefinitionPart(_t); + _t = _retTree; + break; + } + case TYPE: + { + typeDefinitionPart(_t); + _t = _retTree; + break; + } + case VAR: + { + variableDeclarationPart(_t); + _t = _retTree; + break; + } + case PROCEDURE: + case FUNCTION: + { + procedureAndFunctionDeclarationPart(_t); + _t = _retTree; + break; + } + case USES: + { + usesUnitsPart(_t); + _t = _retTree; + break; + } + case IMPLEMENTATION: + { + RefPascalAST tmp5_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IMPLEMENTATION); + _t = _t->getNextSibling(); + break; + } + default: + { + goto _loop8; + } + } + } + _loop8:; + } // ( ... )* + compoundStatement(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::identifierList(RefPascalAST _t) { + RefPascalAST identifierList_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t104 = _t; + RefPascalAST tmp6_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDLIST); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt106=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == IDENT)) { + RefPascalAST tmp7_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + } + else { + if ( _cnt106>=1 ) { goto _loop106; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt106++; + } + _loop106:; + } // ( ... )+ + _t = __t104; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::identifier(RefPascalAST _t) { + RefPascalAST identifier_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST tmp8_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::labelDeclarationPart(RefPascalAST _t) { + RefPascalAST labelDeclarationPart_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t12 = _t; + RefPascalAST tmp9_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LABEL); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt14=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == NUM_INT)) { + label(_t); + _t = _retTree; + } + else { + if ( _cnt14>=1 ) { goto _loop14; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt14++; + } + _loop14:; + } // ( ... )+ + _t = __t12; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::constantDefinitionPart(RefPascalAST _t) { + RefPascalAST constantDefinitionPart_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t17 = _t; + RefPascalAST tmp10_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CONST); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt19=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == EQUAL)) { + constantDefinition(_t); + _t = _retTree; + } + else { + if ( _cnt19>=1 ) { goto _loop19; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt19++; + } + _loop19:; + } // ( ... )+ + _t = __t17; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::typeDefinitionPart(RefPascalAST _t) { + RefPascalAST typeDefinitionPart_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t31 = _t; + RefPascalAST tmp11_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TYPE); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt33=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == TYPEDECL)) { + typeDefinition(_t); + _t = _retTree; + } + else { + if ( _cnt33>=1 ) { goto _loop33; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt33++; + } + _loop33:; + } // ( ... )+ + _t = __t31; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +/** Yields a list of VARDECL-rooted subtrees with VAR at the overall root */ +void PascalStoreWalker::variableDeclarationPart(RefPascalAST _t) { + RefPascalAST variableDeclarationPart_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t83 = _t; + RefPascalAST tmp12_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VAR); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt85=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == VARDECL)) { + variableDeclaration(_t); + _t = _retTree; + } + else { + if ( _cnt85>=1 ) { goto _loop85; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt85++; + } + _loop85:; + } // ( ... )+ + _t = __t83; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::procedureAndFunctionDeclarationPart(RefPascalAST _t) { + RefPascalAST procedureAndFunctionDeclarationPart_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + procedureOrFunctionDeclaration(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::usesUnitsPart(RefPascalAST _t) { + RefPascalAST usesUnitsPart_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t10 = _t; + RefPascalAST tmp13_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),USES); + _t = _t->getFirstChild(); + identifierList(_t); + _t = _retTree; + _t = __t10; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::compoundStatement(RefPascalAST _t) { + RefPascalAST compoundStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + statements(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::label(RefPascalAST _t) { + RefPascalAST label_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST tmp14_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_INT); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::constantDefinition(RefPascalAST _t) { + RefPascalAST constantDefinition_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t21 = _t; + RefPascalAST tmp15_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EQUAL); + _t = _t->getFirstChild(); + RefPascalAST tmp16_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + constant(_t); + _t = _retTree; + _t = __t21; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::constant(RefPascalAST _t) { + RefPascalAST constant_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case NUM_INT: + { + RefPascalAST tmp17_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_INT); + _t = _t->getNextSibling(); + break; + } + case NUM_REAL: + { + RefPascalAST tmp18_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_REAL); + _t = _t->getNextSibling(); + break; + } + case PLUS: + { + RefPascalAST __t23 = _t; + RefPascalAST tmp19_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PLUS); + _t = _t->getFirstChild(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case NUM_INT: + { + RefPascalAST tmp20_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_INT); + _t = _t->getNextSibling(); + break; + } + case NUM_REAL: + { + RefPascalAST tmp21_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_REAL); + _t = _t->getNextSibling(); + break; + } + case IDENT: + { + RefPascalAST tmp22_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t23; + _t = _t->getNextSibling(); + break; + } + case MINUS: + { + RefPascalAST __t25 = _t; + RefPascalAST tmp23_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MINUS); + _t = _t->getFirstChild(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case NUM_INT: + { + RefPascalAST tmp24_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_INT); + _t = _t->getNextSibling(); + break; + } + case NUM_REAL: + { + RefPascalAST tmp25_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_REAL); + _t = _t->getNextSibling(); + break; + } + case IDENT: + { + RefPascalAST tmp26_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t25; + _t = _t->getNextSibling(); + break; + } + case IDENT: + { + RefPascalAST tmp27_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + break; + } + case STRING_LITERAL: + { + RefPascalAST tmp28_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STRING_LITERAL); + _t = _t->getNextSibling(); + break; + } + case CHR: + { + RefPascalAST __t27 = _t; + RefPascalAST tmp29_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CHR); + _t = _t->getFirstChild(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case NUM_INT: + { + RefPascalAST tmp30_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_INT); + _t = _t->getNextSibling(); + break; + } + case NUM_REAL: + { + RefPascalAST tmp31_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_REAL); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t27; + _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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::string(RefPascalAST _t) { + RefPascalAST string_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST tmp32_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STRING_LITERAL); + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::typeDefinition(RefPascalAST _t) { + RefPascalAST typeDefinition_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t35 = _t; + RefPascalAST tmp33_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TYPEDECL); + _t = _t->getFirstChild(); + RefPascalAST tmp34_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case SCALARTYPE: + case ARRAY: + case INTEGER: + case BOOLEAN: + case CHAR: + case DOTDOT: + case REAL: + case STRING: + case PACKED: + case RECORD: + case SET: + case FILE: + case POINTER: + case IDENT: + { + type(_t); + _t = _retTree; + break; + } + case FUNCTION: + { + RefPascalAST __t37 = _t; + RefPascalAST tmp35_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FUNCTION); + _t = _t->getFirstChild(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARGDECLS: + { + formalParameterList(_t); + _t = _retTree; + break; + } + case INTEGER: + case BOOLEAN: + case CHAR: + case REAL: + case STRING: + case IDENT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + resultType(_t); + _t = _retTree; + _t = __t37; + _t = _t->getNextSibling(); + break; + } + case PROCEDURE: + { + RefPascalAST __t39 = _t; + RefPascalAST tmp36_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROCEDURE); + _t = _t->getFirstChild(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARGDECLS: + { + formalParameterList(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t39; + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t35; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::type(RefPascalAST _t) { + RefPascalAST type_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case SCALARTYPE: + { + RefPascalAST __t42 = _t; + RefPascalAST tmp37_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SCALARTYPE); + _t = _t->getFirstChild(); + identifierList(_t); + _t = _retTree; + _t = __t42; + _t = _t->getNextSibling(); + break; + } + case DOTDOT: + { + RefPascalAST __t43 = _t; + RefPascalAST tmp38_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOTDOT); + _t = _t->getFirstChild(); + constant(_t); + _t = _retTree; + constant(_t); + _t = _retTree; + _t = __t43; + _t = _t->getNextSibling(); + break; + } + case INTEGER: + case BOOLEAN: + case CHAR: + case REAL: + case STRING: + case IDENT: + { + typeIdentifier(_t); + _t = _retTree; + break; + } + case ARRAY: + case PACKED: + case RECORD: + case SET: + case FILE: + { + structuredType(_t); + _t = _retTree; + break; + } + case POINTER: + { + RefPascalAST __t44 = _t; + RefPascalAST tmp39_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),POINTER); + _t = _t->getFirstChild(); + typeIdentifier(_t); + _t = _retTree; + _t = __t44; + _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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::formalParameterList(RefPascalAST _t) { + RefPascalAST formalParameterList_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t94 = _t; + RefPascalAST tmp40_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ARGDECLS); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt96=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_0.member(_t->getType()))) { + formalParameterSection(_t); + _t = _retTree; + } + else { + if ( _cnt96>=1 ) { goto _loop96; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt96++; + } + _loop96:; + } // ( ... )+ + _t = __t94; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::resultType(RefPascalAST _t) { + RefPascalAST resultType_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + typeIdentifier(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::typeIdentifier(RefPascalAST _t) { + RefPascalAST typeIdentifier_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENT: + { + RefPascalAST tmp41_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + break; + } + case CHAR: + { + RefPascalAST tmp42_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CHAR); + _t = _t->getNextSibling(); + break; + } + case BOOLEAN: + { + RefPascalAST tmp43_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BOOLEAN); + _t = _t->getNextSibling(); + break; + } + case INTEGER: + { + RefPascalAST tmp44_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),INTEGER); + _t = _t->getNextSibling(); + break; + } + case REAL: + { + RefPascalAST tmp45_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),REAL); + _t = _t->getNextSibling(); + break; + } + case STRING: + { + RefPascalAST __t46 = _t; + RefPascalAST tmp46_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STRING); + _t = _t->getFirstChild(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IDENT: + { + RefPascalAST tmp47_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + break; + } + case NUM_INT: + { + RefPascalAST tmp48_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_INT); + _t = _t->getNextSibling(); + break; + } + case NUM_REAL: + { + RefPascalAST tmp49_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_REAL); + _t = _t->getNextSibling(); + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t46; + _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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::structuredType(RefPascalAST _t) { + RefPascalAST structuredType_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PACKED: + { + RefPascalAST __t49 = _t; + RefPascalAST tmp50_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PACKED); + _t = _t->getFirstChild(); + unpackedStructuredType(_t); + _t = _retTree; + _t = __t49; + _t = _t->getNextSibling(); + break; + } + case ARRAY: + case RECORD: + case SET: + case FILE: + { + unpackedStructuredType(_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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::unpackedStructuredType(RefPascalAST _t) { + RefPascalAST unpackedStructuredType_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARRAY: + { + arrayType(_t); + _t = _retTree; + break; + } + case RECORD: + { + recordType(_t); + _t = _retTree; + break; + } + case SET: + { + setType(_t); + _t = _retTree; + break; + } + case FILE: + { + fileType(_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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +/** Note here that the syntactic diff between brackets disappears. + * If the brackets mean different things semantically, we need + * two different alternatives here. + */ +void PascalStoreWalker::arrayType(RefPascalAST _t) { + RefPascalAST arrayType_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t52 = _t; + RefPascalAST tmp51_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ARRAY); + _t = _t->getFirstChild(); + typeList(_t); + _t = _retTree; + type(_t); + _t = _retTree; + _t = __t52; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::recordType(RefPascalAST _t) { + RefPascalAST recordType_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t58 = _t; + RefPascalAST tmp52_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),RECORD); + _t = _t->getFirstChild(); + fieldList(_t); + _t = _retTree; + _t = __t58; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::setType(RefPascalAST _t) { + RefPascalAST setType_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t78 = _t; + RefPascalAST tmp53_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SET); + _t = _t->getFirstChild(); + type(_t); + _t = _retTree; + _t = __t78; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::fileType(RefPascalAST _t) { + RefPascalAST fileType_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t80 = _t; + RefPascalAST tmp54_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FILE); + _t = _t->getFirstChild(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case SCALARTYPE: + case ARRAY: + case INTEGER: + case BOOLEAN: + case CHAR: + case DOTDOT: + case REAL: + case STRING: + case PACKED: + case RECORD: + case SET: + case FILE: + case POINTER: + case IDENT: + { + type(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t80; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::typeList(RefPascalAST _t) { + RefPascalAST typeList_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t54 = _t; + RefPascalAST tmp55_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TYPELIST); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt56=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_1.member(_t->getType()))) { + type(_t); + _t = _retTree; + } + else { + if ( _cnt56>=1 ) { goto _loop56; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt56++; + } + _loop56:; + } // ( ... )+ + _t = __t54; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::fieldList(RefPascalAST _t) { + RefPascalAST fieldList_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t60 = _t; + RefPascalAST tmp56_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FIELDLIST); + _t = _t->getFirstChild(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case FIELD: + { + fixedPart(_t); + _t = _retTree; + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case CASE: + { + variantPart(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + break; + } + case CASE: + { + variantPart(_t); + _t = _retTree; + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t60; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::fixedPart(RefPascalAST _t) { + RefPascalAST fixedPart_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { // ( ... )+ + int _cnt65=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == FIELD)) { + recordSection(_t); + _t = _retTree; + } + else { + if ( _cnt65>=1 ) { goto _loop65; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt65++; + } + _loop65:; + } // ( ... )+ + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::variantPart(RefPascalAST _t) { + RefPascalAST variantPart_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t69 = _t; + RefPascalAST tmp57_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CASE); + _t = _t->getFirstChild(); + tag(_t); + _t = _retTree; + { // ( ... )+ + int _cnt71=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == VARIANT_CASE)) { + variant(_t); + _t = _retTree; + } + else { + if ( _cnt71>=1 ) { goto _loop71; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt71++; + } + _loop71:; + } // ( ... )+ + _t = __t69; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::recordSection(RefPascalAST _t) { + RefPascalAST recordSection_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t67 = _t; + RefPascalAST tmp58_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FIELD); + _t = _t->getFirstChild(); + identifierList(_t); + _t = _retTree; + type(_t); + _t = _retTree; + _t = __t67; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::tag(RefPascalAST _t) { + RefPascalAST tag_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case VARIANT_TAG: + { + RefPascalAST __t73 = _t; + RefPascalAST tmp59_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VARIANT_TAG); + _t = _t->getFirstChild(); + identifier(_t); + _t = _retTree; + typeIdentifier(_t); + _t = _retTree; + _t = __t73; + _t = _t->getNextSibling(); + break; + } + case VARIANT_TAG_NO_ID: + { + RefPascalAST __t74 = _t; + RefPascalAST tmp60_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VARIANT_TAG_NO_ID); + _t = _t->getFirstChild(); + typeIdentifier(_t); + _t = _retTree; + _t = __t74; + _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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::variant(RefPascalAST _t) { + RefPascalAST variant_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t76 = _t; + RefPascalAST tmp61_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VARIANT_CASE); + _t = _t->getFirstChild(); + constList(_t); + _t = _retTree; + fieldList(_t); + _t = _retTree; + _t = __t76; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::constList(RefPascalAST _t) { + RefPascalAST constList_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t108 = _t; + RefPascalAST tmp62_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CONSTLIST); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt110=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_2.member(_t->getType()))) { + constant(_t); + _t = _retTree; + } + else { + if ( _cnt110>=1 ) { goto _loop110; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt110++; + } + _loop110:; + } // ( ... )+ + _t = __t108; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::variableDeclaration(RefPascalAST _t) { + RefPascalAST variableDeclaration_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t87 = _t; + RefPascalAST tmp63_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VARDECL); + _t = _t->getFirstChild(); + identifierList(_t); + _t = _retTree; + type(_t); + _t = _retTree; + _t = __t87; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::procedureOrFunctionDeclaration(RefPascalAST _t) { + RefPascalAST procedureOrFunctionDeclaration_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROCEDURE: + { + procedureDeclaration(_t); + _t = _retTree; + break; + } + case FUNCTION: + { + functionDeclaration(_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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::procedureDeclaration(RefPascalAST _t) { + RefPascalAST procedureDeclaration_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t91 = _t; + RefPascalAST tmp64_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROCEDURE); + _t = _t->getFirstChild(); + RefPascalAST tmp65_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARGDECLS: + { + formalParameterList(_t); + _t = _retTree; + break; + } + case BLOCK: + case USES: + case IMPLEMENTATION: + case LABEL: + case CONST: + case TYPE: + case VAR: + case PROCEDURE: + case FUNCTION: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + block(_t); + _t = _retTree; + _t = __t91; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::functionDeclaration(RefPascalAST _t) { + RefPascalAST functionDeclaration_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t112 = _t; + RefPascalAST tmp66_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FUNCTION); + _t = _t->getFirstChild(); + RefPascalAST tmp67_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARGDECLS: + { + formalParameterList(_t); + _t = _retTree; + break; + } + case INTEGER: + case BOOLEAN: + case CHAR: + case REAL: + case STRING: + case IDENT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + resultType(_t); + _t = _retTree; + block(_t); + _t = _retTree; + _t = __t112; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::formalParameterSection(RefPascalAST _t) { + RefPascalAST formalParameterSection_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARGDECL: + { + parameterGroup(_t); + _t = _retTree; + break; + } + case VAR: + { + RefPascalAST __t98 = _t; + RefPascalAST tmp68_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),VAR); + _t = _t->getFirstChild(); + parameterGroup(_t); + _t = _retTree; + _t = __t98; + _t = _t->getNextSibling(); + break; + } + case FUNCTION: + { + RefPascalAST __t99 = _t; + RefPascalAST tmp69_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FUNCTION); + _t = _t->getFirstChild(); + parameterGroup(_t); + _t = _retTree; + _t = __t99; + _t = _t->getNextSibling(); + break; + } + case PROCEDURE: + { + RefPascalAST __t100 = _t; + RefPascalAST tmp70_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROCEDURE); + _t = _t->getFirstChild(); + parameterGroup(_t); + _t = _retTree; + _t = __t100; + _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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::parameterGroup(RefPascalAST _t) { + RefPascalAST parameterGroup_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t102 = _t; + RefPascalAST tmp71_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ARGDECL); + _t = _t->getFirstChild(); + identifierList(_t); + _t = _retTree; + typeIdentifier(_t); + _t = _retTree; + _t = __t102; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::statement(RefPascalAST _t) { + RefPascalAST statement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case COLON: + { + RefPascalAST __t116 = _t; + RefPascalAST tmp72_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),COLON); + _t = _t->getFirstChild(); + label(_t); + _t = _retTree; + unlabelledStatement(_t); + _t = _retTree; + _t = __t116; + _t = _t->getNextSibling(); + break; + } + case BLOCK: + case PROC_CALL: + case ASSIGN: + case CASE: + case GOTO: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + { + unlabelledStatement(_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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::unlabelledStatement(RefPascalAST _t) { + RefPascalAST unlabelledStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case PROC_CALL: + case ASSIGN: + case GOTO: + { + simpleStatement(_t); + _t = _retTree; + break; + } + case BLOCK: + case CASE: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + { + structuredStatement(_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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::simpleStatement(RefPascalAST _t) { + RefPascalAST simpleStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ASSIGN: + { + assignmentStatement(_t); + _t = _retTree; + break; + } + case PROC_CALL: + { + procedureStatement(_t); + _t = _retTree; + break; + } + case GOTO: + { + gotoStatement(_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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::structuredStatement(RefPascalAST _t) { + RefPascalAST structuredStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case BLOCK: + { + compoundStatement(_t); + _t = _retTree; + break; + } + case CASE: + case IF: + { + conditionalStatement(_t); + _t = _retTree; + break; + } + case WHILE: + case REPEAT: + case FOR: + { + repetetiveStatement(_t); + _t = _retTree; + break; + } + case WITH: + { + withStatement(_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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::assignmentStatement(RefPascalAST _t) { + RefPascalAST assignmentStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t120 = _t; + RefPascalAST tmp73_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ASSIGN); + _t = _t->getFirstChild(); + variable(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t120; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::procedureStatement(RefPascalAST _t) { + RefPascalAST procedureStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t166 = _t; + RefPascalAST tmp74_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PROC_CALL); + _t = _t->getFirstChild(); + RefPascalAST tmp75_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARGLIST: + { + parameterList(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t166; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::gotoStatement(RefPascalAST _t) { + RefPascalAST gotoStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t170 = _t; + RefPascalAST tmp76_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GOTO); + _t = _t->getFirstChild(); + label(_t); + _t = _retTree; + _t = __t170; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +/** A variable is an id with a suffix and can look like: + * id + * id[expr,...] + * id.id + * id.id[expr,...] + * id^ + * id^.id + * id^.id[expr,...] + * ... + * + * LL has a really hard time with this construct as it's naturally + * left-recursive. We have to turn into a simple loop rather than + * recursive loop, hence, the suffixes. I keep in the same rule + * for easy tree construction. + */ +void PascalStoreWalker::variable(RefPascalAST _t) { + RefPascalAST variable_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case LBRACK: + { + RefPascalAST __t122 = _t; + RefPascalAST tmp77_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LBRACK); + _t = _t->getFirstChild(); + variable(_t); + _t = _retTree; + { // ( ... )+ + int _cnt124=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_3.member(_t->getType()))) { + expression(_t); + _t = _retTree; + } + else { + if ( _cnt124>=1 ) { goto _loop124; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt124++; + } + _loop124:; + } // ( ... )+ + _t = __t122; + _t = _t->getNextSibling(); + break; + } + case LBRACK2: + { + RefPascalAST __t125 = _t; + RefPascalAST tmp78_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LBRACK2); + _t = _t->getFirstChild(); + variable(_t); + _t = _retTree; + { // ( ... )+ + int _cnt127=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_3.member(_t->getType()))) { + expression(_t); + _t = _retTree; + } + else { + if ( _cnt127>=1 ) { goto _loop127; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt127++; + } + _loop127:; + } // ( ... )+ + _t = __t125; + _t = _t->getNextSibling(); + break; + } + case DOT: + { + RefPascalAST __t128 = _t; + RefPascalAST tmp79_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOT); + _t = _t->getFirstChild(); + variable(_t); + _t = _retTree; + RefPascalAST tmp80_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + _t = __t128; + _t = _t->getNextSibling(); + break; + } + case POINTER: + { + RefPascalAST __t129 = _t; + RefPascalAST tmp81_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),POINTER); + _t = _t->getFirstChild(); + variable(_t); + _t = _retTree; + _t = __t129; + _t = _t->getNextSibling(); + break; + } + case AT: + { + RefPascalAST __t130 = _t; + RefPascalAST tmp82_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),AT); + _t = _t->getFirstChild(); + RefPascalAST tmp83_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + _t = __t130; + _t = _t->getNextSibling(); + break; + } + case IDENT: + { + RefPascalAST tmp84_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::expression(RefPascalAST _t) { + RefPascalAST expression_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case EQUAL: + { + RefPascalAST __t132 = _t; + RefPascalAST tmp85_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),EQUAL); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t132; + _t = _t->getNextSibling(); + break; + } + case NOT_EQUAL: + { + RefPascalAST __t133 = _t; + RefPascalAST tmp86_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NOT_EQUAL); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t133; + _t = _t->getNextSibling(); + break; + } + case LTH: + { + RefPascalAST __t134 = _t; + RefPascalAST tmp87_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LTH); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t134; + _t = _t->getNextSibling(); + break; + } + case LE: + { + RefPascalAST __t135 = _t; + RefPascalAST tmp88_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),LE); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t135; + _t = _t->getNextSibling(); + break; + } + case GE: + { + RefPascalAST __t136 = _t; + RefPascalAST tmp89_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GE); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t136; + _t = _t->getNextSibling(); + break; + } + case GT: + { + RefPascalAST __t137 = _t; + RefPascalAST tmp90_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),GT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t137; + _t = _t->getNextSibling(); + break; + } + case IN: + { + RefPascalAST __t138 = _t; + RefPascalAST tmp91_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IN); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t138; + _t = _t->getNextSibling(); + break; + } + case PLUS: + { + RefPascalAST __t139 = _t; + RefPascalAST tmp92_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),PLUS); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case FUNC_CALL: + case DOT: + case EQUAL: + case NUM_INT: + case LBRACK: + case SET: + case POINTER: + case LE: + case GE: + case LTH: + case GT: + case NOT_EQUAL: + case IN: + case PLUS: + case MINUS: + case OR: + case STAR: + case SLASH: + case DIV: + case MOD: + case AND: + case NOT: + case AT: + case LBRACK2: + case STRING_LITERAL: + case CHR: + case NIL: + case NUM_REAL: + case IDENT: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t139; + _t = _t->getNextSibling(); + break; + } + case MINUS: + { + RefPascalAST __t141 = _t; + RefPascalAST tmp93_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MINUS); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case FUNC_CALL: + case DOT: + case EQUAL: + case NUM_INT: + case LBRACK: + case SET: + case POINTER: + case LE: + case GE: + case LTH: + case GT: + case NOT_EQUAL: + case IN: + case PLUS: + case MINUS: + case OR: + case STAR: + case SLASH: + case DIV: + case MOD: + case AND: + case NOT: + case AT: + case LBRACK2: + case STRING_LITERAL: + case CHR: + case NIL: + case NUM_REAL: + case IDENT: + { + expression(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t141; + _t = _t->getNextSibling(); + break; + } + case OR: + { + RefPascalAST __t143 = _t; + RefPascalAST tmp94_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),OR); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t143; + _t = _t->getNextSibling(); + break; + } + case STAR: + { + RefPascalAST __t144 = _t; + RefPascalAST tmp95_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),STAR); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t144; + _t = _t->getNextSibling(); + break; + } + case SLASH: + { + RefPascalAST __t145 = _t; + RefPascalAST tmp96_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SLASH); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t145; + _t = _t->getNextSibling(); + break; + } + case DIV: + { + RefPascalAST __t146 = _t; + RefPascalAST tmp97_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DIV); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t146; + _t = _t->getNextSibling(); + break; + } + case MOD: + { + RefPascalAST __t147 = _t; + RefPascalAST tmp98_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),MOD); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t147; + _t = _t->getNextSibling(); + break; + } + case AND: + { + RefPascalAST __t148 = _t; + RefPascalAST tmp99_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),AND); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t148; + _t = _t->getNextSibling(); + break; + } + case NOT: + { + RefPascalAST __t149 = _t; + RefPascalAST tmp100_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NOT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + _t = __t149; + _t = _t->getNextSibling(); + break; + } + case DOT: + case LBRACK: + case POINTER: + case AT: + case LBRACK2: + case IDENT: + { + variable(_t); + _t = _retTree; + break; + } + case FUNC_CALL: + { + functionDesignator(_t); + _t = _retTree; + break; + } + case SET: + { + set(_t); + _t = _retTree; + break; + } + case NUM_INT: + { + RefPascalAST tmp101_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_INT); + _t = _t->getNextSibling(); + break; + } + case NUM_REAL: + { + RefPascalAST tmp102_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_REAL); + _t = _t->getNextSibling(); + break; + } + case CHR: + { + RefPascalAST __t150 = _t; + RefPascalAST tmp103_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CHR); + _t = _t->getFirstChild(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case NUM_INT: + { + RefPascalAST tmp104_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_INT); + _t = _t->getNextSibling(); + break; + } + case NUM_REAL: + { + RefPascalAST tmp105_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NUM_REAL); + _t = _t->getNextSibling(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t150; + _t = _t->getNextSibling(); + break; + } + case STRING_LITERAL: + { + string(_t); + _t = _retTree; + break; + } + case NIL: + { + RefPascalAST tmp106_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),NIL); + _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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::functionDesignator(RefPascalAST _t) { + RefPascalAST functionDesignator_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t153 = _t; + RefPascalAST tmp107_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FUNC_CALL); + _t = _t->getFirstChild(); + RefPascalAST tmp108_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case ARGLIST: + { + parameterList(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t153; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::set(RefPascalAST _t) { + RefPascalAST set_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t160 = _t; + RefPascalAST tmp109_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),SET); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_4.member(_t->getType()))) { + element(_t); + _t = _retTree; + } + else { + goto _loop162; + } + + } + _loop162:; + } // ( ... )* + _t = __t160; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::parameterList(RefPascalAST _t) { + RefPascalAST parameterList_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t156 = _t; + RefPascalAST tmp110_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),ARGLIST); + _t = _t->getFirstChild(); + { // ( ... )+ + int _cnt158=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_3.member(_t->getType()))) { + actualParameter(_t); + _t = _retTree; + } + else { + if ( _cnt158>=1 ) { goto _loop158; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt158++; + } + _loop158:; + } // ( ... )+ + _t = __t156; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::actualParameter(RefPascalAST _t) { + RefPascalAST actualParameter_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + expression(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::element(RefPascalAST _t) { + RefPascalAST element_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case DOTDOT: + { + RefPascalAST __t164 = _t; + RefPascalAST tmp111_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOTDOT); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t164; + _t = _t->getNextSibling(); + break; + } + case FUNC_CALL: + case DOT: + case EQUAL: + case NUM_INT: + case LBRACK: + case SET: + case POINTER: + case LE: + case GE: + case LTH: + case GT: + case NOT_EQUAL: + case IN: + case PLUS: + case MINUS: + case OR: + case STAR: + case SLASH: + case DIV: + case MOD: + case AND: + case NOT: + case AT: + case LBRACK2: + case STRING_LITERAL: + case CHR: + case NIL: + case NUM_REAL: + case IDENT: + { + expression(_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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::conditionalStatement(RefPascalAST _t) { + RefPascalAST conditionalStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case IF: + { + ifStatement(_t); + _t = _retTree; + break; + } + case CASE: + { + caseStatement(_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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::repetetiveStatement(RefPascalAST _t) { + RefPascalAST repetetiveStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case WHILE: + { + whileStatement(_t); + _t = _retTree; + break; + } + case REPEAT: + { + repeatStatement(_t); + _t = _retTree; + break; + } + case FOR: + { + forStatement(_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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::withStatement(RefPascalAST _t) { + RefPascalAST withStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t201 = _t; + RefPascalAST tmp112_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),WITH); + _t = _t->getFirstChild(); + recordVariableList(_t); + _t = _retTree; + statement(_t); + _t = _retTree; + _t = __t201; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::statements(RefPascalAST _t) { + RefPascalAST statements_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t174 = _t; + RefPascalAST tmp113_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),BLOCK); + _t = _t->getFirstChild(); + { // ( ... )* + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_5.member(_t->getType()))) { + statement(_t); + _t = _retTree; + } + else { + goto _loop176; + } + + } + _loop176:; + } // ( ... )* + _t = __t174; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::ifStatement(RefPascalAST _t) { + RefPascalAST ifStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t179 = _t; + RefPascalAST tmp114_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IF); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + statement(_t); + _t = _retTree; + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case BLOCK: + case PROC_CALL: + case COLON: + case ASSIGN: + case CASE: + case GOTO: + case IF: + case WHILE: + case REPEAT: + case FOR: + case WITH: + { + statement(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t179; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::caseStatement(RefPascalAST _t) { + RefPascalAST caseStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t182 = _t; + RefPascalAST tmp115_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),CASE); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + { // ( ... )+ + int _cnt184=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_t->getType() == COLON)) { + caseListElement(_t); + _t = _retTree; + } + else { + if ( _cnt184>=1 ) { goto _loop184; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt184++; + } + _loop184:; + } // ( ... )+ + { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case BLOCK: + { + statements(_t); + _t = _retTree; + break; + } + case 3: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t)); + } + } + } + _t = __t182; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::caseListElement(RefPascalAST _t) { + RefPascalAST caseListElement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t187 = _t; + RefPascalAST tmp116_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),COLON); + _t = _t->getFirstChild(); + constList(_t); + _t = _retTree; + statement(_t); + _t = _retTree; + _t = __t187; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::whileStatement(RefPascalAST _t) { + RefPascalAST whileStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t190 = _t; + RefPascalAST tmp117_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),WHILE); + _t = _t->getFirstChild(); + expression(_t); + _t = _retTree; + statement(_t); + _t = _retTree; + _t = __t190; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::repeatStatement(RefPascalAST _t) { + RefPascalAST repeatStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t192 = _t; + RefPascalAST tmp118_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),REPEAT); + _t = _t->getFirstChild(); + statements(_t); + _t = _retTree; + expression(_t); + _t = _retTree; + _t = __t192; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::forStatement(RefPascalAST _t) { + RefPascalAST forStatement_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + RefPascalAST __t194 = _t; + RefPascalAST tmp119_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),FOR); + _t = _t->getFirstChild(); + RefPascalAST tmp120_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),IDENT); + _t = _t->getNextSibling(); + forList(_t); + _t = _retTree; + statement(_t); + _t = _retTree; + _t = __t194; + _t = _t->getNextSibling(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::forList(RefPascalAST _t) { + RefPascalAST forList_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + switch ( _t->getType()) { + case TO: + { + RefPascalAST __t196 = _t; + RefPascalAST tmp121_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),TO); + _t = _t->getFirstChild(); + initialValue(_t); + _t = _retTree; + finalValue(_t); + _t = _retTree; + _t = __t196; + _t = _t->getNextSibling(); + break; + } + case DOWNTO: + { + RefPascalAST __t197 = _t; + RefPascalAST tmp122_AST_in = _t; + match(ANTLR_USE_NAMESPACE(antlr)RefAST(_t),DOWNTO); + _t = _t->getFirstChild(); + initialValue(_t); + _t = _retTree; + finalValue(_t); + _t = _retTree; + _t = __t197; + _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 != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::initialValue(RefPascalAST _t) { + RefPascalAST initialValue_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + expression(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::finalValue(RefPascalAST _t) { + RefPascalAST finalValue_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + expression(_t); + _t = _retTree; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::recordVariableList(RefPascalAST _t) { + RefPascalAST recordVariableList_AST_in = (_t == RefPascalAST(ASTNULL)) ? RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) : _t; + + try { // for error handling + { // ( ... )+ + int _cnt204=0; + for (;;) { + if (_t == RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = ASTNULL; + if ((_tokenSet_6.member(_t->getType()))) { + variable(_t); + _t = _retTree; + } + else { + if ( _cnt204>=1 ) { goto _loop204; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(ANTLR_USE_NAMESPACE(antlr)RefAST(_t));} + } + + _cnt204++; + } + _loop204:; + } // ( ... )+ + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + reportError(ex); + if ( _t != RefPascalAST(ANTLR_USE_NAMESPACE(antlr)nullAST) ) + _t = _t->getNextSibling(); + } + _retTree = _t; +} + +void PascalStoreWalker::initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& ) +{ +} +const char* PascalStoreWalker::tokenNames[] = { + "<0>", + "EOF", + "<2>", + "NULL_TREE_LOOKAHEAD", + "BLOCK", + "IDLIST", + "ELIST", + "FUNC_CALL", + "PROC_CALL", + "SCALARTYPE", + "TYPELIST", + "VARIANT_TAG", + "VARIANT_TAG_NO_ID", + "VARIANT_CASE", + "CONSTLIST", + "FIELDLIST", + "ARGDECLS", + "VARDECL", + "ARGDECL", + "ARGLIST", + "TYPEDECL", + "FIELD", + "DOT", + "\"library\"", + "SEMI", + "\"end\"", + "\"exports\"", + "COMMA", + "\"index\"", + "\"name\"", + "\"uses\"", + "\"unit\"", + "\"interface\"", + "\"implementation\"", + "\"begin\"", + "\"program\"", + "LPAREN", + "RPAREN", + "\"initialization\"", + "\"finalization\"", + "\"label\"", + "\"const\"", + "\"resourcestring\"", + "EQUAL", + "\"type\"", + "\"var\"", + "COLON", + "\"procedure\"", + "\"forward\"", + "\"function\"", + "\"array\"", + "\"of\"", + "\"external\"", + "\"public\"", + "\"alias\"", + "INTERRUPT", + "\"export\"", + "\"register\"", + "\"pascal\"", + "\"cdecl\"", + "\"stdcall\"", + "\"popstack\"", + "\"saveregisters\"", + "\"inline\"", + "\"safecall\"", + "\"near\"", + "\"far\"", + "NUM_INT", + "\"integer\"", + "\"shortint\"", + "\"smallint\"", + "\"longint\"", + "\"int64\"", + "\"byte\"", + "\"word\"", + "\"cardinal\"", + "\"qword\"", + "\"boolean\"", + "BYTEBOOL", + "LONGBOOL", + "\"char\"", + "DOTDOT", + "ASSIGN", + "\"real\"", + "\"single\"", + "\"double\"", + "\"extended\"", + "\"comp\"", + "\"string\"", + "LBRACK", + "RBRACK", + "\"packed\"", + "\"record\"", + "\"case\"", + "\"set\"", + "\"file\"", + "POINTER", + "\"object\"", + "\"virtual\"", + "\"abstract\"", + "\"private\"", + "\"protected\"", + "\"constructor\"", + "\"destructor\"", + "\"class\"", + "\"override\"", + "MESSAGE", + "\"published\"", + "\"property\"", + "\"read\"", + "\"write\"", + "\"default\"", + "\"nodefault\"", + "LE", + "GE", + "LTH", + "GT", + "NOT_EQUAL", + "\"in\"", + "\"is\"", + "PLUS", + "MINUS", + "\"or\"", + "\"xor\"", + "STAR", + "SLASH", + "\"div\"", + "\"mod\"", + "\"and\"", + "\"shl\"", + "\"shr\"", + "\"not\"", + "\"true\"", + "\"false\"", + "AT", + "PLUSEQ", + "MINUSEQ", + "STAREQ", + "SLASHQE", + "\"goto\"", + "\"if\"", + "\"then\"", + "\"else\"", + "\"while\"", + "\"do\"", + "\"repeat\"", + "\"until\"", + "\"for\"", + "\"to\"", + "\"downto\"", + "\"with\"", + "LBRACK2", + "RBRACK2", + "\"operator\"", + "\"raise\"", + "\"try\"", + "\"except\"", + "\"finally\"", + "\"on\"", + "STRING_LITERAL", + "\"chr\"", + "\"nil\"", + "NUM_REAL", + "IDENT", + "\"absolute\"", + "\"as\"", + "\"asm\"", + "\"assembler\"", + "\"break\"", + "\"continue\"", + "\"dispose\"", + "\"exit\"", + "\"inherited\"", + "\"new\"", + "\"self\"", + "METHOD", + "ADDSUBOR", + "ASSIGNEQUAL", + "SIGN", + "FUNC", + "NODE_NOT_EMIT", + "MYASTVAR", + "LF", + "LCURLY", + "RCURLY", + "WS", + "COMMENT_1", + "COMMENT_2", + "COMMENT_3", + "EXPONENT", + 0 +}; + +const unsigned long PascalStoreWalker::_tokenSet_0_data_[] = { 262144UL, 172032UL, 0UL, 0UL, 0UL, 0UL }; +// ARGDECL "var" "procedure" "function" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalStoreWalker::_tokenSet_0(_tokenSet_0_data_,6); +const unsigned long PascalStoreWalker::_tokenSet_1_data_[] = { 512UL, 262144UL, 3641384976UL, 1UL, 0UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// SCALARTYPE "array" "integer" "boolean" "char" DOTDOT "real" "string" +// "packed" "record" "set" "file" POINTER IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalStoreWalker::_tokenSet_1(_tokenSet_1_data_,12); +const unsigned long PascalStoreWalker::_tokenSet_2_data_[] = { 0UL, 0UL, 8UL, 50331648UL, 2147483648UL, 13UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// NUM_INT PLUS MINUS STRING_LITERAL "chr" NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalStoreWalker::_tokenSet_2(_tokenSet_2_data_,12); +const unsigned long PascalStoreWalker::_tokenSet_3_data_[] = { 4194432UL, 2048UL, 1107296264UL, 4152229889UL, 2155872329UL, 15UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// FUNC_CALL DOT EQUAL NUM_INT LBRACK "set" POINTER LE GE LTH GT NOT_EQUAL +// "in" PLUS MINUS "or" STAR SLASH "div" "mod" "and" "not" AT LBRACK2 STRING_LITERAL +// "chr" "nil" NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalStoreWalker::_tokenSet_3(_tokenSet_3_data_,12); +const unsigned long PascalStoreWalker::_tokenSet_4_data_[] = { 4194432UL, 2048UL, 1107427336UL, 4152229889UL, 2155872329UL, 15UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// FUNC_CALL DOT EQUAL NUM_INT DOTDOT LBRACK "set" POINTER LE GE LTH GT +// NOT_EQUAL "in" PLUS MINUS "or" STAR SLASH "div" "mod" "and" "not" AT +// LBRACK2 STRING_LITERAL "chr" "nil" NUM_REAL IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalStoreWalker::_tokenSet_4(_tokenSet_4_data_,12); +const unsigned long PascalStoreWalker::_tokenSet_5_data_[] = { 272UL, 16384UL, 537133056UL, 0UL, 4888576UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// BLOCK PROC_CALL COLON ASSIGN "case" "goto" "if" "while" "repeat" "for" +// "with" +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalStoreWalker::_tokenSet_5(_tokenSet_5_data_,12); +const unsigned long PascalStoreWalker::_tokenSet_6_data_[] = { 4194304UL, 0UL, 33554432UL, 1UL, 8388672UL, 8UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// DOT LBRACK POINTER AT LBRACK2 IDENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PascalStoreWalker::_tokenSet_6(_tokenSet_6_data_,12); + + diff --git a/languages/pascal/PascalStoreWalker.hpp b/languages/pascal/PascalStoreWalker.hpp new file mode 100644 index 00000000..bc354743 --- /dev/null +++ b/languages/pascal/PascalStoreWalker.hpp @@ -0,0 +1,172 @@ +#ifndef INC_PascalStoreWalker_hpp_ +#define INC_PascalStoreWalker_hpp_ + +#line 20 "pascal.tree.g" + + #include + #include "PascalAST.hpp" + + #include + #include + #include + +#line 14 "PascalStoreWalker.hpp" +#include +#include "PascalStoreWalkerTokenTypes.hpp" +/* $ANTLR 2.7.7 (20061129): "pascal.tree.g" -> "PascalStoreWalker.hpp"$ */ +#include + +#line 29 "pascal.tree.g" + + #include + #include + +#line 25 "PascalStoreWalker.hpp" +class CUSTOM_API PascalStoreWalker : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public PascalStoreWalkerTokenTypes +{ +#line 47 "pascal.tree.g" + +private: + QString m_fileName; + QStringList m_currentScope; + int m_currentAccess; + int m_anon; + CodeModel* m_model; + +public: + void setCodeModel( CodeModel* model ) { m_model = model; } + CodeModel* codeModel() { return m_model; } + const CodeModel* codeModel() const { return m_model; } + + QString fileName() const { return m_fileName; } + void setFileName( const QString& fileName ) { m_fileName = fileName; } + + void init(){ + m_currentScope.clear(); + m_currentAccess = CodeModelItem::Public; + m_anon = 0; + } + + void wipeout() { m_model->wipeout(); } +#line 29 "PascalStoreWalker.hpp" +public: + PascalStoreWalker(); + static void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); + int getNumTokens() const + { + return PascalStoreWalker::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return PascalStoreWalker::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return PascalStoreWalker::tokenNames; + } + public: void program(RefPascalAST _t); + public: void programHeading(RefPascalAST _t); + public: void block(RefPascalAST _t); + public: void identifierList(RefPascalAST _t); + public: void identifier(RefPascalAST _t); + public: void labelDeclarationPart(RefPascalAST _t); + public: void constantDefinitionPart(RefPascalAST _t); + public: void typeDefinitionPart(RefPascalAST _t); + public: void variableDeclarationPart(RefPascalAST _t); + public: void procedureAndFunctionDeclarationPart(RefPascalAST _t); + public: void usesUnitsPart(RefPascalAST _t); + public: void compoundStatement(RefPascalAST _t); + public: void label(RefPascalAST _t); + public: void constantDefinition(RefPascalAST _t); + public: void constant(RefPascalAST _t); + public: void string(RefPascalAST _t); + public: void typeDefinition(RefPascalAST _t); + public: void type(RefPascalAST _t); + public: void formalParameterList(RefPascalAST _t); + public: void resultType(RefPascalAST _t); + public: void typeIdentifier(RefPascalAST _t); + public: void structuredType(RefPascalAST _t); + public: void unpackedStructuredType(RefPascalAST _t); + public: void arrayType(RefPascalAST _t); + public: void recordType(RefPascalAST _t); + public: void setType(RefPascalAST _t); + public: void fileType(RefPascalAST _t); + public: void typeList(RefPascalAST _t); + public: void fieldList(RefPascalAST _t); + public: void fixedPart(RefPascalAST _t); + public: void variantPart(RefPascalAST _t); + public: void recordSection(RefPascalAST _t); + public: void tag(RefPascalAST _t); + public: void variant(RefPascalAST _t); + public: void constList(RefPascalAST _t); + public: void variableDeclaration(RefPascalAST _t); + public: void procedureOrFunctionDeclaration(RefPascalAST _t); + public: void procedureDeclaration(RefPascalAST _t); + public: void functionDeclaration(RefPascalAST _t); + public: void formalParameterSection(RefPascalAST _t); + public: void parameterGroup(RefPascalAST _t); + public: void statement(RefPascalAST _t); + public: void unlabelledStatement(RefPascalAST _t); + public: void simpleStatement(RefPascalAST _t); + public: void structuredStatement(RefPascalAST _t); + public: void assignmentStatement(RefPascalAST _t); + public: void procedureStatement(RefPascalAST _t); + public: void gotoStatement(RefPascalAST _t); + public: void variable(RefPascalAST _t); + public: void expression(RefPascalAST _t); + public: void functionDesignator(RefPascalAST _t); + public: void set(RefPascalAST _t); + public: void parameterList(RefPascalAST _t); + public: void actualParameter(RefPascalAST _t); + public: void element(RefPascalAST _t); + public: void conditionalStatement(RefPascalAST _t); + public: void repetetiveStatement(RefPascalAST _t); + public: void withStatement(RefPascalAST _t); + public: void statements(RefPascalAST _t); + public: void ifStatement(RefPascalAST _t); + public: void caseStatement(RefPascalAST _t); + public: void caseListElement(RefPascalAST _t); + public: void whileStatement(RefPascalAST _t); + public: void repeatStatement(RefPascalAST _t); + public: void forStatement(RefPascalAST _t); + public: void forList(RefPascalAST _t); + public: void initialValue(RefPascalAST _t); + public: void finalValue(RefPascalAST _t); + public: void recordVariableList(RefPascalAST _t); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return ANTLR_USE_NAMESPACE(antlr)RefAST(returnAST); + } + +protected: + RefPascalAST returnAST; + RefPascalAST _retTree; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 190; +#else + enum { + NUM_TOKENS = 190 + }; +#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; +}; + +#endif /*INC_PascalStoreWalker_hpp_*/ diff --git a/languages/pascal/PascalStoreWalkerTokenTypes.hpp b/languages/pascal/PascalStoreWalkerTokenTypes.hpp new file mode 100644 index 00000000..0f4142f5 --- /dev/null +++ b/languages/pascal/PascalStoreWalkerTokenTypes.hpp @@ -0,0 +1,206 @@ +#ifndef INC_PascalStoreWalkerTokenTypes_hpp_ +#define INC_PascalStoreWalkerTokenTypes_hpp_ + +/* $ANTLR 2.7.7 (20061129): "pascal.tree.g" -> "PascalStoreWalkerTokenTypes.hpp"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API PascalStoreWalkerTokenTypes { +#endif + enum { + EOF_ = 1, + BLOCK = 4, + IDLIST = 5, + ELIST = 6, + FUNC_CALL = 7, + PROC_CALL = 8, + SCALARTYPE = 9, + TYPELIST = 10, + VARIANT_TAG = 11, + VARIANT_TAG_NO_ID = 12, + VARIANT_CASE = 13, + CONSTLIST = 14, + FIELDLIST = 15, + ARGDECLS = 16, + VARDECL = 17, + ARGDECL = 18, + ARGLIST = 19, + TYPEDECL = 20, + FIELD = 21, + DOT = 22, + LIBRARY = 23, + SEMI = 24, + END = 25, + EXPORTS = 26, + COMMA = 27, + LITERAL_index = 28, + LITERAL_name = 29, + USES = 30, + UNIT = 31, + INTERFACE = 32, + IMPLEMENTATION = 33, + BEGIN = 34, + PROGRAM = 35, + LPAREN = 36, + RPAREN = 37, + INITIALIZATION = 38, + FINALIZATION = 39, + LABEL = 40, + CONST = 41, + RESOURCESTRING = 42, + EQUAL = 43, + TYPE = 44, + VAR = 45, + COLON = 46, + PROCEDURE = 47, + FORWARD = 48, + FUNCTION = 49, + ARRAY = 50, + OF = 51, + EXTERNAL = 52, + PUBLIC = 53, + ALIAS = 54, + INTERRUPT = 55, + EXPORT = 56, + REGISTER = 57, + PASCAL = 58, + CDECL = 59, + STDCALL = 60, + POPSTACK = 61, + SAVEREGISTERS = 62, + INLINE = 63, + SAFECALL = 64, + NEAR = 65, + FAR = 66, + NUM_INT = 67, + INTEGER = 68, + SHORTINT = 69, + SMALLINT = 70, + LONGINT = 71, + INT64 = 72, + BYTE = 73, + WORD = 74, + CARDINAL = 75, + QWORD = 76, + BOOLEAN = 77, + BYTEBOOL = 78, + LONGBOOL = 79, + CHAR = 80, + DOTDOT = 81, + ASSIGN = 82, + REAL = 83, + SINGLE = 84, + DOUBLE = 85, + EXTENDED = 86, + COMP = 87, + STRING = 88, + LBRACK = 89, + RBRACK = 90, + PACKED = 91, + RECORD = 92, + CASE = 93, + SET = 94, + FILE = 95, + POINTER = 96, + OBJECT = 97, + VIRTUAL = 98, + ABSTRACT = 99, + PRIVATE = 100, + PROTECTED = 101, + CONSTRUCTOR = 102, + DESTRUCTOR = 103, + CLASS = 104, + OVERRIDE = 105, + MESSAGE = 106, + PUBLISHED = 107, + PROPERTY = 108, + LITERAL_read = 109, + LITERAL_write = 110, + DEFAULT = 111, + LITERAL_nodefault = 112, + LE = 113, + GE = 114, + LTH = 115, + GT = 116, + NOT_EQUAL = 117, + IN = 118, + IS = 119, + PLUS = 120, + MINUS = 121, + OR = 122, + XOR = 123, + STAR = 124, + SLASH = 125, + DIV = 126, + MOD = 127, + AND = 128, + SHL = 129, + SHR = 130, + NOT = 131, + TRUE = 132, + FALSE = 133, + AT = 134, + PLUSEQ = 135, + MINUSEQ = 136, + STAREQ = 137, + SLASHQE = 138, + GOTO = 139, + IF = 140, + THEN = 141, + ELSE = 142, + WHILE = 143, + DO = 144, + REPEAT = 145, + UNTIL = 146, + FOR = 147, + TO = 148, + DOWNTO = 149, + WITH = 150, + LBRACK2 = 151, + RBRACK2 = 152, + OPERATOR = 153, + RAISE = 154, + TRY = 155, + EXCEPT = 156, + FINALLY = 157, + ON = 158, + STRING_LITERAL = 159, + CHR = 160, + NIL = 161, + NUM_REAL = 162, + IDENT = 163, + ABSOLUTE = 164, + AS = 165, + ASM = 166, + ASSEMBLER = 167, + BREAK = 168, + CONTINUE = 169, + DISPOSE = 170, + EXIT = 171, + INHERITED = 172, + NEW = 173, + SELF = 174, + METHOD = 175, + ADDSUBOR = 176, + ASSIGNEQUAL = 177, + SIGN = 178, + FUNC = 179, + NODE_NOT_EMIT = 180, + MYASTVAR = 181, + LF = 182, + LCURLY = 183, + RCURLY = 184, + WS = 185, + COMMENT_1 = 186, + COMMENT_2 = 187, + COMMENT_3 = 188, + EXPONENT = 189, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_PascalStoreWalkerTokenTypes_hpp_*/ diff --git a/languages/pascal/PascalStoreWalkerTokenTypes.txt b/languages/pascal/PascalStoreWalkerTokenTypes.txt new file mode 100644 index 00000000..8d347fc1 --- /dev/null +++ b/languages/pascal/PascalStoreWalkerTokenTypes.txt @@ -0,0 +1,188 @@ +// $ANTLR 2.7.7 (20061129): pascal.tree.g -> PascalStoreWalkerTokenTypes.txt$ +PascalStoreWalker // output token vocab name +BLOCK=4 +IDLIST=5 +ELIST=6 +FUNC_CALL=7 +PROC_CALL=8 +SCALARTYPE=9 +TYPELIST=10 +VARIANT_TAG=11 +VARIANT_TAG_NO_ID=12 +VARIANT_CASE=13 +CONSTLIST=14 +FIELDLIST=15 +ARGDECLS=16 +VARDECL=17 +ARGDECL=18 +ARGLIST=19 +TYPEDECL=20 +FIELD=21 +DOT=22 +LIBRARY="library"=23 +SEMI=24 +END="end"=25 +EXPORTS="exports"=26 +COMMA=27 +LITERAL_index="index"=28 +LITERAL_name="name"=29 +USES="uses"=30 +UNIT="unit"=31 +INTERFACE="interface"=32 +IMPLEMENTATION="implementation"=33 +BEGIN="begin"=34 +PROGRAM="program"=35 +LPAREN=36 +RPAREN=37 +INITIALIZATION="initialization"=38 +FINALIZATION="finalization"=39 +LABEL="label"=40 +CONST="const"=41 +RESOURCESTRING="resourcestring"=42 +EQUAL=43 +TYPE="type"=44 +VAR="var"=45 +COLON=46 +PROCEDURE="procedure"=47 +FORWARD="forward"=48 +FUNCTION="function"=49 +ARRAY="array"=50 +OF="of"=51 +EXTERNAL="external"=52 +PUBLIC="public"=53 +ALIAS="alias"=54 +INTERRUPT=55 +EXPORT="export"=56 +REGISTER="register"=57 +PASCAL="pascal"=58 +CDECL="cdecl"=59 +STDCALL="stdcall"=60 +POPSTACK="popstack"=61 +SAVEREGISTERS="saveregisters"=62 +INLINE="inline"=63 +SAFECALL="safecall"=64 +NEAR="near"=65 +FAR="far"=66 +NUM_INT=67 +INTEGER="integer"=68 +SHORTINT="shortint"=69 +SMALLINT="smallint"=70 +LONGINT="longint"=71 +INT64="int64"=72 +BYTE="byte"=73 +WORD="word"=74 +CARDINAL="cardinal"=75 +QWORD="qword"=76 +BOOLEAN="boolean"=77 +BYTEBOOL=78 +LONGBOOL=79 +CHAR="char"=80 +DOTDOT=81 +ASSIGN=82 +REAL="real"=83 +SINGLE="single"=84 +DOUBLE="double"=85 +EXTENDED="extended"=86 +COMP="comp"=87 +STRING="string"=88 +LBRACK=89 +RBRACK=90 +PACKED="packed"=91 +RECORD="record"=92 +CASE="case"=93 +SET="set"=94 +FILE="file"=95 +POINTER=96 +OBJECT="object"=97 +VIRTUAL="virtual"=98 +ABSTRACT="abstract"=99 +PRIVATE="private"=100 +PROTECTED="protected"=101 +CONSTRUCTOR="constructor"=102 +DESTRUCTOR="destructor"=103 +CLASS="class"=104 +OVERRIDE="override"=105 +MESSAGE=106 +PUBLISHED="published"=107 +PROPERTY="property"=108 +LITERAL_read="read"=109 +LITERAL_write="write"=110 +DEFAULT="default"=111 +LITERAL_nodefault="nodefault"=112 +LE=113 +GE=114 +LTH=115 +GT=116 +NOT_EQUAL=117 +IN="in"=118 +IS="is"=119 +PLUS=120 +MINUS=121 +OR="or"=122 +XOR="xor"=123 +STAR=124 +SLASH=125 +DIV="div"=126 +MOD="mod"=127 +AND="and"=128 +SHL="shl"=129 +SHR="shr"=130 +NOT="not"=131 +TRUE="true"=132 +FALSE="false"=133 +AT=134 +PLUSEQ=135 +MINUSEQ=136 +STAREQ=137 +SLASHQE=138 +GOTO="goto"=139 +IF="if"=140 +THEN="then"=141 +ELSE="else"=142 +WHILE="while"=143 +DO="do"=144 +REPEAT="repeat"=145 +UNTIL="until"=146 +FOR="for"=147 +TO="to"=148 +DOWNTO="downto"=149 +WITH="with"=150 +LBRACK2=151 +RBRACK2=152 +OPERATOR="operator"=153 +RAISE="raise"=154 +TRY="try"=155 +EXCEPT="except"=156 +FINALLY="finally"=157 +ON="on"=158 +STRING_LITERAL=159 +CHR="chr"=160 +NIL="nil"=161 +NUM_REAL=162 +IDENT=163 +ABSOLUTE="absolute"=164 +AS="as"=165 +ASM="asm"=166 +ASSEMBLER="assembler"=167 +BREAK="break"=168 +CONTINUE="continue"=169 +DISPOSE="dispose"=170 +EXIT="exit"=171 +INHERITED="inherited"=172 +NEW="new"=173 +SELF="self"=174 +METHOD=175 +ADDSUBOR=176 +ASSIGNEQUAL=177 +SIGN=178 +FUNC=179 +NODE_NOT_EMIT=180 +MYASTVAR=181 +LF=182 +LCURLY=183 +RCURLY=184 +WS=185 +COMMENT_1=186 +COMMENT_2=187 +COMMENT_3=188 +EXPONENT=189 diff --git a/languages/pascal/PascalTokenTypes.hpp b/languages/pascal/PascalTokenTypes.hpp new file mode 100644 index 00000000..3e613221 --- /dev/null +++ b/languages/pascal/PascalTokenTypes.hpp @@ -0,0 +1,206 @@ +#ifndef INC_PascalTokenTypes_hpp_ +#define INC_PascalTokenTypes_hpp_ + +/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalTokenTypes.hpp"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API PascalTokenTypes { +#endif + enum { + EOF_ = 1, + BLOCK = 4, + IDLIST = 5, + ELIST = 6, + FUNC_CALL = 7, + PROC_CALL = 8, + SCALARTYPE = 9, + TYPELIST = 10, + VARIANT_TAG = 11, + VARIANT_TAG_NO_ID = 12, + VARIANT_CASE = 13, + CONSTLIST = 14, + FIELDLIST = 15, + ARGDECLS = 16, + VARDECL = 17, + ARGDECL = 18, + ARGLIST = 19, + TYPEDECL = 20, + FIELD = 21, + DOT = 22, + LIBRARY = 23, + SEMI = 24, + END = 25, + EXPORTS = 26, + COMMA = 27, + LITERAL_index = 28, + LITERAL_name = 29, + USES = 30, + UNIT = 31, + INTERFACE = 32, + IMPLEMENTATION = 33, + BEGIN = 34, + PROGRAM = 35, + LPAREN = 36, + RPAREN = 37, + INITIALIZATION = 38, + FINALIZATION = 39, + LABEL = 40, + CONST = 41, + RESOURCESTRING = 42, + EQUAL = 43, + TYPE = 44, + VAR = 45, + COLON = 46, + PROCEDURE = 47, + FORWARD = 48, + FUNCTION = 49, + ARRAY = 50, + OF = 51, + EXTERNAL = 52, + PUBLIC = 53, + ALIAS = 54, + INTERRUPT = 55, + EXPORT = 56, + REGISTER = 57, + PASCAL = 58, + CDECL = 59, + STDCALL = 60, + POPSTACK = 61, + SAVEREGISTERS = 62, + INLINE = 63, + SAFECALL = 64, + NEAR = 65, + FAR = 66, + NUM_INT = 67, + INTEGER = 68, + SHORTINT = 69, + SMALLINT = 70, + LONGINT = 71, + INT64 = 72, + BYTE = 73, + WORD = 74, + CARDINAL = 75, + QWORD = 76, + BOOLEAN = 77, + BYTEBOOL = 78, + LONGBOOL = 79, + CHAR = 80, + DOTDOT = 81, + ASSIGN = 82, + REAL = 83, + SINGLE = 84, + DOUBLE = 85, + EXTENDED = 86, + COMP = 87, + STRING = 88, + LBRACK = 89, + RBRACK = 90, + PACKED = 91, + RECORD = 92, + CASE = 93, + SET = 94, + FILE = 95, + POINTER = 96, + OBJECT = 97, + VIRTUAL = 98, + ABSTRACT = 99, + PRIVATE = 100, + PROTECTED = 101, + CONSTRUCTOR = 102, + DESTRUCTOR = 103, + CLASS = 104, + OVERRIDE = 105, + MESSAGE = 106, + PUBLISHED = 107, + PROPERTY = 108, + LITERAL_read = 109, + LITERAL_write = 110, + DEFAULT = 111, + LITERAL_nodefault = 112, + LE = 113, + GE = 114, + LTH = 115, + GT = 116, + NOT_EQUAL = 117, + IN = 118, + IS = 119, + PLUS = 120, + MINUS = 121, + OR = 122, + XOR = 123, + STAR = 124, + SLASH = 125, + DIV = 126, + MOD = 127, + AND = 128, + SHL = 129, + SHR = 130, + NOT = 131, + TRUE = 132, + FALSE = 133, + AT = 134, + PLUSEQ = 135, + MINUSEQ = 136, + STAREQ = 137, + SLASHQE = 138, + GOTO = 139, + IF = 140, + THEN = 141, + ELSE = 142, + WHILE = 143, + DO = 144, + REPEAT = 145, + UNTIL = 146, + FOR = 147, + TO = 148, + DOWNTO = 149, + WITH = 150, + LBRACK2 = 151, + RBRACK2 = 152, + OPERATOR = 153, + RAISE = 154, + TRY = 155, + EXCEPT = 156, + FINALLY = 157, + ON = 158, + STRING_LITERAL = 159, + CHR = 160, + NIL = 161, + NUM_REAL = 162, + IDENT = 163, + ABSOLUTE = 164, + AS = 165, + ASM = 166, + ASSEMBLER = 167, + BREAK = 168, + CONTINUE = 169, + DISPOSE = 170, + EXIT = 171, + INHERITED = 172, + NEW = 173, + SELF = 174, + METHOD = 175, + ADDSUBOR = 176, + ASSIGNEQUAL = 177, + SIGN = 178, + FUNC = 179, + NODE_NOT_EMIT = 180, + MYASTVAR = 181, + LF = 182, + LCURLY = 183, + RCURLY = 184, + WS = 185, + COMMENT_1 = 186, + COMMENT_2 = 187, + COMMENT_3 = 188, + EXPONENT = 189, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_PascalTokenTypes_hpp_*/ diff --git a/languages/pascal/PascalTokenTypes.txt b/languages/pascal/PascalTokenTypes.txt new file mode 100644 index 00000000..063a729a --- /dev/null +++ b/languages/pascal/PascalTokenTypes.txt @@ -0,0 +1,188 @@ +// $ANTLR 2.7.7 (20061129): pascal.g -> PascalTokenTypes.txt$ +Pascal // output token vocab name +BLOCK=4 +IDLIST=5 +ELIST=6 +FUNC_CALL=7 +PROC_CALL=8 +SCALARTYPE=9 +TYPELIST=10 +VARIANT_TAG=11 +VARIANT_TAG_NO_ID=12 +VARIANT_CASE=13 +CONSTLIST=14 +FIELDLIST=15 +ARGDECLS=16 +VARDECL=17 +ARGDECL=18 +ARGLIST=19 +TYPEDECL=20 +FIELD=21 +DOT=22 +LIBRARY="library"=23 +SEMI=24 +END="end"=25 +EXPORTS="exports"=26 +COMMA=27 +LITERAL_index="index"=28 +LITERAL_name="name"=29 +USES="uses"=30 +UNIT="unit"=31 +INTERFACE="interface"=32 +IMPLEMENTATION="implementation"=33 +BEGIN="begin"=34 +PROGRAM="program"=35 +LPAREN=36 +RPAREN=37 +INITIALIZATION="initialization"=38 +FINALIZATION="finalization"=39 +LABEL="label"=40 +CONST="const"=41 +RESOURCESTRING="resourcestring"=42 +EQUAL=43 +TYPE="type"=44 +VAR="var"=45 +COLON=46 +PROCEDURE="procedure"=47 +FORWARD="forward"=48 +FUNCTION="function"=49 +ARRAY="array"=50 +OF="of"=51 +EXTERNAL="external"=52 +PUBLIC="public"=53 +ALIAS="alias"=54 +INTERRUPT=55 +EXPORT="export"=56 +REGISTER="register"=57 +PASCAL="pascal"=58 +CDECL="cdecl"=59 +STDCALL="stdcall"=60 +POPSTACK="popstack"=61 +SAVEREGISTERS="saveregisters"=62 +INLINE="inline"=63 +SAFECALL="safecall"=64 +NEAR="near"=65 +FAR="far"=66 +NUM_INT=67 +INTEGER="integer"=68 +SHORTINT="shortint"=69 +SMALLINT="smallint"=70 +LONGINT="longint"=71 +INT64="int64"=72 +BYTE="byte"=73 +WORD="word"=74 +CARDINAL="cardinal"=75 +QWORD="qword"=76 +BOOLEAN="boolean"=77 +BYTEBOOL=78 +LONGBOOL=79 +CHAR="char"=80 +DOTDOT=81 +ASSIGN=82 +REAL="real"=83 +SINGLE="single"=84 +DOUBLE="double"=85 +EXTENDED="extended"=86 +COMP="comp"=87 +STRING="string"=88 +LBRACK=89 +RBRACK=90 +PACKED="packed"=91 +RECORD="record"=92 +CASE="case"=93 +SET="set"=94 +FILE="file"=95 +POINTER=96 +OBJECT="object"=97 +VIRTUAL="virtual"=98 +ABSTRACT="abstract"=99 +PRIVATE="private"=100 +PROTECTED="protected"=101 +CONSTRUCTOR="constructor"=102 +DESTRUCTOR="destructor"=103 +CLASS="class"=104 +OVERRIDE="override"=105 +MESSAGE=106 +PUBLISHED="published"=107 +PROPERTY="property"=108 +LITERAL_read="read"=109 +LITERAL_write="write"=110 +DEFAULT="default"=111 +LITERAL_nodefault="nodefault"=112 +LE=113 +GE=114 +LTH=115 +GT=116 +NOT_EQUAL=117 +IN="in"=118 +IS="is"=119 +PLUS=120 +MINUS=121 +OR="or"=122 +XOR="xor"=123 +STAR=124 +SLASH=125 +DIV="div"=126 +MOD="mod"=127 +AND="and"=128 +SHL="shl"=129 +SHR="shr"=130 +NOT="not"=131 +TRUE="true"=132 +FALSE="false"=133 +AT=134 +PLUSEQ=135 +MINUSEQ=136 +STAREQ=137 +SLASHQE=138 +GOTO="goto"=139 +IF="if"=140 +THEN="then"=141 +ELSE="else"=142 +WHILE="while"=143 +DO="do"=144 +REPEAT="repeat"=145 +UNTIL="until"=146 +FOR="for"=147 +TO="to"=148 +DOWNTO="downto"=149 +WITH="with"=150 +LBRACK2=151 +RBRACK2=152 +OPERATOR="operator"=153 +RAISE="raise"=154 +TRY="try"=155 +EXCEPT="except"=156 +FINALLY="finally"=157 +ON="on"=158 +STRING_LITERAL=159 +CHR="chr"=160 +NIL="nil"=161 +NUM_REAL=162 +IDENT=163 +ABSOLUTE="absolute"=164 +AS="as"=165 +ASM="asm"=166 +ASSEMBLER="assembler"=167 +BREAK="break"=168 +CONTINUE="continue"=169 +DISPOSE="dispose"=170 +EXIT="exit"=171 +INHERITED="inherited"=172 +NEW="new"=173 +SELF="self"=174 +METHOD=175 +ADDSUBOR=176 +ASSIGNEQUAL=177 +SIGN=178 +FUNC=179 +NODE_NOT_EMIT=180 +MYASTVAR=181 +LF=182 +LCURLY=183 +RCURLY=184 +WS=185 +COMMENT_1=186 +COMMENT_2=187 +COMMENT_3=188 +EXPONENT=189 diff --git a/languages/pascal/README.dox b/languages/pascal/README.dox new file mode 100644 index 00000000..52ef50b1 --- /dev/null +++ b/languages/pascal/README.dox @@ -0,0 +1,26 @@ +/** \class PascalSupportPart +This is Pascal language support plugin. + +Pascal support provides good fpc and dcc compiler support by compiler plugins. +Nearly all command line switches for those compilers can be configured in Project Options. +Language parser exists but it isn't perfect yet. + +In order to generate the parser by hand, antlr v2.7.2 is required. +There are parser compilation errors with some gcc versions. To avoid +them, replace file antlr/CppCodeGenerator.java in the antlr source code tree +with the one from ftp://fara.cs.uni-potsdam.de/incoming/CppCodeGenerar.java.gz. + +\authors Alexander Dymo + +\maintainer Alexander Dymo + +\feature Pascal language support +\feature Consult \ref LangSupportStatus for a up to date features/status of this programming language support part. + +\bug Language parser can sometimes treat correct lines as errors. Please send sample code to maintainer if you have this problem. + +\faq Why KDevelop does not provide GNU pascal compiler plugin? If you need GNU pascal compiler plugin, please write about it to maintainer and prepare to help testing it. +\faq Compiler plugin lacks option X. Write about it to maintaner or send a patch. Adding compiler options is easy task. Just look at languages/pascal/compiler directory. + + +*/ diff --git a/languages/pascal/app_templates/Makefile.am b/languages/pascal/app_templates/Makefile.am new file mode 100644 index 00000000..9fd47804 --- /dev/null +++ b/languages/pascal/app_templates/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = pascalhello fpcgtk fpchello fpcsharedlib +profilesdir = $(kde_datadir)/kdevelop/profiles/IDE/CompiledLanguageIDE/PascalIDE +profiles_DATA = pascal.appwizard diff --git a/languages/pascal/app_templates/fpcgtk/.kdev_ignore b/languages/pascal/app_templates/fpcgtk/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/pascal/app_templates/fpcgtk/Makefile.am b/languages/pascal/app_templates/fpcgtk/Makefile.am new file mode 100644 index 00000000..252cbf27 --- /dev/null +++ b/languages/pascal/app_templates/fpcgtk/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = main.pp app.kdevelop +templateName = fpcgtk + +### 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/pascal/app_templates/fpcgtk/app.kdevelop b/languages/pascal/app_templates/fpcgtk/app.kdevelop new file mode 100644 index 00000000..995d340b --- /dev/null +++ b/languages/pascal/app_templates/fpcgtk/app.kdevelop @@ -0,0 +1,86 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevPascalProject + Pascal + + Pascal + Code + + + + + default + + + + src/%{APPNAMELC}.pp + kdevfpcoptions + -vr + fpc + + + + false + + + + + ada + ada_bugs_gcc + bash + bash_bugs + c++_bugs_gcc + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libc + libstdc++ + opengl + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + diff --git a/languages/pascal/app_templates/fpcgtk/fpcgtk b/languages/pascal/app_templates/fpcgtk/fpcgtk new file mode 100644 index 00000000..374f1bc9 --- /dev/null +++ b/languages/pascal/app_templates/fpcgtk/fpcgtk @@ -0,0 +1,9 @@ +# KDE Config File +[General] +Name=GTK+ application +Name[fr]=Une application GTK+ +Category=Pascal/Free Pascal +Comment=Generates a GTK+ based GUI application in Pascal +Comment[fr]=Génère une application basée sur la bibliothéque GTK+ dans le language PASCAL. +FileTemplates=pp-program,PStyle,pp-unit,PStyle +ShowFilesAfterGeneration=src/APPNAMELC.pp diff --git a/languages/pascal/app_templates/fpcgtk/fpcgtk.kdevtemplate b/languages/pascal/app_templates/fpcgtk/fpcgtk.kdevtemplate new file mode 100644 index 00000000..56696aa1 --- /dev/null +++ b/languages/pascal/app_templates/fpcgtk/fpcgtk.kdevtemplate @@ -0,0 +1,114 @@ +# KDE Config File +[General] +Name=GTK+ application +Name[ca]=Aplicació GTK+ +Name[da]=GTK+ program +Name[de]=GTK+-Anwendung +Name[el]=ΕφαÏμογή GTK+ +Name[es]=Aplicación GTK+ +Name[et]=GTK+ rakendus +Name[eu]=GTK+ aplikazioa +Name[fa]=کاربرد GTK+ +Name[fr]=Application GTK+ +Name[ga]=Feidhmchlár GTK+ +Name[gl]=Aplicación GTK+ +Name[hu]=GTK+-alapú alkalmazás +Name[it]=Applicazione GTK+ +Name[ja]=GTK+ アプリケーション +Name[nds]=GTK+-Programm +Name[ne]=GTK+ अनà¥à¤ªà¥à¤°à¤¯à¥‹à¤— +Name[nl]=GTK+-toepassing +Name[pl]=Program GTK+ +Name[pt]=Aplicação do GTK+ +Name[pt_BR]=Aplicativo GTK+ +Name[ru]=Приложение GTK+ +Name[sk]=GTK+ aplikácia +Name[sr]=GTK+ програм +Name[sr@Latn]=GTK+ program +Name[sv]=GTK+ program +Name[tr]=GTK+ Uygulaması +Name[zh_CN]=GTK+ åº”ç”¨ç¨‹åº +Name[zh_TW]=GTK+ æ‡‰ç”¨ç¨‹å¼ +Category=Pascal/Free Pascal +Comment=Generates a GTK+ based GUI application in Pascal +Comment[ca]=Genera una aplicació IGU en Pascal basada en GTK+ +Comment[da]=Genererer et GTK+ baseret GUI program i Pascal +Comment[de]=Erstellt eine auf GTK+ basierende GUI-Anwendung in Pascal +Comment[el]=ΔημιουÏγεί μια γÏαφική εφαÏμογή βασισμένη στο GTK+ σε Pascal +Comment[es]=Genera una aplicación gráfica en Pascal basada en GTK+ +Comment[et]=Graafilise rakenduse loomine GTK+ põhjal Pascalis +Comment[eu]=GTK+-en oinarritutako GUI aplikazio bat sortzen du Pascal-en +Comment[fa]=یک کاربرد ونک بر مبنای GTK+ در پاسکال تولید می‌کند +Comment[fr]=Génère une application avec interface graphique basée sur GTK+ en Pascal +Comment[ga]=Cruthaigh feidhmchlár grafach i Pascal, bunaithe ar GTK+ +Comment[gl]=Xera unha aplicación GUI baseada en GTK+ en Pascal +Comment[hu]=Létrehoz egy GTK+-alapú grafikus felületű alkalmazást Pascalban +Comment[it]=Genera un'applicazione GUI basata su GTK+ in Pascal +Comment[ja]=GTK+ ベース㮠GUI アプリケーションを Pascal ã§ä½œæˆã—ã¾ã™ +Comment[nds]=Stellt en op GTK+ opbuut Böversietprogramm in Pascal op +Comment[ne]= GTK+ आधारित जी यू आई अनà¥à¤ªà¥à¤°à¤¯à¥‹à¤—लाई पासà¥à¤•à¤²à¤®à¤¾ उतà¥à¤ªà¤¨à¥à¤¨ गरà¥à¤¦à¤› +Comment[nl]=Genereert een GKT+-gebaseerde GUI-toepassing in Pascal +Comment[pl]=Generuje program z graficznym interfejsem użytkownika używajÄ…cy GTK+ w Pascalu +Comment[pt]=Gera uma aplicação gráfica, baseada em GTK+, em Pascal +Comment[pt_BR]=Gera uma aplicação gráfica, baseada em GTK+, em Pascal +Comment[ru]=Создание Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ GTK+ на Pascal +Comment[sk]=Vygeneruje GTK+ GUI aplikáciu v Pascal +Comment[sr]=Прави GUI програм на оÑнову GTK+ у Pascal-у +Comment[sr@Latn]=Pravi GUI program na osnovu GTK+ u Pascal-u +Comment[sv]=Skapar ett GTK+ baserat program med grafiskt användargränssnitt i Pascal +Comment[zh_CN]=生æˆä¸€ä¸ª Pascal 语言的 GTK+ GUI åº”ç”¨ç¨‹åº +Comment[zh_TW]=產生一個 Pascal 語言,以GTK+ 為基礎的使用者介é¢æ‡‰ç”¨ç¨‹å¼ +FileTemplates=pp-program,PStyle,pp-unit,PStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.pp +Archive=fpcgtk.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE2] +Type=install +Source=%{src}/main.pp +Dest=%{dest}/src/%{APPNAMELC}.pp + +[MSG] +Type=message +Comment=A GTK+ application written in pascal was created in %{dest} +Comment[ca]=Una aplicació GTK+ escrita en Pascal ha estat creada en %{dest} +Comment[da]=Et GTK+ program skrevet i pascal blev oprettet i %{dest} +Comment[de]=Eine in Pascal geschriebene GTK+-Anwendung wurde in %{dest} erstellt. +Comment[el]=Μια εφαÏμογή GTK+ γÏαμμένη σε pascal δημιουÏγήθηκε στο %{dest} +Comment[es]=Una aplicación GTK+ escrita en Pascal ha sido creada en %{dest} +Comment[et]=GTK+ rakendus Pascalis loodi asukohta %{dest} +Comment[eu]=Pascal-en idatzitako GTK+ aplikazio bat sortu da hemen: %{dest} +Comment[fa]=یک کاربرد GTK+ نوشته‌شده در پاسکال در %{dest} ایجاد شد +Comment[fr]=Une application GTK+ écrite en Pascal a été créée dans %{dest} +Comment[ga]=Cruthaíodh feidhmchlár GTK+, scríofa i pascal, i %{dest} +Comment[gl]=Creouse unha aplicación GTK+ escrita en pascal en %{dest} +Comment[hu]=Létrejött egy egyszerű, Pascal nyelvű, GTK+-alapú alkalmazás itt: %{dest} +Comment[it]=È stata creata un'applicazione GTK+ scritta in Pascal in %{dest} +Comment[ja]=Pascal ã§æ›¸ã‹ã‚ŒãŸ GTK+ アプリケーションを %{dest} ã«ä½œæˆã—ã¾ã—㟠+Comment[nds]=In %{dest} wöör en Pascal-Programm för GTK+ opstellt +Comment[ne]=पासà¥à¤•à¤²à¤®à¤¾ लेखिà¤à¤•à¥‹ GTK+ अनà¥à¤ªà¥à¤°à¤¯à¥‹à¤— %{dest} मा सिरà¥à¤œà¤¨à¤¾ गरियो +Comment[nl]=Een GTK+-toepassing geschreven in Pascal is aangemaakt in %{dest} +Comment[pl]=Program GTK+ napisany w Pascalu zostaÅ‚ utworzony w %{dest} +Comment[pt]=Foi criada uma aplicação GTK+, escrita em Pascal, em %{dest} +Comment[pt_BR]=Foi criada uma aplicação GTK+, escrita em Pascal, em %{dest} +Comment[ru]=Приложение GTK+ на Pascal Ñоздано в %{dest} +Comment[sk]=GTK+ aplikácia v Pascal bola vytvorená v %{dest} +Comment[sr]=GTK+ програм у Pascal-у направљен је у %{dest} +Comment[sr@Latn]=GTK+ program u Pascal-u napravljen je u %{dest} +Comment[sv]=Ett GTK+ program skrivet i Pascal skapades i %{dest} +Comment[tr]=Pascal'da yazılmış bir GTK+ uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了 Pascal 语言的 GTK+ åº”ç”¨ç¨‹åº +Comment[zh_TW]=一個 Pascal çš„ GTK+ 應用程å¼å·²å»ºç«‹æ–¼ %{dest} diff --git a/languages/pascal/app_templates/fpcgtk/fpcgtk.png b/languages/pascal/app_templates/fpcgtk/fpcgtk.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/pascal/app_templates/fpcgtk/fpcgtk.png differ diff --git a/languages/pascal/app_templates/fpcgtk/main.pp b/languages/pascal/app_templates/fpcgtk/main.pp new file mode 100644 index 00000000..4ac4a3b4 --- /dev/null +++ b/languages/pascal/app_templates/fpcgtk/main.pp @@ -0,0 +1,84 @@ +program %{APPNAMELC}; + +{$mode objfpc} + +uses + glib,gdk,gtk; + +procedure hello(widget : pGtkWidget ; data: pgpointer ); cdecl; +begin + writeln('Hello World'); +end; + +function delete_event (widget : pGtkWidget ; event: pGdkEvent; data: pgpointer ): integer; cdecl; +begin + writeln('Delete Event Occurred'); + delete_event := ord(true); +end; + +procedure destroy(widget : pGtkWidget ; data: pgpointer ); cdecl; +begin + gtk_main_quit(); +end; + +var + window, button : pGtkWidget;//GtkWidget is the storage type for widgets + + +begin + // This is called in all GTK applications. Arguments are parsed + // from the command line and are returned to the application. + gtk_init (@argc, @argv); + + // create a new window + window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + + // When the window is given the "delete_event" signal (this is given + // by the window manager, usually by the 'close' option, or on the + // titlebar), we ask it to call the delete_event () function + // as defined above. The data passed to the callback + // function is NULL and is ignored in the callback function. + gtk_signal_connect (pGTKOBJECT (window), 'delete_event', + GTK_SIGNAL_FUNC (@delete_event), NIL); + + + // Here we connect the "destroy" event to a signal handler. + // This event occurs when we call gtk_widget_destroy() on the window, + // or if we return 'FALSE' in the "delete_event" callback. + gtk_signal_connect (pGTKOBJECT (window), 'destroy', + GTK_SIGNAL_FUNC (@destroy), NULL); + + // Sets the border width of the window. + gtk_container_set_border_width (GTK_CONTAINER (window), 10); + + // Creates a new button with the label "Hello World". + button := gtk_button_new_with_label ('Hello_World'); + + // When the button receives the "clicked" signal, it will call the + // function hello() passing it NULL as its argument. The hello() + // function is defined above. */ + gtk_signal_connect (pGTKOBJECT (button), 'clicked', + GTK_SIGNAL_FUNC (@hello), NULL); + + // This will cause the window to be destroyed by calling + // gtk_widget_destroy(window) when "clicked". Again, the destroy + // signal could come from here, or the window manager + gtk_signal_connect_object (pGTKOBJECT (button), 'clicked', + GTK_SIGNAL_FUNC (@gtk_widget_destroy), + pGTKOBJECT(window)); + + // This packs the button into the window (a gtk container). + gtk_container_add (GTK_CONTAINER (window), button); + + // The final step is to display this newly created widget. + gtk_widget_show (button); + + // and the window + gtk_widget_show (window); + + // All GTK applications must have a gtk_main(). Control ends here + // and waits for an event to occur (like a key press or + // mouse event). + gtk_main (); + +end. diff --git a/languages/pascal/app_templates/fpchello/.kdev_ignore b/languages/pascal/app_templates/fpchello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/pascal/app_templates/fpchello/Makefile.am b/languages/pascal/app_templates/fpchello/Makefile.am new file mode 100644 index 00000000..e09141dc --- /dev/null +++ b/languages/pascal/app_templates/fpchello/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = main.pp app.kdevelop +templateName = fpchello + +### 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/pascal/app_templates/fpchello/app.kdevelop b/languages/pascal/app_templates/fpchello/app.kdevelop new file mode 100644 index 00000000..f0a07582 --- /dev/null +++ b/languages/pascal/app_templates/fpchello/app.kdevelop @@ -0,0 +1,86 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevPascalProject + Pascal + + Pascal + Code + + + + + default + + + + src/%{APPNAMELC}.pp + kdevfpcoptions + -vr + fpc + + + + true + + + + + ada + ada_bugs_gcc + bash + bash_bugs + c++_bugs_gcc + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libc + libstdc++ + opengl + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + diff --git a/languages/pascal/app_templates/fpchello/fpchello b/languages/pascal/app_templates/fpchello/fpchello new file mode 100644 index 00000000..b5a0acbf --- /dev/null +++ b/languages/pascal/app_templates/fpchello/fpchello @@ -0,0 +1,9 @@ +# KDE Config File +[General] +Name=Simple program +Name[fr]=Un simple programme de test +Category=Pascal/Free Pascal +Comment=Generates a simple program in Pascal +Comment[fr]=Génère un simple programme de test dans le language PASCAL. +FileTemplates=pp-program,PStyle,pp-unit,PStyle +ShowFilesAfterGeneration=src/APPNAMELC.pp diff --git a/languages/pascal/app_templates/fpchello/fpchello.kdevtemplate b/languages/pascal/app_templates/fpchello/fpchello.kdevtemplate new file mode 100644 index 00000000..44fa8bc1 --- /dev/null +++ b/languages/pascal/app_templates/fpchello/fpchello.kdevtemplate @@ -0,0 +1,115 @@ +# KDE Config File +[General] +Name=Simple program +Name[ca]=Simple programa +Name[da]=Simpelt program +Name[de]=Einfaches Programm +Name[el]=Απλό Ï€ÏόγÏαμμα +Name[es]=Programa sencillo +Name[et]=Lihtne programm +Name[eu]=Programa sinplea +Name[fa]=برنامۀ ساده +Name[fr]=Programme simple +Name[ga]=Ríomhchlár simplí +Name[gl]=Programa sinxelo +Name[hu]=Egyszerű program +Name[it]=Semplice programma +Name[ja]=ç°¡å˜ãªãƒ—ログラム +Name[nds]=Eenfach Programm +Name[ne]=साधारण कारà¥à¤¯à¤•à¥à¤°à¤® +Name[nl]=Eenvoudig programma +Name[pl]=Prosty program +Name[pt]=Programa simples +Name[pt_BR]=Programa simples +Name[ru]=ПроÑтое приложение +Name[sk]=Jednoduchý prohram +Name[sr]=ЈедноÑтаван програм +Name[sr@Latn]=Jednostavan program +Name[sv]=Enkelt program +Name[tr]=Basit program +Name[zh_CN]=简å•ç¨‹åº +Name[zh_TW]=ç°¡å–®ç¨‹å¼ +Category=Pascal/Free Pascal +Comment=Generates a simple program in Pascal +Comment[ca]=Genera un simple programa en Pascal +Comment[da]=Genererer et simpelt program i Pascal +Comment[de]=Erstellt ein einfaches Programm in Pascal +Comment[el]=ΔημιουÏγεί ένα απλό Ï€ÏόγÏαμμα σε Pascal +Comment[es]=Genera un sencillo programa en Pascal +Comment[et]=Lihtsa programmi loomine Pascalis +Comment[eu]=Pascal-en idatzitako programa sinple bat +Comment[fa]=یک برنامۀ ساده در پاسکال تولید می‌کند +Comment[fr]=Génère un programme simple en Pascal +Comment[ga]=Cruthaíonn sé seo ríomhchlár simplí i Pascal +Comment[gl]=Xera un programa sinxelo en Pascal +Comment[hu]=Létrehoz egy egyszerű programot Pascalban +Comment[it]=Genera un semplice programma in Pascal +Comment[ja]=ç°¡å˜ãªãƒ—ログラムを Pascal ã§ä½œæˆã—ã¾ã™ +Comment[nds]=Stellt en eenfach Pascal-Programm op +Comment[ne]=पासà¥à¤•à¤²à¤®à¤¾ साधारण कारà¥à¤¯à¤•à¥à¤°à¤® उतà¥à¤ªà¤¨à¥à¤¨ गरà¥à¤¦à¤› +Comment[nl]=Genereert een eenvoudig programma in Pascal +Comment[pl]=Generuje prosty program w Pascalu +Comment[pt]=Gera um programa simples em Pascal +Comment[pt_BR]=Gera um programa simples em Pascal +Comment[ru]=Создание проÑтого Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð½Ð° Pascal +Comment[sk]=Vygeneruje jednoduchý program v Pascal +Comment[sr]=Прави једноÑтаван програм у Pascal-у +Comment[sr@Latn]=Pravi jednostavan program u Pascal-u +Comment[sv]=Skapar ett enkelt program i Pascal +Comment[tr]=Pascal'da basit bir program yaratır +Comment[zh_CN]=生æˆä¸€ä¸ªç®€å•çš„ Pascal è¯­è¨€ç¨‹åº +Comment[zh_TW]=產生一個 Pascal çš„ç°¡å–®ç¨‹å¼ +FileTemplates=pp-program,PStyle,pp-unit,PStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.pp +Archive=fpchello.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE2] +Type=install +Source=%{src}/main.pp +Dest=%{dest}/src/%{APPNAMELC}.pp + +[MSG] +Type=message +Comment=A simple pascal program was created in %{dest} +Comment[ca]=Un simple programa en Pascal ha estat creat en %{dest} +Comment[da]=Et simpelt pascal program blev oprettet i %{dest} +Comment[de]=Ein einfaches Programm in Pascal wurde in %{dest} erstellt. +Comment[el]=Ένα απλό Ï€ÏόγÏαμμα pascal δημιουÏγήθηκε στο %{dest} +Comment[es]=Un sencillo programa en Pascal ha sido creado en %{dest} +Comment[et]=Lihtne Pascali programm loodi asukohta %{dest} +Comment[eu]=Pascal-en oinarritutako programa sinple bat sortu da hemen: %{dest} +Comment[fa]=یک برنامۀ سادۀ پاسکال در %{dest} ایجاد شد +Comment[fr]=Un programme Pascal simple a été créé dans %{dest} +Comment[ga]=Cruthaíodh ríomhchlár simplí pascal i %{dest} +Comment[gl]=Creouse un programa sinxelo en pascal en %{dest} +Comment[hu]=Létrejött egy egyszerű Pascal-program itt: %{dest} +Comment[it]=È stato creato un semplice programma Pascal in %{dest} +Comment[ja]=ç°¡å˜ãª Pascal プログラムを %{dest} ã«ä½œæˆã—ã¾ã—㟠+Comment[nds]=In %{dest} wöör en eenfach Pascal-Programm opstellt +Comment[ne]=साधारण पासà¥à¤•à¤² कारà¥à¤¯à¤•à¥à¤°à¤® %{dest} मा सिरà¥à¤œà¤¨à¤¾ गरियो +Comment[nl]=Een eenvoudig Pascal-programma is aangemaakt in %{dest} +Comment[pl]=Prosty program w Pascalu zostaÅ‚ utworzony w %{dest} +Comment[pt]=Foi criado um programa simples em Pascal em %{dest} +Comment[pt_BR]=Foi criado um programa simples em Pascal em %{dest} +Comment[ru]=ПроÑтое приложение на Pascal Ñоздано в %{dest} +Comment[sk]=Jednoduchý program v Pascal bol vytvorený v %{dest} +Comment[sr]=ЈедноÑтаван pascal програм направљен је у %{dest} +Comment[sr@Latn]=Jednostavan pascal program napravljen je u %{dest} +Comment[sv]=Ett enkelt Pascal-program skapades i %{dest} +Comment[tr]=Pascal'da basit bir program %{dest} içinde yaratıldı +Comment[zh_CN]=在 %{dest} 创建了一个简å•çš„ Pascal ç¨‹åº +Comment[zh_TW]=一個簡單的 Pascal 程å¼å·²å»ºç«‹æ–¼ %{dest} diff --git a/languages/pascal/app_templates/fpchello/fpchello.png b/languages/pascal/app_templates/fpchello/fpchello.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/pascal/app_templates/fpchello/fpchello.png differ diff --git a/languages/pascal/app_templates/fpchello/main.pp b/languages/pascal/app_templates/fpchello/main.pp new file mode 100644 index 00000000..932c3c0b --- /dev/null +++ b/languages/pascal/app_templates/fpchello/main.pp @@ -0,0 +1,5 @@ +program main; + +begin + WriteLn('Hello World'); +end. diff --git a/languages/pascal/app_templates/fpcsharedlib/.kdev_ignore b/languages/pascal/app_templates/fpcsharedlib/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/pascal/app_templates/fpcsharedlib/Makefile.am b/languages/pascal/app_templates/fpcsharedlib/Makefile.am new file mode 100644 index 00000000..6a7f1a85 --- /dev/null +++ b/languages/pascal/app_templates/fpcsharedlib/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = main.pp app.kdevelop +templateName = fpcsharedlib + +### 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/pascal/app_templates/fpcsharedlib/app.kdevelop b/languages/pascal/app_templates/fpcsharedlib/app.kdevelop new file mode 100644 index 00000000..bdf974e9 --- /dev/null +++ b/languages/pascal/app_templates/fpcsharedlib/app.kdevelop @@ -0,0 +1,86 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevPascalProject + Pascal + + Pascal + Code + + + + + default + + + + src/%{APPNAMELC}.pp + kdevfpcoptions + -vr + fpc + + + + true + + + + + ada + ada_bugs_gcc + bash + bash_bugs + c++_bugs_gcc + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libc + libstdc++ + opengl + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + diff --git a/languages/pascal/app_templates/fpcsharedlib/fpcsharedlib b/languages/pascal/app_templates/fpcsharedlib/fpcsharedlib new file mode 100644 index 00000000..51a294f9 --- /dev/null +++ b/languages/pascal/app_templates/fpcsharedlib/fpcsharedlib @@ -0,0 +1,9 @@ +# KDE Config File +[General] +Name=Shared library +Name[fr]=Une bibliothéque partagée +Category=Pascal/Free Pascal +Comment=Generates a shared library in Pascal +Comment[fr]=Génère une bibliothéque partagée dans le language PASCAL. +FileTemplates=pp-program,PStyle,pp-unit,PStyle +ShowFilesAfterGeneration=src/APPNAMELC.pp diff --git a/languages/pascal/app_templates/fpcsharedlib/fpcsharedlib.kdevtemplate b/languages/pascal/app_templates/fpcsharedlib/fpcsharedlib.kdevtemplate new file mode 100644 index 00000000..3e4eb4fe --- /dev/null +++ b/languages/pascal/app_templates/fpcsharedlib/fpcsharedlib.kdevtemplate @@ -0,0 +1,115 @@ +# KDE Config File +[General] +Name=Shared library +Name[ca]=Biblioteca compartida +Name[da]=Delt bibliotek +Name[de]=Shared Library +Name[el]=ΚοινόχÏηστη βιβλιοθήκη +Name[es]=Biblioteca compartida +Name[et]=Jagatud teek +Name[eu]=Liburutegi partekatua +Name[fa]=کتابخانۀ مشترک +Name[fr]=Bibliothèque partagée +Name[ga]=Comhleabharlann +Name[gl]=Biblioteca compartida +Name[hu]=Osztott programkönyvtár +Name[it]=Libreria condivisa +Name[ja]=共有ライブラリ +Name[nds]=Deelt Bibliotheek +Name[ne]=साà¤à¥‡à¤¦à¤¾à¤° लाइबà¥à¤°à¥‡à¤°à¥€ +Name[nl]=Gedeelde bibliotheek +Name[pl]=Biblioteka dzielona +Name[pt]=Biblioteca dinâmica +Name[pt_BR]=Biblioteca compartilhada +Name[ru]=РазделÑÐµÐ¼Ð°Ñ Ð±Ð¸Ð±Ð»Ð¸Ð¾Ñ‚ÐµÐºÐ° +Name[sk]=Zdieľaná knižnica +Name[sr]=Дељена библиотека +Name[sr@Latn]=Deljena biblioteka +Name[sv]=Delat bibliotek +Name[tr]=Paylaşılan Kütüphane +Name[zh_CN]=共享库 +Name[zh_TW]=共享函å¼åº« +Category=Pascal/Free Pascal +Comment=Generates a shared library in Pascal +Comment[ca]=Genera una biblioteca compartida en Pascal +Comment[da]=Genererer et delt bibliotek i Pascal +Comment[de]=Erstellt eine Shared Library in Pascal +Comment[el]=ΔημιουÏγία μιας κοινόχÏηστης βιβλιοθήκης σε Pascal +Comment[es]=Genera una biblioteca compartida en Pascal +Comment[et]=Jagatud teegi loomine Pascalis +Comment[eu]=Pascal-en idatzitako liburutegi partekatu bat sortzen du +Comment[fa]=یک کتابخانۀ مشترک در پاسکال تولید می‌کند +Comment[fr]=Génère une bibliothèque partagée en Pascal +Comment[ga]=Cruthaíonn sé seo comhleabharlann i Pascal +Comment[gl]=Xera unha biblioteca compartida en Pascal +Comment[hu]=Létrehoz egy osztott programkönyvtárt Pascalban +Comment[it]=Genera una libreria condivisa in Pascal +Comment[ja]=共有ライブラリを Pascal ã§ä½œæˆã—ã¾ã™ +Comment[nds]=Stellt en deelt Bibliotheek in Pascal op +Comment[ne]=साà¤à¥‡à¤¦à¤¾à¤° लाइबà¥à¤°à¥‡à¤°à¥€à¤²à¤¾à¤ˆ पासà¥à¤•à¤²à¤®à¤¾ उतà¥à¤ªà¤¨à¥à¤¨ गरà¥à¤¦à¤› +Comment[nl]=Genereert een gedeelde bibliotheek in Pascal +Comment[pl]=Generuje bibliotekÄ™ dzielonÄ… w Pascalu +Comment[pt]=Gera uma biblioteca dinâmica em Pascal +Comment[pt_BR]=Gera uma biblioteca dinâmica em Pascal +Comment[ru]=Создание разделÑемой библиотеки на Pascal +Comment[sk]=Vygeneruje zdieľanú knižnicu v Pascal +Comment[sr]=Прави дељену библиотеку у Pascal-у +Comment[sr@Latn]=Pravi deljenu biblioteku u Pascal-u +Comment[sv]=Skapar ett delat bibliotek i Pascal +Comment[tr]=Pascal'da bir paylaşılan kütüphane yaratır +Comment[zh_CN]=ç”Ÿæˆ Pascal 语言的共享库 +Comment[zh_TW]=產生一個 Pascal 的共享函å¼åº« +FileTemplates=pp-program,PStyle,pp-unit,PStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.pp +Archive=fpcsharedlib.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE2] +Type=install +Source=%{src}/main.pp +Dest=%{dest}/src/%{APPNAMELC}.pp + +[MSG] +Type=message +Comment=A shared library project written in pascal was created in %{dest} +Comment[ca]=Una biblioteca compartida escrita en Pascal ha estat creada en %{dest} +Comment[da]=Et delt biblioteksprojekt skrevet i pascal blev oprettet i %{dest} +Comment[de]=Ein Projekt für eine in Pascal geschriebene Shared Library wurde in %{dest} erstellt. +Comment[el]=Ένα έÏγο κοινόχÏηστης βιβλιοθήκης γÏαμμένο σε pascal δημιουÏγήθηκε στο %{dest} +Comment[es]=Un proyecto de biblioteca compartida escrito en Pascal ha sido creado en %{dest} +Comment[et]=Jagatud teegi projekt Pascalis loodi asukohta %{dest} +Comment[eu]=Pascal-en idatzitako liburutegi partekatu bat sortu da hemen: %{dest} +Comment[fa]=یک پروژۀ کتابخانۀ مشترک نوشته‌شده در پاسکال در %{dest} ایجاد شد +Comment[fr]=Un projet de bibliothèque partagée écrit en Pascal a été créé dans %{dest} +Comment[ga]=Cruthaíodh tionscadal comhleabharlainne, scríofa i pascal, i %{dest} +Comment[gl]=Creouse un proxecto de biblioteca compartida en pascan en %{dest} +Comment[hu]=Létrejött egy Pascal nyelvű projekt osztott programkönyvtár készítéséhez itt: %{dest} +Comment[it]=È stato creato un progetto di libreria condivisa scritto in Pascal in %{dest} +Comment[ja]=Pascal ã§æ›¸ã‹ã‚ŒãŸå…±æœ‰ãƒ©ã‚¤ãƒ–ラリプロジェクトを %{dest} ã«ä½œæˆã—ã¾ã—㟠+Comment[nds]=In %{dest} wöör en Projekt för en in Pascal schreven deelt Bibliotheek opstellt +Comment[ne]=पासà¥à¤•à¤²à¤®à¤¾ लेखिà¤à¤•à¥‹ साà¤à¥‡à¤¦à¤¾à¤° लाइबà¥à¤°à¥‡à¤°à¥€ परियोजना %{dest} मा सिरà¥à¤œà¤¨à¤¾ गरियो +Comment[nl]=Een gedeelde bibliotheek geschreven in Pascal is aangemaakt in %{dest} +Comment[pl]=Projekt biblioteki dzielonej napisanej w Pascalu zostaÅ‚ utworzony w %{dest} +Comment[pt]=Foi criado o projecto de uma biblioteca dinâmica em Pascal em %{dest} +Comment[pt_BR]=Foi criado o projecto de uma biblioteca dinâmica em Pascal em %{dest} +Comment[ru]=РазделÑÐµÐ¼Ð°Ñ Ð±Ð¸Ð±Ð»Ð¸Ð¾Ñ‚ÐµÐºÐ° на Pascal Ñоздана в %{dest} +Comment[sk]=Zdieľaná knižnica v Pascal bola vytvorená v %{dest} +Comment[sr]=Пројекат дељене библиотеке у Pascal-у направљен је у %{dest} +Comment[sr@Latn]=Projekat deljene biblioteke u Pascal-u napravljen je u %{dest} +Comment[sv]=Ett projekt med delat bibliotek skrivet i Pascal skapades i %{dest} +Comment[tr]=Pascal'da bir paylaşılan kütüphane projesi %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了一个 Pascal 语言的共享库工程 +Comment[zh_TW]=一個 Pascal 的共享函å¼åº«å°ˆæ¡ˆå·²å»ºç«‹æ–¼ %{dest} diff --git a/languages/pascal/app_templates/fpcsharedlib/fpcsharedlib.png b/languages/pascal/app_templates/fpcsharedlib/fpcsharedlib.png new file mode 100644 index 00000000..840a953c Binary files /dev/null and b/languages/pascal/app_templates/fpcsharedlib/fpcsharedlib.png differ diff --git a/languages/pascal/app_templates/fpcsharedlib/main.pp b/languages/pascal/app_templates/fpcsharedlib/main.pp new file mode 100644 index 00000000..c02e1472 --- /dev/null +++ b/languages/pascal/app_templates/fpcsharedlib/main.pp @@ -0,0 +1,11 @@ +library %{APPNAMELC}; + +function %{APPNAMELC}_test: integer; cdecl; export; +begin + %{APPNAMELC}_test := 0; +end; + +exports + %{APPNAMELC}_test; + +end. diff --git a/languages/pascal/app_templates/pascal.appwizard b/languages/pascal/app_templates/pascal.appwizard new file mode 100644 index 00000000..766cc0ba --- /dev/null +++ b/languages/pascal/app_templates/pascal.appwizard @@ -0,0 +1,2 @@ +[General] +List=pascalhello,fpcgtk,fpchello,fpcsharedlib diff --git a/languages/pascal/app_templates/pascalhello/.kdev_ignore b/languages/pascal/app_templates/pascalhello/.kdev_ignore new file mode 100644 index 00000000..e69de29b diff --git a/languages/pascal/app_templates/pascalhello/Makefile.am b/languages/pascal/app_templates/pascalhello/Makefile.am new file mode 100644 index 00000000..02924e72 --- /dev/null +++ b/languages/pascal/app_templates/pascalhello/Makefile.am @@ -0,0 +1,16 @@ +dataFiles = main.pp app.kdevelop +templateName = pascalhello + +### 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/pascal/app_templates/pascalhello/app.kdevelop b/languages/pascal/app_templates/pascalhello/app.kdevelop new file mode 100644 index 00000000..fcb75f33 --- /dev/null +++ b/languages/pascal/app_templates/pascalhello/app.kdevelop @@ -0,0 +1,83 @@ + + + + %{AUTHOR} + %{EMAIL} + %{VERSION} + KDevPascalProject + Pascal + + Pascal + Code + + + + + default + + + + src/%{APPNAMELC}.pp + + + + true + + + + + ada + ada_bugs_gcc + bash + bash_bugs + c++_bugs_gcc + clanlib + w3c-dom-level2-html + fortran_bugs_gcc + gnome1 + gnustep + gtk + gtk_bugs + haskell + haskell_bugs_ghc + java_bugs_gcc + java_bugs_sun + kde2book + libc + libstdc++ + opengl + php + php_bugs + perl + perl_bugs + python + python_bugs + qt-kdev3 + ruby + ruby_bugs + sdl + stl + w3c-svg + sw + w3c-uaag10 + wxwidgets_bugs + + + Guide to the Qt Translation Tools + Qt Assistant Manual + Qt Designer Manual + Qt Reference Documentation + qmake User Guide + + + KDE Libraries (Doxygen) + + + + + + + + + + diff --git a/languages/pascal/app_templates/pascalhello/main.pp b/languages/pascal/app_templates/pascalhello/main.pp new file mode 100644 index 00000000..932c3c0b --- /dev/null +++ b/languages/pascal/app_templates/pascalhello/main.pp @@ -0,0 +1,5 @@ +program main; + +begin + WriteLn('Hello World'); +end. diff --git a/languages/pascal/app_templates/pascalhello/pascalhello b/languages/pascal/app_templates/pascalhello/pascalhello new file mode 100644 index 00000000..7482fb78 --- /dev/null +++ b/languages/pascal/app_templates/pascalhello/pascalhello @@ -0,0 +1,10 @@ +# KDE Config File +[General] +Name=Simple Hello world program +Name[fr]=Un simple programme de test « Hello world » +Icon=pascalhello.png +Category=Pascal +Comment=Generates a simple Hello world program in Pascal +Comment[fr]=Génère un simple programme de test du type « Hello world » dans le language PASCAL. +FileTemplates=pp-program,PStyle,pp-unit,PStyle +ShowFilesAfterGeneration=src/APPNAMELC.pp diff --git a/languages/pascal/app_templates/pascalhello/pascalhello.kdevtemplate b/languages/pascal/app_templates/pascalhello/pascalhello.kdevtemplate new file mode 100644 index 00000000..13c9df69 --- /dev/null +++ b/languages/pascal/app_templates/pascalhello/pascalhello.kdevtemplate @@ -0,0 +1,116 @@ +# KDE Config File +[General] +Name=Simple Hello world program +Name[ca]=Simple programa Hello world +Name[da]=Simpelt Goddag verden program +Name[de]=Ein einfaches "Hello World"-Programm +Name[el]=Απλό Ï€ÏόγÏαμμα Γεια σου Κόσμε +Name[es]=Programa «Hola mundo» sencillo +Name[et]=Lihtne "Tere, maailm" programm +Name[eu]="Kaixo mundua" programa sinplea +Name[fa]=برنامۀ سادۀ Hello world +Name[fr]=Programme « Bonjour monde » simple +Name[ga]=Ríomhchlár simplí "Hello World" +Name[gl]=Programa sinxelo Ola mundo +Name[hu]=Egyszerű Hello world program +Name[it]=Semplice programma di "Hello world" +Name[ja]=ç°¡å˜ãª Hello world プログラム +Name[ms]=Program Hello World mudah +Name[nds]=En eenfach "Moin Welt"-Programm +Name[ne]=साधारण हेलà¥à¤²à¥‹ वोलà¥à¤¡ कारà¥à¤¯à¤•à¥à¤°à¤® +Name[nl]=Eenvoudig 'Hello World' programma +Name[pl]=Prosty program witaj Å›wiecie +Name[pt]=Programa simples Olá Mundo +Name[pt_BR]=Programa simples Olá Mundo +Name[ru]=ПроÑÑ‚Ð°Ñ Ð¿Ñ€Ð¾Ð³Ñ€Ð°Ð¼Ð¼Ð° Hello world +Name[sk]=Jednoduchý "Ahoj svet" program +Name[sl]=Preprost program Hello world +Name[sr]=ЈедноÑтаван „Здраво Ñвете“ програм +Name[sr@Latn]=Jednostavan „Zdravo svete“ program +Name[sv]=Enkelt Hello world-program +Name[tr]=Basit Merhaba dünya programı +Name[zh_CN]=简å•çš„ Hello world ç¨‹åº +Name[zh_TW]=簡單的 Hello world ç¨‹å¼ +Icon=pascalhello.png +Category=Pascal +Comment=Generates a simple Hello world program in Pascal +Comment[ca]=Genera un simple programa de Hello world en Pascal +Comment[da]=Genererer et simpelt Goddag verden program i Pascal +Comment[de]=Erstellt ein einfaches "Hello World"-Programm in Pascal +Comment[el]=ΔημιουÏγεί ένα απλό Ï€ÏόγÏαμμα Γεια σου Κόσμε σε Pascal +Comment[es]=Genera un programa «Hola mundo» sencillo en Pascal +Comment[et]=Lihtsa "Tere, maailm" programmi loomine Pascalis +Comment[eu]=Pascal-en idatzitako "Kaixo mundua" programa sinple bat sortzen du +Comment[fa]=یک برنامۀ سادۀ Hello world در پاسکال تولید می‌کند +Comment[fr]=Génère un programme « Bonjour monde » simple en Pascal +Comment[gl]=Xera un programa sinxelo Ola mundo en Pascal +Comment[hu]=Létrehoz egy egyszerű Hello world programot Pascalban +Comment[it]=Genera un semplice programma di "Hello world" in Pascal +Comment[ja]=ç°¡å˜ãª Hello world プログラムを Pascal ã§ä½œæˆã—ã¾ã™ +Comment[nds]=Stellt in Pascal en eenfach "Moin Welt"-Programm op +Comment[ne]=साधारण हेलà¥à¤²à¥‹ वोलà¥à¤¡ कारà¥à¤¯à¤•à¥à¤°à¤®à¤²à¤¾à¤ˆ पासà¥à¤•à¤²à¤®à¤¾ उतà¥à¤ªà¤¨à¥à¤¨ गरà¥à¤¦à¤› +Comment[nl]=Genereert een eenvudig Hello World-programma in Pascal +Comment[pl]=Generuje prosty program "Witaj Å›wiecie" w Pascalu +Comment[pt]=Gera um programa simples Olá Mundo em Pascal +Comment[pt_BR]=Gera um programa simples Olá Mundo em Pascal +Comment[ru]=Создание проÑтого Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Hello world на Pascal +Comment[sk]=Vygeneruje jednoduchý Ahoj svet program v Pascal +Comment[sr]=Прави једноÑтаван „Здраво Ñвете“ у Pascal-у +Comment[sr@Latn]=Pravi jednostavan „Zdravo svete“ u Pascal-u +Comment[sv]=Skapar ett enkelt Hello world-program i Pascal +Comment[tr]=Pascal'da basit bir Merhaba Dünya programı yaratır. +Comment[zh_CN]=生æˆä¸€ä¸ªç®€å•çš„ Pascal 语言 Hello world ç¨‹åº +Comment[zh_TW]=產生一個簡單的 Pascal Hello world ç¨‹å¼ +FileTemplates=pp-program,PStyle,pp-unit,PStyle +ShowFilesAfterGeneration=%{dest}/src/%{APPNAMELC}.pp +Archive=pascalhello.tar.gz + +[GNU] +Type=include +File=%{kdevelop}/template-common/gnu.kdevtemplate + +[FILE1] +Type=install +EscapeXML=true +Source=%{src}/app.kdevelop +Dest=%{dest}/%{APPNAMELC}.kdevelop + +[MkDir1] +Type=mkdir +Dir=%{dest}/src + +[FILE2] +Type=install +Source=%{src}/main.pp +Dest=%{dest}/src/%{APPNAMELC}.pp + +[MSG] +Type=message +Comment=A simple 'hello world' program in Pascal was created in %{dest} +Comment[ca]=Un simple programa de 'hello world' en Pascal ha estat creat en %{dest} +Comment[da]=Et simpelt 'goddag verden' program i Pascal blev oprettet i %{dest} +Comment[de]=Ein einfaches "Hello world"-Programm in Pascal wurde in %{dest} erstellt. +Comment[el]=Ένα απλό Ï€ÏόγÏαμμα 'Γεια σου κόσμε' σε Pascal δημιουÏγήθηκε στο %{dest} +Comment[es]=Un sencillo programa «Hola mundo» en Pascal ha sido creado en %{dest} +Comment[et]=Lihtne "Tere, maailm" programm Pascalis loodi asukohta %{dest} +Comment[eu]=Pascal-en idatzitako "Kaixo mundua" programa sinple bat sortu da hemen: %{dest} +Comment[fa]=یک برنامۀ سادۀ «hello world» در پاسکال در %{dest} ایجاد شد +Comment[fr]=Un programme « Bonjour monde » simple en Pascal a été créé dans %{dest} +Comment[gl]=Creouse un programa sinxelo en Pascal 'ola mundo' en %{dest} +Comment[hu]=Létrejött egy egyszerű Hello world Pascal-program itt: %{dest} +Comment[it]=È stato creato un semplice programma Pascal di "hello world" in %{dest} +Comment[ja]=Pascal ã§æ›¸ã‹ã‚ŒãŸç°¡å˜ãª hello world プログラムを %{dest} ã«ä½œæˆã—ã¾ã—㟠+Comment[nds]=In %{dest} wöör en eenfach "Moin Welt"-Programm in Pascal opstellt +Comment[ne]=पासà¥à¤•à¤²à¤®à¤¾ साधारण 'हेलà¥à¤²à¥‹ वोलà¥à¤¡' कारà¥à¤¯à¤•à¥à¤°à¤® %{dest} सिरà¥à¤œà¤¨à¤¾ गरियो +Comment[nl]=Een eenvoudig Hello World-programma geschreven in Pascal is aangemaakt in %{dest} +Comment[pl]=Prosty program "Witaj Å›wiecie" w Pascalu zostaÅ‚ utworzony w %{dest} +Comment[pt]=Foi criado um programa simples 'olá mundo' em Pascal em %{dest} +Comment[pt_BR]=Foi criado um programa simples 'olá mundo' em Pascal em %{dest} +Comment[ru]=ПроÑтое приложение 'hello world' на Pascal Ñоздано в %{dest} +Comment[sk]=Jednoduchý Ahoj svet program v Pascal bol vytvorený v %{dest} +Comment[sr]=ЈедноÑтаван „Здраво Ñвете“ програм у Pascal-у направљен је у %{dest} +Comment[sr@Latn]=Jednostavan „Zdravo svete“ program u Pascal-u napravljen je u %{dest} +Comment[sv]=Ett enkelt 'Hello world'-program i Pascal skapades i %{dest} +Comment[tr]=Pascal'da basit bir "Merhaba Dünya" uygulaması %{dest} içinde yaratıldı. +Comment[zh_CN]=在 %{dest} 创建了一个简å•çš„“Hello worldâ€ç¨‹åº +Comment[zh_TW]=一個簡單的 Pascal Hello world 程å¼å·²å»ºç«‹æ–¼ %{dest} diff --git a/languages/pascal/app_templates/pascalhello/pascalhello.png b/languages/pascal/app_templates/pascalhello/pascalhello.png new file mode 100644 index 00000000..888d4f13 Binary files /dev/null and b/languages/pascal/app_templates/pascalhello/pascalhello.png differ diff --git a/languages/pascal/backgroundparser.cpp b/languages/pascal/backgroundparser.cpp new file mode 100644 index 00000000..a61c9774 --- /dev/null +++ b/languages/pascal/backgroundparser.cpp @@ -0,0 +1,95 @@ +/*************************************************************************** + * 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 + +#include "backgroundparser.h" +#include "problemreporter.h" +#include "PascalLexer.hpp" +#include "PascalParser.hpp" +#include "PascalAST.hpp" +#include +#include +#include + +BackgroundParser::BackgroundParser( ProblemReporter* reporter, + const QString& source, + const QString& filename ) + : m_reporter( reporter ), + m_source( source.unicode(), source.length() ), + m_fileName( filename ) +{ +} + +BackgroundParser::~BackgroundParser() +{ +} + +void BackgroundParser::run() +{ + kdDebug() << "11" << endl; + + QCString _fn = QFile::encodeName(m_fileName); + std::string fn( _fn.data() ); + + QCString text = m_source.utf8(); + std::istringstream stream( text.data() ); + + kdDebug() << "12" << endl; + + PascalLexer lexer( stream ); + lexer.setFilename( fn ); + lexer.setProblemReporter( m_reporter ); + + kdDebug() << "13" << endl; + + PascalParser parser( lexer ); + parser.setFilename( fn ); + parser.setProblemReporter( m_reporter ); + + antlr::ASTFactory my_factory( "PascalAST", PascalAST::factory ); + parser.initializeASTFactory(my_factory); + parser.setASTFactory( &my_factory ); + + kdDebug() << "14" << endl; + + try{ + + kdDebug() << "15" << endl; + + lexer.resetErrors(); + parser.resetErrors(); + + kdDebug() << "16" << endl; + + parser.compilationUnit(); + + kdDebug() << "17" << endl; + + int errors = lexer.numberOfErrors() + parser.numberOfErrors(); + + kdDebug() << "18" << endl; + } catch( antlr::ANTLRException& ex ){ + + kdDebug() << "19" << endl; + + kdDebug() << "*exception*: " << ex.toString().c_str() << endl; + m_reporter->reportError( ex.getMessage().c_str(), + m_fileName, + lexer.getLine(), + lexer.getColumn() ); + } + + kdDebug(9013) << "FINISHED!!" << endl; +} + + + diff --git a/languages/pascal/backgroundparser.h b/languages/pascal/backgroundparser.h new file mode 100644 index 00000000..7118c7f2 --- /dev/null +++ b/languages/pascal/backgroundparser.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * 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 +#include + +class ProblemReporter; + +class BackgroundParser: public QThread{ +public: + BackgroundParser( ProblemReporter* reporter, + const QString& source, + const QString& filename ); + virtual ~BackgroundParser(); + + virtual void run(); + +private: + ProblemReporter* m_reporter; + QString m_source; + QString m_fileName; +}; + +#endif diff --git a/languages/pascal/compiler/Makefile.am b/languages/pascal/compiler/Makefile.am new file mode 100644 index 00000000..c9f7528b --- /dev/null +++ b/languages/pascal/compiler/Makefile.am @@ -0,0 +1,6 @@ +# This is the collection of plugins. In contrast to the parts +# directory, these are 'transient' in a sense and don't +# share the complete KDevComponent interface. + +SUBDIRS = dccoptions fpcoptions + diff --git a/languages/pascal/compiler/dccoptions/Makefile.am b/languages/pascal/compiler/dccoptions/Makefile.am new file mode 100644 index 00000000..61dd304c --- /dev/null +++ b/languages/pascal/compiler/dccoptions/Makefile.am @@ -0,0 +1,16 @@ +# Here resides the gcc option dialog plugin. + +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extras \ + -I$(top_srcdir)/lib/widgets $(all_includes) + +kde_module_LTLIBRARIES = libkdevdccoptions.la +libkdevdccoptions_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) +libkdevdccoptions_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/lib/widgets/libkdevwidgets.la $(top_builddir)/lib/interfaces/extras/libkdevextras.la $(LIB_KHTML) + +libkdevdccoptions_la_SOURCES = dccoptionsplugin.cpp optiontabs.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevdccoptions.desktop diff --git a/languages/pascal/compiler/dccoptions/dccoptionsplugin.cpp b/languages/pascal/compiler/dccoptions/dccoptionsplugin.cpp new file mode 100644 index 00000000..a65ca9d6 --- /dev/null +++ b/languages/pascal/compiler/dccoptions/dccoptionsplugin.cpp @@ -0,0 +1,114 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 +#include + +#include +#include +#include + +#include "dccoptionsplugin.h" + +#include "optiontabs.h" + +K_EXPORT_COMPONENT_FACTORY( libkdevdccoptions, KGenericFactory( "kdevdccoptions" ) ) + +DccOptionsPlugin::DccOptionsPlugin(QObject *parent, const char *name, const QStringList/* &args*/) + : KDevCompilerOptions(parent, name) +{ +} + +DccOptionsPlugin::~DccOptionsPlugin() +{ +} + +QString DccOptionsPlugin::exec(QWidget *parent, const QString &flags) +{ + DccOptionsDialog *dlg = new DccOptionsDialog(parent, "dcc options dialog"); + QString newFlags = flags; + dlg->setFlags(flags); + if(dlg->exec() == QDialog::Accepted) + newFlags = dlg->flags(); + delete dlg; + return newFlags; +} + + +DccOptionsDialog::DccOptionsDialog( QWidget * parent, const char * name ) + : KDialogBase(Tabbed, i18n("Delphi Compiler Options"), Ok|Cancel, Ok, parent, name, true) +{ + QVBox *vbox; + + vbox = addVBoxPage(i18n("General")); + general = new GeneralTab(vbox, "general tab"); + + vbox = addVBoxPage(i18n("Locations I")); + locations = new LocationsTab(vbox, "locations tab"); + + vbox = addVBoxPage(i18n("Locations II")); + locations2 = new Locations2Tab(vbox, "locations2 tab"); + + vbox = addVBoxPage(i18n("Code Generation")); + codegen = new CodegenTab(vbox, "codegen tab"); + + vbox = addVBoxPage(i18n("Debug && Optimization")); + debug_optim = new DebugOptimTab(vbox, "debug and optim tab"); + + vbox = addVBoxPage(i18n("Linker")); + linker = new LinkerTab(vbox, "linker tab"); +} + +DccOptionsDialog::~DccOptionsDialog( ) +{ +} + +void DccOptionsDialog::setFlags( const QString & flags ) +{ + QStringList flaglist = QStringList::split(" ", flags); + + general->readFlags(&flaglist); + codegen->readFlags(&flaglist); + debug_optim->readFlags(&flaglist); + locations->readFlags(&flaglist); + locations2->readFlags(&flaglist); + linker->readFlags(&flaglist); + + unrecognizedFlags = flaglist; +} + +QString DccOptionsDialog::flags( ) const +{ + QStringList flaglist; + + general->writeFlags(&flaglist); + locations->writeFlags(&flaglist); + locations2->writeFlags(&flaglist); + codegen->writeFlags(&flaglist); + debug_optim->writeFlags(&flaglist); + linker->writeFlags(&flaglist); + + QString flags; + QStringList::ConstIterator li; + for (li = flaglist.begin(); li != flaglist.end(); ++li) { + flags += (*li); + flags += " "; + } + + for (li = unrecognizedFlags.begin(); li != unrecognizedFlags.end(); ++li) { + flags += (*li); + flags += " "; + } + + flags.truncate(flags.length()-1); + return flags; +} + +#include "dccoptionsplugin.moc" diff --git a/languages/pascal/compiler/dccoptions/dccoptionsplugin.h b/languages/pascal/compiler/dccoptions/dccoptionsplugin.h new file mode 100644 index 00000000..35f34532 --- /dev/null +++ b/languages/pascal/compiler/dccoptions/dccoptionsplugin.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 DCCOPTIONSPLUGIN_H +#define DCCOPTIONSPLUGIN_H + +#include + +#include "kdevcompileroptions.h" + +class DccOptionsPlugin : public KDevCompilerOptions +{ + Q_OBJECT + +public: + DccOptionsPlugin( QObject *parent, const char *name, const QStringList/* &args */); + ~DccOptionsPlugin(); + + virtual QString exec(QWidget *parent, const QString &flags); +}; + +class GeneralTab; +class LinkerTab; +class LocationsTab; +class Locations2Tab; +class CodegenTab; +class DebugOptimTab; + +class DccOptionsDialog : public KDialogBase +{ +public: + DccOptionsDialog( QWidget *parent=0, const char *name=0 ); + ~DccOptionsDialog(); + + void setFlags(const QString &flags); + QString flags() const; + +private: + GeneralTab *general; + LinkerTab *linker; + LocationsTab *locations; + Locations2Tab *locations2; + CodegenTab *codegen; + DebugOptimTab *debug_optim; + QStringList unrecognizedFlags; +}; + + +#endif diff --git a/languages/pascal/compiler/dccoptions/kdevdccoptions.desktop b/languages/pascal/compiler/dccoptions/kdevdccoptions.desktop new file mode 100644 index 00000000..8a577bb7 --- /dev/null +++ b/languages/pascal/compiler/dccoptions/kdevdccoptions.desktop @@ -0,0 +1,54 @@ +[Desktop Entry] +Type=Service +Exec=dcc +Comment=Borland Delphi Compiler +Comment[br]=Dastumer Delphi Borland +Comment[ca]=Compilador Delphi de Borland +Comment[da]=Borland Delphi oversætter +Comment[el]=Μεταγλωττιστής Borland Delphi +Comment[es]=Compilador de Delphi de Borland +Comment[et]=Borland Delphi kompilaator +Comment[eu]=Borland Delphi konpiladorea +Comment[fa]=مترجم برلند دلÙÛŒ +Comment[fr]=Compilateur Delphi de Borland +Comment[ga]=Tiomsaitheoir Borland Delphi +Comment[gl]=Compilador Borland Delphi +Comment[hi]=बोरलैंड डेलà¥à¤«à¤¼à¥€ कमà¥à¤ªà¤¾à¤¯à¤²à¤° +Comment[hu]=Borland Delphi fordítóprogram +Comment[is]=Borland Delphi þýðandi +Comment[it]=Compilatore per Borland Delphi +Comment[ja]=Borland Delphi コンパイラ +Comment[nds]=Borland Delphi-Kompilerer +Comment[ne]=बोरलà¥à¤¯à¤¾à¤¨à¥à¤¡ डेलà¥à¤ªà¥€ कमà¥à¤ªà¤¾à¤‡à¤²à¤° +Comment[nl]=Borland Delphi-compiler +Comment[pl]=Kompilator Borland Delphi +Comment[pt]=Compilador de Borland Delphi +Comment[pt_BR]=Compilador Delphi da Borland Delphi +Comment[ru]=КомпилÑтор Borland Delphi +Comment[sk]=Borland Delphi kompilátor +Comment[sl]=Prevajalnik za Borland Delphi +Comment[sr]=Borland-ов преводилац Delphi-ја +Comment[sr@Latn]=Borland-ov prevodilac Delphi-ja +Comment[sv]=Borland Delphi kompilator +Comment[ta]=பொரà¯à®²à®¾à®©à¯à®Ÿà¯ டெலà¯à®ªà®¿ தொகà¯à®ªà¯à®ªà®¿ +Comment[tg]=Талфифгари Borland Delphi +Comment[tr]=Borland Delphi Derleyicisi +Comment[zh_CN]=Borland Delphi 编译器 +Comment[zh_TW]=Borland Delphi 編譯器 +Name=DccOptions +Name[da]=Delphi oversætter indstillinger +Name[de]=Delphi-Einstellungen (KDevelop) +Name[hi]=डीसीसी-विकलà¥à¤ª +Name[nds]=Delphi-Optschonen (KDevelop) +Name[pl]=Opcje Dcc +Name[sk]=Dcc možnosti +Name[sl]=Možnosti Dcc +Name[sv]=Alternativ för dcc +Name[ta]=Dccவிரà¯à®ªà¯à®ªà®™à¯à®•à®³à¯ +Name[tg]=DccИнтихобҳо +Name[zh_TW]=Dcc é¸é … +ServiceTypes=KDevelop/CompilerOptions +X-KDE-Library=libkdevdccoptions +X-KDevelop-Version=5 +X-KDevelop-Language=Pascal +X-KDevelop-Args=dcc diff --git a/languages/pascal/compiler/dccoptions/optiontabs.cpp b/languages/pascal/compiler/dccoptions/optiontabs.cpp new file mode 100644 index 00000000..97622606 --- /dev/null +++ b/languages/pascal/compiler/dccoptions/optiontabs.cpp @@ -0,0 +1,399 @@ +/*************************************************************************** + * Copyright (C) 2003 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 +#include + +#include +#include +#include +#include +#include +#include + +#include "flagboxes.h" + +#include "optiontabs.h" + +LinkerTab::LinkerTab( QWidget * parent, const char * name ) + : QWidget(parent, name), radioController(new FlagRadioButtonController()), + pathController(new FlagPathEditController()), + editController(new FlagEditController()) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + QVButtonGroup *map_group = new QVButtonGroup(i18n("Map File"), this); + QRadioButton *m_defaultMap = new QRadioButton(i18n("Off"), map_group); + m_defaultMap->setChecked(true); + new FlagRadioButton(map_group, radioController, + "-GS", i18n("Segments")); + new FlagRadioButton(map_group, radioController, + "-GP", i18n("Publics")); + new FlagRadioButton(map_group, radioController, + "-GD", i18n("Detailed")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + new FlagPathEdit(this, "", pathController, + "--dynamicloader=", i18n("Default dynamic loader:"), KFile::File); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + new FlagSpinEdit(this, 0, 2147483647, 1024, 1048576, editController, + "-$M", i18n("Reserved address space:")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + layout->addStretch(); +} + +LinkerTab::~LinkerTab( ) +{ + delete radioController; + delete pathController; + delete editController; +} + +void LinkerTab::readFlags( QStringList * str ) +{ + pathController->readFlags(str); + radioController->readFlags(str); + editController->readFlags(str); +} + +void LinkerTab::writeFlags( QStringList * str ) +{ + pathController->writeFlags(str); + radioController->writeFlags(str); + editController->writeFlags(str); +} + + + +LocationsTab::LocationsTab( QWidget * parent, const char * name ) + :QWidget(parent, name), pathController(new FlagPathEditController()) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + new FlagPathEdit(this, ":", pathController, + "-I", i18n("Include search path (delimited by \":\"):")); + new FlagPathEdit(this, ":", pathController, + "-R", i18n("Resource search path (delimited by \":\"):")); + new FlagPathEdit(this, ":", pathController, + "-U", i18n("Unit search path (delimited by \":\"):")); + new FlagPathEdit(this, ":", pathController, + "-O", i18n("Object search path (delimited by \":\"):")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addStretch(); +} + +LocationsTab::~LocationsTab( ) +{ + delete pathController; +} + +void LocationsTab::readFlags( QStringList * str ) +{ + pathController->readFlags(str); +} + +void LocationsTab::writeFlags( QStringList * str ) +{ + pathController->writeFlags(str); +} + + + +Locations2Tab::Locations2Tab( QWidget * parent, const char * name ) + :QWidget(parent, name), pathController(new FlagPathEditController()) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + new FlagPathEdit(this, "", pathController, + "-E", i18n("Executable output directory:")); + new FlagPathEdit(this, "", pathController, + "-N", i18n("Unit output directory:")); + new FlagPathEdit(this, "", pathController, + "-LE", i18n("Package directory:")); + new FlagPathEdit(this, "", pathController, + "-LN", i18n("Package source code directory:")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addStretch(); +} + +Locations2Tab::~Locations2Tab( ) +{ + delete pathController; +} + +void Locations2Tab::readFlags( QStringList * str ) +{ + pathController->readFlags(str); +} + +void Locations2Tab::writeFlags( QStringList * str ) +{ + pathController->writeFlags(str); +} + + + +GeneralTab::GeneralTab( QWidget * parent, const char * name ) + :QWidget(parent, name), controller(new FlagCheckBoxController()), + editController(new FlagEditController()) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + QVButtonGroup *build_group = new QVButtonGroup(i18n("Build"), this); + new FlagCheckBox(build_group, controller, + "-B", i18n("Build all units")); + new FlagCheckBox(build_group, controller, + "-M", i18n("Make modified units")); + new FlagCheckBox(build_group, controller, + "-Q", i18n("Quiet compile")); + new FlagCheckBox(build_group, controller, + "-Z", i18n("Disable implicit package compilation")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + layout->addSpacing(10); + + new FlagListEdit(this, ":", editController, "-D", i18n("Conditional defines (delimited by \":\"):")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + new FlagListEdit(this, ":", editController, "-A", i18n("Unit aliases in form unit=alias (delimited by \":\"):")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + layout->addSpacing(10); + + QVButtonGroup *message_group = new QVButtonGroup(i18n("Messages"), this); + new FlagCheckBox(message_group, controller, + "-H", i18n("Output hint messages")); + new FlagCheckBox(message_group, controller, + "-W", i18n("Output warning messages")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + layout->addSpacing(10); + QVButtonGroup *package_group = new QVButtonGroup(i18n("Packages"), this); + new FlagListEdit(package_group, ":", editController, "-LU", i18n("Build with packages (delimited by \":\"):")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + layout->addStretch(); +} + +GeneralTab::~GeneralTab( ) +{ + delete controller; + delete editController; +} + +void GeneralTab::readFlags( QStringList * str ) +{ + controller->readFlags(str); + editController->readFlags(str); +} + +void GeneralTab::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); + editController->writeFlags(str); +} + + + +CodegenTab::CodegenTab( QWidget * parent, const char * name ) + :QWidget(parent, name), controller(new FlagCheckBoxController()), + listController(new FlagEditController()), + radioController(new FlagRadioButtonController()) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); +// layout->setAutoAdd(true); + + QGridLayout *layout2 = new QGridLayout(layout, 2, 2, KDialog::spacingHint()); + + QVButtonGroup *align_group = new QVButtonGroup(i18n("Code Alignment && Stack Frames"), this); + QRadioButton *align_def = new QRadioButton(i18n("Default (-$A8)"), align_group); + align_def->setChecked(true); + new FlagRadioButton(align_group, radioController, + "'-$A1'", i18n("Never align")); + new FlagRadioButton(align_group, radioController, + "'-$A2'", i18n("On word boundaries")); + new FlagRadioButton(align_group, radioController, + "'-$A4'", i18n("On double word boundaries")); + new FlagRadioButton(align_group, radioController, + "'-$A8'", i18n("On quad word boundaries")); + new FlagCheckBox(align_group, controller, + "'-$W+'", i18n("Generate stack frames"), "'-$W-'"); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout2->addWidget(align_group, 0, 0); + + QVButtonGroup *enum_group = new QVButtonGroup(i18n("Enumeration Size"), this); + QRadioButton *enum_def = new QRadioButton(i18n("Default (-$Z1)"), enum_group); + enum_def->setChecked(true); + new FlagRadioButton(enum_group, radioController, + "'-$Z1'", i18n("Unsigned byte (256 values)")); + new FlagRadioButton(enum_group, radioController, + "'-$Z2'", i18n("Unsigned word (64K values)")); + new FlagRadioButton(enum_group, radioController, + "'-$Z4'", i18n("Unsigned double word (4096M values)")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout2->addWidget(enum_group, 0, 1); + + QVButtonGroup *compile_group = new QVButtonGroup(i18n("Compile Time Checks"), this); + new FlagCheckBox(compile_group, controller, + "'-$C+'", i18n("Assertions"), "'-$C-'", "'-$C+'"); + new FlagCheckBox(compile_group, controller, + "'-$B+'", i18n("Complete boolean evaluation"), "'-$B-'"); + new FlagCheckBox(compile_group, controller, + "'-$X+'", i18n("Extended syntax"), "'-$X-'", "'-$X+'"); + new FlagCheckBox(compile_group, controller, + "'-$H+'", i18n("Long strings"), "'-$H-'", "'-$H+'"); + new FlagCheckBox(compile_group, controller, + "'-$P+'", i18n("Open string parameters"), "'-$P-'", "'-$P+'"); + new FlagCheckBox(compile_group, controller, + "'-$T+'", i18n("Type-checked pointers"), "'-$T-'"); + new FlagCheckBox(compile_group, controller, + "'-$V+'", i18n("Var-string checking"), "'-$V-'", "'-$V+'"); + new FlagCheckBox(compile_group, controller, + "'-$J+'", i18n("Writable typed constants"), "'-$J-'"); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout2->addWidget(compile_group, 1, 0); + + QVButtonGroup *run_group = new QVButtonGroup(i18n("Run Time Checks"), this); + new FlagCheckBox(run_group, controller, + "'-$M+'", i18n("Runtime type information"), "'-$M-'"); + new FlagCheckBox(run_group, controller, + "'-$G+'", i18n("Imported data references"), "'-$G-'", "'-$G+'"); + new FlagCheckBox(run_group, controller, + "'-$I+'", i18n("Input/Output checking"), "'-$I-'", "'-$I+'"); + new FlagCheckBox(run_group, controller, + "'-$Q+'", i18n("Overflow checking"), "'-$Q-'"); + new FlagCheckBox(run_group, controller, + "'-$R+'", i18n("Range checking"), "'-$R-'"); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout2->addWidget(run_group, 1, 1); + + layout->addStretch(); +} + +CodegenTab::~CodegenTab( ) +{ + delete controller; + delete listController; + delete radioController; +} + +void CodegenTab::readFlags( QStringList * str ) +{ + controller->readFlags(str); + listController->readFlags(str); + radioController->readFlags(str); +} + +void CodegenTab::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); + listController->writeFlags(str); + radioController->writeFlags(str); +} + + + +DebugOptimTab::DebugOptimTab( QWidget * parent, const char * name ) + : QWidget(parent, name), controller(new FlagCheckBoxController()), + radioController(new FlagRadioButtonController) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); +// layout->setAutoAdd(true); + + QVButtonGroup *optim_group = new QVButtonGroup(i18n("Optimization"), this); + new FlagCheckBox(optim_group, controller, + "'-$O+'", i18n("Enable optimizations"), "'-$O-'", "'-$O+'"); + layout->addWidget(optim_group); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + QBoxLayout *layout2 = new QHBoxLayout(layout, KDialog::spacingHint()); + + QVButtonGroup *debug_group = new QVButtonGroup(i18n("Debugging"), this); + new FlagCheckBox(debug_group, controller, + "'-$D+'", i18n("Debug information"), "'-$D-'", "'-$D+'"); + new FlagCheckBox(debug_group, controller, + "'-$L+'", i18n("Local symbol information"), "'-$L-'", "'-$L+'"); + gdb = new FlagCheckBox(debug_group, controller, + "-V", i18n("Debug information for GDB")); + namespacedb = new FlagCheckBox(debug_group, controller, + "-VN", i18n("Namespace debug info")); + symboldb = new FlagCheckBox(debug_group, controller, + "-VR", i18n("Write symbol info in an .rsm file")); + layout2->addWidget(debug_group); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + QVButtonGroup *debug_add = new QVButtonGroup(i18n("Symbol Reference Information"), this); + QRadioButton *m_default = new QRadioButton(i18n("Default (-$YD)"), debug_add); + m_default->setChecked(true); + new FlagRadioButton(debug_add, radioController, + "'-$Y-'", i18n("No information")); + new FlagRadioButton(debug_add, radioController, + "'-$YD'", i18n("Definition information")); + new FlagRadioButton(debug_add, radioController, + "'-$Y+'", i18n("Full reference information")); + layout2->addWidget(debug_add); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + QHBoxLayout *layout3 = new QHBoxLayout(layout, KDialog::spacingHint()); + QPushButton *release = new QPushButton(i18n("Release"), this); + QPushButton *debug = new QPushButton(i18n("Debug"), this); + layout3->addWidget(release); + layout3->addWidget(debug); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + connect(release, SIGNAL(clicked()), this, SLOT(setReleaseOptions())); + connect(debug, SIGNAL(clicked()), this, SLOT(setDebugOptions())); + + layout->addStretch(); +} + + DebugOptimTab::~ DebugOptimTab( ) +{ + delete controller; + delete radioController; +} + +void DebugOptimTab::readFlags( QStringList * str ) +{ + controller->readFlags(str); + radioController->readFlags(str); +} + +void DebugOptimTab::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); + radioController->writeFlags(str); +} + +void DebugOptimTab::setReleaseOptions() +{ + QStringList sl = QStringList::split(",", "'-$O+','-$Y-','-$D-','-$L-'"); + readFlags(&sl); + gdb->setChecked(false); + namespacedb->setChecked(false); + symboldb->setChecked(false); +} + +void DebugOptimTab::setDebugOptions() +{ + QStringList sl = QStringList::split(",", "'-$O-','-$Y+','-$D+','-$L+',-V,-VN"); + readFlags(&sl); +} + +#include "optiontabs.moc" diff --git a/languages/pascal/compiler/dccoptions/optiontabs.h b/languages/pascal/compiler/dccoptions/optiontabs.h new file mode 100644 index 00000000..048684a5 --- /dev/null +++ b/languages/pascal/compiler/dccoptions/optiontabs.h @@ -0,0 +1,116 @@ +/*************************************************************************** + * Copyright (C) 2003 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 OPTIONTABS_H +#define OPTIONTABS_H + +#include + +class FlagRadioButtonController; +class FlagPathEditController; +class FlagCheckBoxController; +class FlagEditController; +class QRadioButton; +class FlagRadioButton; +class FlagCheckBox; + +class LinkerTab : public QWidget +{ +public: + LinkerTab( QWidget *parent=0, const char *name=0 ); + ~LinkerTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagRadioButtonController *radioController; + FlagPathEditController *pathController; + FlagEditController *editController; +}; + +class LocationsTab : public QWidget +{ +public: + LocationsTab( QWidget *parent=0, const char *name=0 ); + ~LocationsTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagPathEditController *pathController; +}; + +class Locations2Tab : public QWidget +{ +public: + Locations2Tab( QWidget *parent=0, const char *name=0 ); + ~Locations2Tab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagPathEditController *pathController; +}; + +class GeneralTab: public QWidget +{ +public: + GeneralTab( QWidget *parent=0, const char *name=0 ); + ~GeneralTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; + FlagEditController *editController; +}; + +class CodegenTab : public QWidget +{ +public: + CodegenTab( QWidget *parent=0, const char *name=0 ); + ~CodegenTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; + FlagEditController *listController; + FlagRadioButtonController *radioController; +}; + +class DebugOptimTab : public QWidget +{ + Q_OBJECT +public: + DebugOptimTab( QWidget *parent=0, const char *name=0 ); + ~DebugOptimTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; + FlagRadioButtonController *radioController; + + FlagCheckBox *gdb; + FlagCheckBox *namespacedb; + FlagCheckBox *symboldb; + +private slots: + void setReleaseOptions(); + void setDebugOptions(); +}; + +#endif diff --git a/languages/pascal/compiler/fpcoptions/Makefile.am b/languages/pascal/compiler/fpcoptions/Makefile.am new file mode 100644 index 00000000..2868bd01 --- /dev/null +++ b/languages/pascal/compiler/fpcoptions/Makefile.am @@ -0,0 +1,20 @@ +# Here resides the gcc option dialog plugin. + +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extras \ + -I$(top_srcdir)/lib/widgets $(all_includes) + +kde_module_LTLIBRARIES = libkdevfpcoptions.la +libkdevfpcoptions_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) +libkdevfpcoptions_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/lib/widgets/libkdevwidgets.la $(top_builddir)/lib/interfaces/extras/libkdevextras.la $(LIB_KHTML) + +libkdevfpcoptions_la_SOURCES = fpcoptionsplugin.cpp optiontabs.cpp + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevfpcoptions.desktop + + + + diff --git a/languages/pascal/compiler/fpcoptions/fpcoptionsplugin.cpp b/languages/pascal/compiler/fpcoptions/fpcoptionsplugin.cpp new file mode 100644 index 00000000..6fd73e5f --- /dev/null +++ b/languages/pascal/compiler/fpcoptions/fpcoptionsplugin.cpp @@ -0,0 +1,126 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 + +#include +#include + +#include "optiontabs.h" +#include "fpcoptionsplugin.h" + +K_EXPORT_COMPONENT_FACTORY( libkdevfpcoptions, KGenericFactory( "kdevfpcoptions" ) ) + +FpcOptionsPlugin::FpcOptionsPlugin(QObject *parent, const char *name, const QStringList& /*args*/) + : KDevCompilerOptions(parent, name) +{ +} + +FpcOptionsPlugin::~FpcOptionsPlugin() +{ +} + +QString FpcOptionsPlugin::exec(QWidget *parent, const QString &flags) +{ + FpcOptionsDialog *dlg = new FpcOptionsDialog(parent, "fpc options dialog"); + QString newFlags = flags; + dlg->setFlags(flags); + if (dlg->exec() == QDialog::Accepted) + newFlags = dlg->flags(); + delete dlg; + return newFlags; +} + + + +FpcOptionsDialog::FpcOptionsDialog( QWidget *parent, const char *name ) + : KDialogBase(Tabbed, i18n("Free Pascal Compiler Options"), Ok|Cancel, Ok, parent, name, true) +{ + QVBox *vbox; + + vbox = addVBoxPage(i18n("Language")); + language = new LanguageTab(vbox, "language tab"); + + vbox = addVBoxPage(i18n("Locations I")); + directories = new FilesAndDirectoriesTab(vbox, "directories tab"); + + vbox = addVBoxPage(i18n("Locations II")); + directories2 = new FilesAndDirectoriesTab2(vbox, "directories2 tab"); + + vbox = addVBoxPage(i18n("Debug && Optimization")); + debug_optim = new DebugOptimTab(vbox, "debug_optim tab"); + + vbox = addVBoxPage(i18n("Code Generation")); + codegen = new CodegenTab(vbox, "codegen tab"); + + vbox = addVBoxPage(i18n("Assembler")); + assembler = new AssemblerTab(vbox, "assembler tab"); + + vbox = addVBoxPage(i18n("Linker")); + linker = new LinkerTab(vbox, "linker tab"); + + vbox = addVBoxPage(i18n("Feedback")); + feedback = new FeedbackTab(vbox, "feedback tab"); + + vbox = addVBoxPage(i18n("Miscellaneous")); + misc = new MiscTab(vbox, "miscellaneous tab"); +} + +FpcOptionsDialog::~FpcOptionsDialog() +{ +} + +void FpcOptionsDialog::setFlags(const QString &flags) +{ + QStringList flaglist = QStringList::split(" ", flags); + + feedback->readFlags(&flaglist); + language->readFlags(&flaglist); + assembler->readFlags(&flaglist); + linker->readFlags(&flaglist); + codegen->readFlags(&flaglist); + debug_optim->readFlags(&flaglist); + directories->readFlags(&flaglist); + directories2->readFlags(&flaglist); + misc->readFlags(&flaglist); + unrecognizedFlags = flaglist; +} + +QString FpcOptionsDialog::flags() const +{ + QStringList flaglist; + + language->writeFlags(&flaglist); + directories->writeFlags(&flaglist); + directories2->writeFlags(&flaglist); + debug_optim->writeFlags(&flaglist); + codegen->writeFlags(&flaglist); + assembler->writeFlags(&flaglist); + linker->writeFlags(&flaglist); + feedback->writeFlags(&flaglist); + misc->writeFlags(&flaglist); + + QString flags; + QStringList::ConstIterator li; + for (li = flaglist.begin(); li != flaglist.end(); ++li) { + flags += (*li); + flags += " "; + } + + for (li = unrecognizedFlags.begin(); li != unrecognizedFlags.end(); ++li) { + flags += (*li); + flags += " "; + } + + flags.truncate(flags.length()-1); + return flags; +} + +#include "fpcoptionsplugin.moc" diff --git a/languages/pascal/compiler/fpcoptions/fpcoptionsplugin.h b/languages/pascal/compiler/fpcoptions/fpcoptionsplugin.h new file mode 100644 index 00000000..f6b15fff --- /dev/null +++ b/languages/pascal/compiler/fpcoptions/fpcoptionsplugin.h @@ -0,0 +1,63 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 DCCOPTIONSPLUGIN_H +#define DCCOPTIONSPLUGIN_H + +#include + +#include "kdevcompileroptions.h" + +class FpcOptionsPlugin : public KDevCompilerOptions +{ + Q_OBJECT + +public: + FpcOptionsPlugin( QObject *parent, const char *name, const QStringList &args ); + ~FpcOptionsPlugin(); + + virtual QString exec(QWidget *parent, const QString &flags); +}; + + +class FeedbackTab; +class FilesAndDirectoriesTab; +class LanguageTab; +class CodegenTab; + +class FpcOptionsDialog : public KDialogBase +{ +public: + FpcOptionsDialog( QWidget *parent=0, const char *name=0 ); + ~FpcOptionsDialog(); + + void setFlags(const QString &flags); + QString flags() const; + +private: +/* GeneralTab *general; + OptimizationTab *optimization; + G77Tab *g77; + Warnings1Tab *warnings1; + Warnings2Tab *warnings2;*/ + + FeedbackTab *feedback; + FilesAndDirectoriesTab *directories; + FilesAndDirectoriesTab2 *directories2; + DebugOptimTab *debug_optim; + LanguageTab *language; + CodegenTab *codegen; + AssemblerTab *assembler; + LinkerTab *linker; + MiscTab *misc; + QStringList unrecognizedFlags; +}; + +#endif diff --git a/languages/pascal/compiler/fpcoptions/kdevfpcoptions.desktop b/languages/pascal/compiler/fpcoptions/kdevfpcoptions.desktop new file mode 100644 index 00000000..246cf08b --- /dev/null +++ b/languages/pascal/compiler/fpcoptions/kdevfpcoptions.desktop @@ -0,0 +1,55 @@ +[Desktop Entry] +Type=Service +Exec=fpc +Comment=Free Pascal Compiler +Comment[br]=Dastumer Pascal dieub +Comment[ca]=Compilador Free Pascal +Comment[da]=Free Pascal oversætter +Comment[el]=Μεταγλωττιστής Free Pascal +Comment[es]=Compilador Free Pascal +Comment[et]=Free Pascal kompilaator +Comment[eu]=Free Pascal konpiladorea +Comment[fa]=مترجم آزاد پاسکال +Comment[fr]=Compilateur Free Pascal +Comment[ga]=Tiomsaitheoir Saor Pascal +Comment[gl]=Compilador Free Pascal +Comment[hi]=फà¥à¤°à¥€ पॉसà¥à¤•à¤² कमà¥à¤ªà¤¾à¤¯à¤²à¤° +Comment[hu]=Szabad forráskódú Pascal fordítóprogram +Comment[is]=Frjáls Pascal þýðandi +Comment[it]=Compilatore per Free Pascal +Comment[ja]=Free Pascal コンパイラ +Comment[nds]=Free Pascal-Kompilerer +Comment[ne]=सà¥à¤µà¤¤à¤¨à¥à¤¤à¥à¤° पासà¥à¤•à¤² कमà¥à¤ªà¤¾à¤‡à¤²à¤° +Comment[nl]=Free Pascal-compiler +Comment[pt]=Compilador Free Pascal +Comment[pt_BR]=Compilador Free Pascal +Comment[ru]=КомпилÑтор Free Pascal +Comment[sk]=Voľný Pascal kompilátor +Comment[sl]=Prevajalnik za Free Pascal +Comment[sr]=Слободни преводилац Pascal-а +Comment[sr@Latn]=Slobodni prevodilac Pascal-a +Comment[sv]=Fri Pascal-kompilator +Comment[ta]=இலவச பாஸà¯à®•à®²à¯ தொகà¯à®ªà¯à®ªà®¿ +Comment[tg]=Талфифгари Free Pascal +Comment[tr]=Serbest Pascal Derleyicisi +Comment[zh_CN]=Free Pascal 编译器 +Comment[zh_TW]=Free Pascal 編譯器 +Name=FpcOptions +Name[da]=Free Pascal oversætter indstillinger +Name[de]=Fpc-Einstellungen (KDevelop) +Name[hi]=à¤à¤«à¤ªà¥€à¤¸à¥€-विकलà¥à¤ª +Name[nds]=Fpc-Optschonen (KDevelop) +Name[pl]=Opcje Fpc +Name[sk]=Fpc možnosti +Name[sl]=Možnosti Fpc +Name[sv]=Alternativ för fpc +Name[ta]=Fpcவிரà¯à®ªà¯à®ªà®™à¯à®•à®³à¯ +Name[tg]=FpcИнтихобҳо +Name[zh_TW]=Fpc é¸é … +ServiceTypes=KDevelop/CompilerOptions +X-KDE-Library=libkdevfpcoptions +X-KDevelop-Version=5 +X-KDevelop-Language=Pascal +X-KDevelop-Args=fpc +X-KDevelop-Default=true + diff --git a/languages/pascal/compiler/fpcoptions/optiontabs.cpp b/languages/pascal/compiler/fpcoptions/optiontabs.cpp new file mode 100644 index 00000000..2579cb3c --- /dev/null +++ b/languages/pascal/compiler/fpcoptions/optiontabs.cpp @@ -0,0 +1,657 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "flagboxes.h" + +#include "optiontabs.h" + +FeedbackTab::FeedbackTab(QWidget *parent, const char *name) + : QWidget(parent, name), controller(new FlagCheckBoxController(QStringList::split(",","-v"))) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + QVButtonGroup *output_group = new QVButtonGroup(i18n("Output"), this); + new FlagCheckBox(output_group, controller, + "-vr", i18n("Format errors like GCC does")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + QVButtonGroup *verbose_group = new QVButtonGroup(i18n("Verbose"), this); + new FlagCheckBox(verbose_group, controller, + "-va", i18n("Write all possible info")); + new FlagCheckBox(verbose_group, controller, + "-v0", i18n("Write no messages")); + new FlagCheckBox(verbose_group, controller, + "-ve", i18n("Show only errors")); + new FlagCheckBox(verbose_group, controller, + "-vi", i18n("Show some general information")); + new FlagCheckBox(verbose_group, controller, + "-vw", i18n("Issue warnings")); + new FlagCheckBox(verbose_group, controller, + "-vn", i18n("Issue notes")); + new FlagCheckBox(verbose_group, controller, + "-vh", i18n("Issue hints")); + new FlagCheckBox(verbose_group, controller, + "-vd", i18n("Write other debugging info")); + + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + QVButtonGroup *other_group = new QVButtonGroup(i18n("Other Information"), this); + new FlagCheckBox(other_group, controller, + "-vl", i18n("Show line numbers when processing files")); + new FlagCheckBox(other_group, controller, + "-vu", i18n("Print information on loaded units")); + new FlagCheckBox(other_group, controller, + "-vt", i18n("Print the names of loaded files")); + new FlagCheckBox(other_group, controller, + "-vm", i18n("Write which macros are defined")); + new FlagCheckBox(other_group, controller, + "-vc", i18n("Warn when processing a conditional")); + new FlagCheckBox(other_group, controller, + "-vp", i18n("Print the names of procedures and functions")); + new FlagCheckBox(other_group, controller, + "-vb", i18n("Show all procedure declarations if an overloaded function error occurs")); + + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + layout->addStretch(); +} + +FeedbackTab::~FeedbackTab() +{ + delete controller; +} + +void FeedbackTab::readFlags(QStringList *list) +{ + controller->readFlags(list); +} + +void FeedbackTab::writeFlags(QStringList *list) +{ + controller->writeFlags(list); +} + + + +FilesAndDirectoriesTab::FilesAndDirectoriesTab( QWidget * parent, const char * name ) + :QWidget(parent, name), controller(new FlagCheckBoxController()), + pathController(new FlagPathEditController()) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + new FlagPathEdit(this, ":", pathController, + "-Fu", i18n("Unit search path (delimited by \":\"):")); + new FlagPathEdit(this, ":", pathController, + "-Fi", i18n("Include file search path (delimited by \":\"):")); + new FlagPathEdit(this, ":", pathController, + "-Fo", i18n("Object file search path (delimited by \":\"):")); + new FlagPathEdit(this, ":", pathController, + "-Fl", i18n("Library search path (delimited by \":\"):")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addStretch(); +} + +FilesAndDirectoriesTab::~FilesAndDirectoriesTab( ) +{ + delete controller; + delete pathController; +} + +void FilesAndDirectoriesTab::readFlags( QStringList * str ) +{ + controller->readFlags(str); + pathController->readFlags(str); +} + +void FilesAndDirectoriesTab::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); + pathController->writeFlags(str); +} + +FilesAndDirectoriesTab2::FilesAndDirectoriesTab2( QWidget * parent, const char * name ) + :QWidget(parent, name), controller(new FlagCheckBoxController()), + pathController(new FlagPathEditController()) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + new FlagPathEdit(this, "", pathController, + "-FE", i18n("Write executables and units in:")); + new FlagPathEdit(this, "", pathController, + "-FU", i18n("Write units in:")); + new FlagPathEdit(this, "", pathController, + "-o", i18n("Executable name:"), KFile::File); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(20); + + new FlagPathEdit(this, "", pathController, + "-e", i18n("Location of as and ld programs:")); + new FlagPathEdit(this, "", pathController, + "-FL", i18n("Dynamic linker executable:"), KFile::File); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(20); + + new FlagPathEdit(this, "", pathController, + "-Fr", i18n("Compiler messages file:"), KFile::File); + new FlagPathEdit(this, "", pathController, + "-Fe", i18n("Write compiler messages to file:"), KFile::File); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + layout->addStretch(); +} + +FilesAndDirectoriesTab2::~FilesAndDirectoriesTab2( ) +{ + delete controller; + delete pathController; +} + +void FilesAndDirectoriesTab2::readFlags( QStringList * str ) +{ + controller->readFlags(str); + pathController->readFlags(str); +} + +void FilesAndDirectoriesTab2::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); + pathController->writeFlags(str); +} + + +LanguageTab::LanguageTab( QWidget * parent, const char * name ) + : QWidget(parent, name), controller(new FlagCheckBoxController(QStringList::split(",","-v"))) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + QVButtonGroup *compat_group = new QVButtonGroup(i18n("Pascal Compatibility"), this); + new FlagCheckBox(compat_group, controller, + "-S2", i18n("Switch on Delphi 2 extensions")); + new FlagCheckBox(compat_group, controller, + "-Sd", i18n("Strict Delphi compatibility mode")); + new FlagCheckBox(compat_group, controller, + "-So", i18n("Borland TP 7.0 compatibility mode")); + new FlagCheckBox(compat_group, controller, + "-Sp", i18n("GNU Pascal compatibility mode")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + QVButtonGroup *ccompat_group = new QVButtonGroup(i18n("C/C++ Compatibility"), this); + new FlagCheckBox(ccompat_group, controller, + "-Sc", i18n("Support C style operators *=, +=, /=, -=")); + new FlagCheckBox(ccompat_group, controller, + "-Si", i18n("Support C++ style INLINE")); + new FlagCheckBox(ccompat_group, controller, + "-Sm", i18n("Support C style macros")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + QVButtonGroup *lang_group = new QVButtonGroup(i18n("Language"), this); + new FlagCheckBox(lang_group, controller, + "-Sg", i18n("Support the label and goto commands")); + new FlagCheckBox(lang_group, controller, + "-Sh", i18n("Use ansistrings by default for strings")); + new FlagCheckBox(lang_group, controller, + "-Ss", i18n("Require the name of constructors to be init\n and the name of destructors to be done")); + new FlagCheckBox(lang_group, controller, + "-St", i18n("Allow the static keyword in objects")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + layout->addStretch(); +} + + LanguageTab::~ LanguageTab( ) +{ + delete controller; +} + +void LanguageTab::readFlags( QStringList * str ) +{ + controller->readFlags(str); +} + +void LanguageTab::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); +} + +AssemblerTab::AssemblerTab( QWidget * parent, const char * name ) + : QWidget(parent, name), controller(new FlagCheckBoxController()), + asmController(new FlagRadioButtonController) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); +// layout->setAutoAdd(true); + + QBoxLayout *layout2 = new QHBoxLayout(layout, KDialog::spacingHint()); + + QVButtonGroup *info_group = new QVButtonGroup(i18n("Assembler Info"), this); + new FlagCheckBox(info_group, controller, + "-a", i18n("Do not delete assembler files")); + new FlagCheckBox(info_group, controller, + "-al", i18n("List source")); + new FlagCheckBox(info_group, controller, + "-ar", i18n("List register allocation and release info")); + new FlagCheckBox(info_group, controller, + "-at", i18n("List temporary allocations and deallocations")); + layout2->addWidget(info_group); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + //layout->addSpacing(10); + + QVButtonGroup *asmkind_group = new QVButtonGroup(i18n("Assembler Reader"), this); + QRadioButton *m_defaultkind = new QRadioButton(i18n("Use default reader"), asmkind_group); + m_defaultkind->setChecked(true); + new FlagRadioButton(asmkind_group, asmController, + "-Ratt", i18n("AT&T style assembler")); + new FlagRadioButton(asmkind_group, asmController, + "-Rintel", i18n("Intel style assembler")); + new FlagRadioButton(asmkind_group, asmController, + "-Rdirect", i18n("Direct assembler")); + layout2->addWidget(asmkind_group); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + + QVButtonGroup *asm_group = new QVButtonGroup(i18n("Assembler Output"), this); + new FlagCheckBox(asm_group, controller, + "-P", i18n("Use pipes instead of files when assembling")); + QRadioButton *m_default = new QRadioButton(i18n("Use default output"), asm_group); + m_default->setChecked(true); + new FlagRadioButton(asm_group, asmController, + "-Aas", i18n("Use GNU as")); + new FlagRadioButton(asm_group, asmController, + "-Aasout", i18n("Use GNU asaout")); + new FlagRadioButton(asm_group, asmController, + "-Anasmcoff", i18n("Use NASM coff")); + new FlagRadioButton(asm_group, asmController, + "-Anasmelf", i18n("Use NASM elf")); + new FlagRadioButton(asm_group, asmController, + "-Anasmobj", i18n("Use NASM obj")); + new FlagRadioButton(asm_group, asmController, + "-Amasm", i18n("Use MASM")); + new FlagRadioButton(asm_group, asmController, + "-Atasm", i18n("Use TASM")); + new FlagRadioButton(asm_group, asmController, + "-Acoff", i18n("Use coff")); + new FlagRadioButton(asm_group, asmController, + "-Apecoff", i18n("Use pecoff")); + layout->addWidget(asm_group); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + layout->addStretch(); +} + + AssemblerTab::~ AssemblerTab( ) +{ + delete controller; + delete asmController; +} + +void AssemblerTab::readFlags( QStringList * str ) +{ + controller->readFlags(str); + asmController->readFlags(str); +} + +void AssemblerTab::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); + asmController->writeFlags(str); +} + + + +DebugOptimTab::DebugOptimTab( QWidget * parent, const char * name ) + : QWidget(parent, name), controller(new FlagCheckBoxController()), + optimController(new FlagRadioButtonController) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); +// layout->setAutoAdd(true); + + QBoxLayout *layout2 = new QHBoxLayout(layout, KDialog::spacingHint()); + + QBoxLayout *layout3 = new QVBoxLayout(layout2, KDialog::spacingHint()); + + QVButtonGroup *debug_group = new QVButtonGroup(i18n("Debugging"), this); + new FlagCheckBox(debug_group, controller, + "-g", i18n("Generate information for GDB"), "-!g"); + new FlagCheckBox(debug_group, controller, + "-gd", i18n("Generate information for DBX"), "-!gd"); + new FlagCheckBox(debug_group, controller, + "-gl", i18n("Use lineinfo unit"), "-!gl"); + new FlagCheckBox(debug_group, controller, + "-gh", i18n("Use heaptrc unit"), "-!gh"); + new FlagCheckBox(debug_group, controller, + "-gc", i18n("Generate checks for pointers"), "-!gc"); + layout3->addWidget(debug_group); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout3->addSpacing(10); + + QVButtonGroup *profile_group = new QVButtonGroup(i18n("Profiling"), this); + new FlagCheckBox(profile_group, controller, + "-pg", i18n("Generate profiler code for gprof"), "-!pg"); + layout3->addWidget(profile_group); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout3->addSpacing(10); + + QBoxLayout *layout4 = new QVBoxLayout(layout2, KDialog::spacingHint()); + + QVButtonGroup *optim_group1 = new QVButtonGroup(i18n("General Optimization"), this); + m_default = new QRadioButton(i18n("Default"), optim_group1); + m_default->setChecked(true); + new FlagRadioButton(optim_group1, optimController, + "-Og", i18n("Generate smaller code")); + optim1 = new FlagRadioButton(optim_group1, optimController, + "-OG", i18n("Generate faster code")); + layout4->addWidget(optim_group1); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout4->addSpacing(10); + + QVButtonGroup *optim_group2 = new QVButtonGroup(i18n("Optimization Levels"), this); + m_default2 = new QRadioButton(i18n("Default"), optim_group2); + m_default2->setChecked(true); + new FlagRadioButton(optim_group2, optimController, + "-O1", i18n("Level 1")); + new FlagRadioButton(optim_group2, optimController, + "-O2", i18n("Level 2")); + optim2 = new FlagRadioButton(optim_group2, optimController, + "-O3", i18n("Level 3")); + layout4->addWidget(optim_group2); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout4->addSpacing(10); + + QHBoxLayout *layout5 = new QHBoxLayout(layout, KDialog::spacingHint()); + + QVButtonGroup *optim_group3 = new QVButtonGroup(i18n("Architecture"), this); + m_default3 = new QRadioButton(i18n("Default"), optim_group3); + m_default3->setChecked(true); + new FlagRadioButton(optim_group3, optimController, + "-Op1", i18n("386/486")); + new FlagRadioButton(optim_group3, optimController, + "-Op2", i18n("Pentium/PentiumMMX")); + new FlagRadioButton(optim_group3, optimController, + "-Op2", i18n("PentiumPro/PII/Cyrix 6x86/K6")); + layout5->addWidget(optim_group3); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + QVButtonGroup *optim_group4 = new QVButtonGroup(i18n("Another Optimization"), this); + new FlagCheckBox(optim_group4, controller, + "-Or", i18n("Use register variables"), "-!Or"); + new FlagCheckBox(optim_group4, controller, + "-Ou", i18n("Uncertain optimizations"), "-!Ou"); + layout5->addWidget(optim_group4); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + QHBoxLayout *layout6 = new QHBoxLayout(layout, KDialog::spacingHint()); + QPushButton *release = new QPushButton(i18n("Release"), this); + QPushButton *debug = new QPushButton(i18n("Debug"), this); + layout6->addWidget(release); + layout6->addWidget(debug); + connect(release, SIGNAL(clicked()), this, SLOT(setReleaseOptions())); + connect(debug, SIGNAL(clicked()), this, SLOT(setDebugOptions())); + + layout->addStretch(); +} + + DebugOptimTab::~ DebugOptimTab( ) +{ + delete controller; + delete optimController; +} + +void DebugOptimTab::readFlags( QStringList * str ) +{ + controller->readFlags(str); + optimController->readFlags(str); +} + +void DebugOptimTab::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); + optimController->writeFlags(str); +} + +void DebugOptimTab::setReleaseOptions() +{ + m_default->setChecked(true); + m_default2->setChecked(true); +// m_default3->setChecked(true); + QStringList sl = QStringList::split(",", "-!g,-!gd,-!gl,-!gh,-!gc,-!pg,-!Ou,-!Or"); + readFlags(&sl); + optim1->setChecked(true); + optim2->setChecked(true); +} + +void DebugOptimTab::setDebugOptions() +{ + QStringList sl = QStringList::split(",", "-g,-gl,-gh,-gc"); + readFlags(&sl); + m_default->setChecked(true); + m_default2->setChecked(true); +// m_default3->setChecked(true); +} + +CodegenTab::CodegenTab( QWidget * parent, const char * name ) + : QWidget(parent, name), controller(new FlagCheckBoxController()), + listController(new FlagEditController()) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + QVButtonGroup *compile_group = new QVButtonGroup(i18n("Compile Time Checks"), this); + new FlagCheckBox(compile_group, controller, + "-Sa", i18n("Include assert statements in compiled code")); + new FlagCheckBox(compile_group, controller, + "-Un", i18n("Do not check the unit name for being the same as the file name")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + QVButtonGroup *run_group = new QVButtonGroup(i18n("Run Time Checks"), this); + new FlagCheckBox(run_group, controller, + "-Cr", i18n("Range checking")); + new FlagCheckBox(run_group, controller, + "-Ct", i18n("Stack checking")); + new FlagCheckBox(run_group, controller, + "-Ci", i18n("Input/Output checking")); + new FlagCheckBox(run_group, controller, + "-Co", i18n("Integer overflow checking")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + new FlagListEdit(this, ":", listController, "-d", i18n("Conditional defines (delimited by \":\"):")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + new FlagListEdit(this, ":", listController, "-u", i18n("Undefine conditional defines (delimited by \":\"):")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + new FlagSpinEdit(this, 1024, 67107840, 1, 131072, listController, + "-Cs", i18n("Stack size:")); + new FlagSpinEdit(this, 1024, 67107840, 1, 2097152, listController, + "-Ch", i18n("Heap size:")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + layout->addStretch(); +} + +CodegenTab::~ CodegenTab( ) +{ + delete controller; + delete listController; +} + +void CodegenTab::readFlags( QStringList * str ) +{ + controller->readFlags(str); + listController->readFlags(str); +} + +void CodegenTab::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); + listController->writeFlags(str); +} + +LinkerTab::LinkerTab( QWidget * parent, const char * name ) + : QWidget(parent, name), controller(new FlagCheckBoxController()), + listController(new FlagEditController()) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + + QBoxLayout *layout2 = new QHBoxLayout(layout, KDialog::spacingHint()); + + QVButtonGroup *link_group = new QVButtonGroup(i18n("Linking Stage"), this); + new FlagCheckBox(link_group, controller, + "-CD", i18n("Create dynamic library")); + new FlagCheckBox(link_group, controller, + "-CX", i18n("Create smartlinked units")); + new FlagCheckBox(link_group, controller, + "-Ur", i18n("Generate release units")); + new FlagCheckBox(link_group, controller, + "-Cn", i18n("Omit the linking stage")); + new FlagCheckBox(link_group, controller, + "-s", i18n("Create assembling and linking script")); + layout2->addWidget(link_group); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + QVButtonGroup *exec_group = new QVButtonGroup(i18n("Executable Generation"), this); + new FlagCheckBox(exec_group, controller, + "-Xs", i18n("Strip the symbols from the executable")); + new FlagCheckBox(exec_group, controller, + "-XS", i18n("Link with static units")); + new FlagCheckBox(exec_group, controller, + "-XX", i18n("Link with smartlinked units")); + new FlagCheckBox(exec_group, controller, + "-XD", i18n("Link with dynamic libraries")); + new FlagCheckBox(exec_group, controller, + "-Xc", i18n("Link with the C library")); + layout2->addWidget(exec_group); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + FlagListEdit *led = new FlagListEdit(this, ":", listController, "-k", i18n("Options passed to the linker (delimited by \":\"):")); + layout->addWidget(led); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + + layout->addStretch(); +} + +LinkerTab::~LinkerTab( ) +{ + delete controller; + delete listController; +} + +void LinkerTab::readFlags( QStringList * str ) +{ + controller->readFlags(str); + listController->readFlags(str); +} + +void LinkerTab::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); + listController->writeFlags(str); +} + +MiscTab::MiscTab( QWidget * parent, const char * name ) + : QWidget(parent, name), controller(new FlagCheckBoxController()), + radioController(new FlagRadioButtonController()), + pathController(new FlagPathEditController()), + editController(new FlagEditController()) +{ + QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + layout->setAutoAdd(true); + + new FlagCheckBox(this, controller, + "-B", i18n("Recompile all used units")); + new FlagCheckBox(this, controller, + "-n", i18n("Do not read default configuration file")); + new FlagPathEdit(this, "", pathController, + "@", i18n("Compiler configuration file:"), KFile::File); + new FlagSpinEdit(this, 1, 1000, 1, 50, editController, + "-Se", i18n("Stop after the error:")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + QVButtonGroup *browser_group = new QVButtonGroup(i18n("Browser Info"), this); + QRadioButton *m_defaultBrowser = new QRadioButton(i18n("No browser info"), browser_group); + m_defaultBrowser->setChecked(true); + new FlagRadioButton(browser_group, radioController, + "-b", i18n("Global browser info")); + new FlagRadioButton(browser_group, radioController, + "-bl", i18n("Global and local browser info")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + QVButtonGroup *target_group = new QVButtonGroup(i18n("Target OS"), this); + QRadioButton *m_defaultTarget = new QRadioButton(i18n("Default"), target_group); + m_defaultTarget->setChecked(true); + new FlagRadioButton(target_group, radioController, + "-TGO32V1", i18n("DOS and version 1 of the DJ DELORIE extender")); + new FlagRadioButton(target_group, radioController, + "-TGO32V2", i18n("DOS and version 2 of the DJ DELORIE extender")); + new FlagRadioButton(target_group, radioController, + "-TLINUX", i18n("Linux")); + new FlagRadioButton(target_group, radioController, + "-TOS2", i18n("OS/2 (2.x) using the EMX extender")); + new FlagRadioButton(target_group, radioController, + "-TWIN32", i18n("WINDOWS 32 bit")); + new FlagRadioButton(target_group, radioController, + "-TSUNOS", i18n("SunOS/Solaris")); + new FlagRadioButton(target_group, radioController, + "-TBEOS", i18n("BeOS")); + QApplication::sendPostedEvents(this, QEvent::ChildInserted); + layout->addSpacing(10); + + layout->addStretch(); +} + +MiscTab::~ MiscTab( ) +{ + delete controller; + delete pathController; + delete radioController; + delete editController; +} + +void MiscTab::readFlags( QStringList * str ) +{ + controller->readFlags(str); + radioController->readFlags(str); + pathController->readFlags(str); + editController->readFlags(str); +} + +void MiscTab::writeFlags( QStringList * str ) +{ + controller->writeFlags(str); + radioController->writeFlags(str); + pathController->writeFlags(str); + editController->writeFlags(str); +} + +#include "optiontabs.moc" diff --git a/languages/pascal/compiler/fpcoptions/optiontabs.h b/languages/pascal/compiler/fpcoptions/optiontabs.h new file mode 100644 index 00000000..56109ae2 --- /dev/null +++ b/languages/pascal/compiler/fpcoptions/optiontabs.h @@ -0,0 +1,161 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 OPTIONTABS_H +#define OPTIONTABS_H + +#include + +class QSpinBox; +class QRadioButton; +class FlagRadioButton; +class FlagCheckBoxController; +class FlagRadioButtonController; +class FlagPathEditController; +class FlagEditController; + +class FeedbackTab : public QWidget +{ +public: + FeedbackTab( QWidget *parent=0, const char *name=0 ); + ~FeedbackTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; +}; + +class FilesAndDirectoriesTab: public QWidget +{ +public: + FilesAndDirectoriesTab( QWidget *parent = 0, const char *name = 0); + ~FilesAndDirectoriesTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; + FlagPathEditController *pathController; +}; + +class FilesAndDirectoriesTab2: public QWidget +{ +public: + FilesAndDirectoriesTab2( QWidget *parent = 0, const char *name = 0); + ~FilesAndDirectoriesTab2(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; + FlagPathEditController *pathController; +}; + +class LanguageTab : public QWidget +{ +public: + LanguageTab( QWidget *parent=0, const char *name=0 ); + ~LanguageTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; +}; + +class AssemblerTab : public QWidget +{ +public: + AssemblerTab( QWidget *parent=0, const char *name=0 ); + ~AssemblerTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; + FlagRadioButtonController *asmController; +}; + +class DebugOptimTab : public QWidget +{ + Q_OBJECT +public: + DebugOptimTab( QWidget *parent=0, const char *name=0 ); + ~DebugOptimTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; + FlagRadioButtonController *optimController; + + QRadioButton *m_default; + QRadioButton *m_default2; + QRadioButton *m_default3; + FlagRadioButton *optim1; + FlagRadioButton *optim2; + +private slots: + void setReleaseOptions(); + void setDebugOptions(); +}; + +class CodegenTab : public QWidget +{ +public: + CodegenTab( QWidget *parent=0, const char *name=0 ); + ~CodegenTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; + FlagEditController *listController; +}; + +class LinkerTab : public QWidget +{ +public: + LinkerTab( QWidget *parent=0, const char *name=0 ); + ~LinkerTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; + FlagEditController *listController; +}; + +class MiscTab : public QWidget +{ +public: + MiscTab( QWidget *parent=0, const char *name=0 ); + ~MiscTab(); + + void readFlags(QStringList *str); + void writeFlags(QStringList *str); + +private: + FlagCheckBoxController *controller; + FlagRadioButtonController *radioController; + FlagPathEditController *pathController; + FlagEditController *editController; +}; + +#endif diff --git a/languages/pascal/configproblemreporter.ui b/languages/pascal/configproblemreporter.ui new file mode 100644 index 00000000..a215f7a8 --- /dev/null +++ b/languages/pascal/configproblemreporter.ui @@ -0,0 +1,88 @@ + +ConfigureProblemReporter + + + ConfigureProblemReporter + + + + 0 + 0 + 390 + 306 + + + + + unnamed + + + + bgParserCheckbox + + + &Enable background parsing + + + + + delaySlider + + + 2000 + + + 250 + + + 500 + + + Horizontal + + + NoMarks + + + 250 + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 101 + + + + + + + + bgParserCheckbox + toggled(bool) + ConfigureProblemReporter + bgParserCheckbox_toggled(bool) + + + + kdialog.h + + + init() + destroy() + accept() + bgParserCheckbox_toggled( bool b ) + + + + diff --git a/languages/pascal/doc/Makefile.am b/languages/pascal/doc/Makefile.am new file mode 100644 index 00000000..a7829d08 --- /dev/null +++ b/languages/pascal/doc/Makefile.am @@ -0,0 +1,6 @@ +tocdir = ${kde_datadir}/kdevdocumentation/tocs +toc_DATA = pascal_bugs_fp.toc + +#indexdir = ${kde_datadir}/devdoctreeview/indices +#index_DATA = + diff --git a/languages/pascal/doc/pascal_bugs_fp.toc b/languages/pascal/doc/pascal_bugs_fp.toc new file mode 100644 index 00000000..60be2ec5 --- /dev/null +++ b/languages/pascal/doc/pascal_bugs_fp.toc @@ -0,0 +1,7 @@ + + +Pascal bugs (fp) + + + + diff --git a/languages/pascal/file_templates/Makefile.am b/languages/pascal/file_templates/Makefile.am new file mode 100644 index 00000000..94891c97 --- /dev/null +++ b/languages/pascal/file_templates/Makefile.am @@ -0,0 +1,2 @@ +templatedir = $(kde_datadir)/kdevfilecreate/file-templates +template_DATA = dpr pas-program pas-unit pp-program pp-unit diff --git a/languages/pascal/file_templates/dpr b/languages/pascal/file_templates/dpr new file mode 100644 index 00000000..3f271522 --- /dev/null +++ b/languages/pascal/file_templates/dpr @@ -0,0 +1,12 @@ +{ + Pascal program: $MODULE$ + + Description: + Author: $AUTHOR$ <$EMAIL$>, (C) $YEAR$ + Copyright: See COPYING file that comes with this distribution +} +program $MODULE$; + +begin + +end. diff --git a/languages/pascal/file_templates/pas-program b/languages/pascal/file_templates/pas-program new file mode 100644 index 00000000..3f271522 --- /dev/null +++ b/languages/pascal/file_templates/pas-program @@ -0,0 +1,12 @@ +{ + Pascal program: $MODULE$ + + Description: + Author: $AUTHOR$ <$EMAIL$>, (C) $YEAR$ + Copyright: See COPYING file that comes with this distribution +} +program $MODULE$; + +begin + +end. diff --git a/languages/pascal/file_templates/pas-unit b/languages/pascal/file_templates/pas-unit new file mode 100644 index 00000000..98b52e50 --- /dev/null +++ b/languages/pascal/file_templates/pas-unit @@ -0,0 +1,19 @@ +{ + Pascal unit: $MODULE$ + + Description: + Author: $AUTHOR$ <$EMAIL$>, (C) $YEAR$ + Copyright: See COPYING file that comes with this distribution +} + +unit $MODULE$; + +interface + +implementation + +initialization + +finalization + +end. diff --git a/languages/pascal/file_templates/pp-program b/languages/pascal/file_templates/pp-program new file mode 100644 index 00000000..3f271522 --- /dev/null +++ b/languages/pascal/file_templates/pp-program @@ -0,0 +1,12 @@ +{ + Pascal program: $MODULE$ + + Description: + Author: $AUTHOR$ <$EMAIL$>, (C) $YEAR$ + Copyright: See COPYING file that comes with this distribution +} +program $MODULE$; + +begin + +end. diff --git a/languages/pascal/file_templates/pp-unit b/languages/pascal/file_templates/pp-unit new file mode 100644 index 00000000..98b52e50 --- /dev/null +++ b/languages/pascal/file_templates/pp-unit @@ -0,0 +1,19 @@ +{ + Pascal unit: $MODULE$ + + Description: + Author: $AUTHOR$ <$EMAIL$>, (C) $YEAR$ + Copyright: See COPYING file that comes with this distribution +} + +unit $MODULE$; + +interface + +implementation + +initialization + +finalization + +end. diff --git a/languages/pascal/kdevpascalsupport.desktop b/languages/pascal/kdevpascalsupport.desktop new file mode 100644 index 00000000..e560b8da --- /dev/null +++ b/languages/pascal/kdevpascalsupport.desktop @@ -0,0 +1,84 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Pascal Language Support +Comment[ca]=Suport per al llenguatge Pascal +Comment[da]=Pascal sprogunderstøttelse +Comment[de]=Pascal-Unterstützung für KDevelop +Comment[el]=ΥποστήÏιξη γλώσσας Pascal +Comment[es]=Soporte para el lenguaje Pascal +Comment[et]=Pascali keele toetus +Comment[eu]=Pascal lenguaiaren euskarria +Comment[fa]=پشتیبانی زبان پاسکال +Comment[fr]=Prise en charge du langage Pascal +Comment[ga]=Tacaíocht Pascal +Comment[gl]=Soporte para linguaxe Pascal +Comment[hi]=पासà¥à¤•à¤² भाषा समरà¥à¤¥à¤¨ +Comment[hu]=Támogatás a Pascal nyelv használatához +Comment[is]=Stuðningur við Pascal forritunarmálið +Comment[it]=Supporto per il linguaggio Pascal +Comment[ja]=Pascal 言語サãƒãƒ¼ãƒˆ +Comment[nds]=Ãœnnerstütten för de Spraak Pascal +Comment[ne]=पासà¥à¤•à¤² भाषा समरà¥à¤¥à¤¨ +Comment[nl]=Ondersteuning voor Pascal +Comment[pl]=ObsÅ‚uga jÄ™zyka Pascal +Comment[pt]=Suporte da Linguagem Pascal +Comment[pt_BR]=Suporte à Linguagem Pascal +Comment[ru]=Поддержка Ñзыка Pascal +Comment[sk]=Podpora jazyka Pascal +Comment[sl]=Podpora jeziku pascal +Comment[sr]=Језичка подршка за Pascal +Comment[sr@Latn]=JeziÄka podrÅ¡ka za Pascal +Comment[sv]=Stöd för sprÃ¥ket Pascal +Comment[ta]=பாஸà¯à®•à®²à¯ மொழி ஆதரவ௠+Comment[tg]=ÐÑ€Ó£ намудани забони Pascal Language +Comment[tr]=Pascal Dil DesteÄŸi +Comment[zh_CN]=Pascal è¯­è¨€æ”¯æŒ +Comment[zh_TW]=Pascal èªžè¨€æ”¯æ´ +Name=KDevPascalSupport +Name[da]=KDevelop Pascal-understøttelse +Name[de]=Sprachunterstützung für Pascal (KDevelop) +Name[hi]=के-डेव-पॉसà¥à¤•à¤²-समरà¥à¤¥à¤¨ +Name[nds]=Pascal-Ãœnnerstütten för KDevelop +Name[pl]=KDevObsÅ‚ugaPascala +Name[sk]=KDev Pascal podpora +Name[sv]=KDevelop Pascal-stöd +Name[ta]=கெடெவ௠பாஸà¯à®•à®²à¯ ஆதரவ௠+Name[zh_TW]=KDevelop Pascal æ”¯æ´ +GenericName=Pascal Language Support +GenericName[ca]=Suport per al llenguatge Pascal +GenericName[da]=Pascal sprogunderstøttelse +GenericName[de]=Sprachunterstützung für Pascal +GenericName[el]=ΥποστήÏιξη γλώσσας Pascal +GenericName[es]=Soporte para el lenguaje Pascal +GenericName[et]=Pascali keele toetus +GenericName[eu]=Pascal lenguaiaren euskarria +GenericName[fa]=پشتیبانی زبان پاسکال +GenericName[fr]=Prise en charge du langage PASCAL +GenericName[ga]=Tacaíocht Pascal +GenericName[gl]=Soporte para linguaxe Pascal +GenericName[hi]=पासà¥à¤•à¤² भाषा समरà¥à¤¥à¤¨ +GenericName[hu]=Pascal-támogatás +GenericName[it]=Supporto per il linguaggio Pascal +GenericName[ja]=Pascal 言語サãƒãƒ¼ãƒˆ +GenericName[nds]=Ãœnnerstütten för de Spraak Pascal +GenericName[ne]=पासà¥à¤•à¤² भाषा समरà¥à¤¥à¤¨ +GenericName[nl]=Ondersteuning voor Pascal +GenericName[pl]=ObsÅ‚uga jÄ™zyka Pascal +GenericName[pt]=Suporte à Linguagem Pascal +GenericName[pt_BR]=Suporte à Linguagem Pascal +GenericName[ru]=Поддержка Ñзыка Pascal +GenericName[sk]=Podpora jazyka Pascal +GenericName[sl]=Podpora jezicu pascal +GenericName[sr]=Језичка подршка за Pascal +GenericName[sr@Latn]=JeziÄka podrÅ¡ka za Pascal +GenericName[sv]=Stöd för sprÃ¥ket Pascal +GenericName[ta]=பாஸà¯à®•à®²à¯ மொழி ஆதரவ௠+GenericName[tg]=ÐÑ€Ó£ намудани забони Pascal +GenericName[tr]=Pascal Dil DesteÄŸi +GenericName[zh_CN]=Pascal è¯­è¨€æ”¯æŒ +GenericName[zh_TW]=Pascal èªžè¨€æ”¯æ´ +ServiceTypes=KDevelop/LanguageSupport +X-KDE-Library=libkdevpascalsupport +X-KDevelop-Version=5 +X-KDevelop-Language=Pascal diff --git a/languages/pascal/kdevpascalsupport.rc b/languages/pascal/kdevpascalsupport.rc new file mode 100644 index 00000000..4335b2a6 --- /dev/null +++ b/languages/pascal/kdevpascalsupport.rc @@ -0,0 +1,3 @@ + + + diff --git a/languages/pascal/pascal.g b/languages/pascal/pascal.g new file mode 100644 index 00000000..fde5dcb8 --- /dev/null +++ b/languages/pascal/pascal.g @@ -0,0 +1,1212 @@ +// +// +// Pascal Grammar +// +// Adapted from, +// Pascal User Manual And Report (Second Edition-1978) +// Kathleen Jensen - Niklaus Wirth +// +// By +// +// Hakki Dogusan dogusanh@tr-net.net.tr +// +// Then significantly enhanced by Piet Schoutteten +// with some guidance by Terence Parr. Piet added tree +// construction, and some tree walkers. +// +// +// Turbo Pascal, Free Pascal and Delphi pascal extensions +// by Alexander Dymo +// +// +// Adapted from, +// Free Pascal: Reference Guide 1.9 April 2002 +// +// +// KDevelop 3.0 support by Alexander Dymo +// + +header "pre_include_hpp" { + #include "problemreporter.h" + #include "PascalAST.hpp" + + #include + #include + + #define SET_POSITION(ast,t)\ + { \ + RefPascalAST(ast)->setLine( t->getLine() );\ + RefPascalAST(ast)->setColumn( t->getColumn() ); \ + } +} + +options { + language="Cpp"; +} + +class PascalParser extends Parser; +options { + k = 2; // two token lookahead + exportVocab=Pascal; // Call its vocabulary "Pascal" + codeGenMakeSwitchThreshold = 2; // Some optimizations + codeGenBitsetTestThreshold = 3; + defaultErrorHandler = true; // Generate parser error handlers + buildAST = true; + ASTLabelType = "RefPascalAST"; +} + +/* Define imaginary tokens used to organize tree + * + * One of the principles here is that any time you have a list of + * stuff, you usually want to treat it like one thing (a list) a some + * point in the grammar. You want trees to have a fixed number of children + * as much as possible. For example, the definition of a procedure should + * be something like #(PROCEDURE ID #(ARGDECLS ARG1 ARG2...)) not + * #(PROCEDURE ID ARG1 ARG2 ... ) since this is harder to parse and + * harder to manipulate. Same is true for statement lists (BLOCK) etc... + */ +tokens { + BLOCK; // list of statements + IDLIST; // list of identifiers; e.g., #(PROGRAM #(IDLIST ID ID...)) + ELIST; // expression list for proc args etc... + FUNC_CALL; + PROC_CALL; + SCALARTYPE; // IDLIST that is really a scalar type like (Mon,Tue,Wed) + TYPELIST; // list of types such as for array declarations + VARIANT_TAG;// for CASEs in a RECORD + VARIANT_TAG_NO_ID;// for CASEs in a RECORD (no id, just a type) + VARIANT_CASE;// a case of the variant + CONSTLIST; // List of constants + FIELDLIST; // list of fields in a record + ARGDECLS; // overall group of declarations of args for proc/func. + VARDECL; // declaration of a variable + ARGDECL; // declaration of a parameter + ARGLIST; // list of actual arguments (expressions) + TYPEDECL; // declaration of a type + FIELD; // the root a RECORD field +} + +// Define some methods and variables to use in the generated parser. +{ +private: + unsigned int m_numberOfErrors; + ProblemReporter* m_problemReporter; + +public: + void resetErrors() { m_numberOfErrors = 0; } + unsigned int numberOfErrors() const { return m_numberOfErrors; } + void setProblemReporter( ProblemReporter* r ) { m_problemReporter = r; } + + void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_problemReporter->reportError( ex.getMessage().c_str(), + ex.getFilename().c_str(), + ex.getLine(), + ex.getColumn() ); + ++m_numberOfErrors; + } + + void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_problemReporter->reportError( errorMessage.c_str(), + getFilename().c_str(), + LT(1)->getLine(), + LT(1)->getColumn() ); + ++m_numberOfErrors; + } + + void reportMessage( const ANTLR_USE_NAMESPACE(std)string& message ){ + m_problemReporter->reportMessage( message.c_str(), + getFilename().c_str(), + LT(1)->getLine(), + LT(1)->getColumn() ); + } +} + +compilationUnit + : program + | library + | unit + ; + +program + : programHeading + (usesClause)? + block + DOT! + ; + +library + : LIBRARY^ identifier SEMI! + (usesClause)? + libraryBlock + exportsClause + END! DOT! + ; + +libraryBlock + : declarationPart (statementPart)? + ; + +exportsClause + : EXPORTS^ + exportsList + ; + +exportsList + : exportsEntry ( COMMA! exportsEntry )* (SEMI!)? + ; + +exportsEntry + : identifier ("index" integerConstant)? ("name" stringConstant)? + ; + +usesClause + : USES^ identifierList SEMI! + ; + +unit + : UNIT^ identifier SEMI! + interfacePart + implementationPart + ( (initializationPart (finalizationPart)?) | realizationPart )? + END! + ; + +interfacePart + : INTERFACE^ + (usesClause)? + ( constantDeclarationPart + | typeDeclarationPart + | procedureHeadersPart + )* + ; + +implementationPart + : IMPLEMENTATION^ + (usesClause)? + declarationPart + ; + +realizationPart + : BEGIN^ statement ( SEMI! statement )* + ; + +programHeading + : PROGRAM^ identifier (LPAREN! identifierList RPAREN!)? SEMI! + ; + +initializationPart + : INITIALIZATION^ + statement ( SEMI! statement )* + ; + +finalizationPart + : FINALIZATION^ + statement ( SEMI! statement )* + ; + +block + : declarationPart statementPart + ; + +declarationPart + : (labelDeclarationPart + | constantDeclarationPart + | resourcestringDeclarationPart + | typeDeclarationPart + | variableDeclarationPart + | procedureAndFunctionDeclarationPart + )* + ; + +labelDeclarationPart + : LABEL^ label ( COMMA! label )* SEMI! + ; + +constantDeclarationPart + : CONST^ ( constantDeclaration | typedConstantDeclaration )+ + ; + +resourcestringDeclarationPart + : RESOURCESTRING^ ( stringConstantDeclaration )* + ; + +stringConstantDeclaration + : identifier EQUAL! string + ; + +typeDeclarationPart + : TYPE^ ( typeDeclaration )+ + ; + +variableDeclarationPart + : VAR^ variableDeclaration ( SEMI! variableDeclaration )* SEMI! + ; + +variableDeclaration + : identifierList c:COLON^ {#c->setType(VARDECL);} type + ; + +procedureAndFunctionDeclarationPart + : procedureAndFunctionDeclaration + ; + +procedureAndFunctionDeclaration + : procedureDeclaration + | functionDeclaration + | constructorDeclaration + | destructorDeclaration + ; + +statementPart + : compoundStatement + ; + +procedureDeclaration + : procedureHeader subroutineBlock SEMI! + ; + +procedureHeadersPart + : procedureHeader | functionHeader // ) SEMI! ( callModifiers SEMI! ) + ; + +procedureHeader + : PROCEDURE^ ( identifier | qualifiedMethodIdentifier ) + (formalParameterList)? SEMI! (modifiers SEMI!)* + ; + +qualifiedMethodIdentifier + : identifier COLON! COLON! identifier + ; + +subroutineBlock + : block + | externalDirective +// | asmBlock + | FORWARD! + ; + +functionDeclaration + : functionHeader subroutineBlock SEMI! + ; + +functionHeader + : (FUNCTION^ identifier COLON! type SEMI!)=> FUNCTION^ identifier COLON! type SEMI! (modifiers SEMI!)* + | (FUNCTION^ identifier COLON! COLON! identifier COLON! type SEMI!)=> FUNCTION^ qualifiedMethodIdentifier COLON! type SEMI! (modifiers SEMI!)* + | (FUNCTION^ identifier COLON! COLON! identifier LPAREN!)=> FUNCTION^ qualifiedMethodIdentifier formalParameterList COLON! type SEMI! (modifiers SEMI!)* + | FUNCTION^ identifier formalParameterList COLON! type SEMI! (modifiers SEMI!)* + ; + +functionHeaderEnding + : (COLON! type SEMI!)=> COLON! type SEMI! (modifiers SEMI!)* + | formalParameterList COLON! type SEMI! (modifiers SEMI!)* + ; + +formalParameterList + : LPAREN! parameterDeclaration ( SEMI! parameterDeclaration )* RPAREN! + ; + +parameterDeclaration + : valueParameter + | variableParameter + | constantParameter + ; + +valueParameter + : (identifierList COLON! ARRAY! OF!)=> identifierList COLON! ARRAY! OF! type + | identifierList COLON! type + ; + +variableParameter + : VAR identifierList ( untypedParameterPart )? + ; + +untypedParameterPart + : (COLON! ARRAY! OF! type)=> COLON! ARRAY! OF! type + | COLON! type + ; + +constantParameter + : CONST identifierList ( untypedParameterPart )? + ; + +externalDirective + : EXTERNAL^ ( stringConstant ( ("name" stringConstant) | ("index" integerConstant) )? )? + ; + +/*asmBlock + : ASSEMBLER^ SEMI! declarationPart asmStatement + ; +*/ +modifiers + : PUBLIC! | (ALIAS! stringConstant) | INTERRUPT! | callModifiers | EXPORT! + ; + +callModifiers + : REGISTER! | PASCAL! | CDECL! | STDCALL! | POPSTACK! | SAVEREGISTERS! | INLINE! | SAFECALL! | NEAR! | FAR! + ; + +constantDeclaration +// : ( identifier EQUAL! expression SEMI! ) ( identifier EQUAL! expression SEMI! )* + : identifier EQUAL! expression SEMI! + ; + +typedConstantDeclaration +// : ( identifier COLON! type EQUAL! typedConstant SEMI! )+ + : identifier COLON! type EQUAL! typedConstant SEMI! + ; + +//FIXME: is there a better way to handle this instead of simply forcing the rules +typedConstant + : (constant)=> constant +// | addressConstant + | (LPAREN! identifier COLON!)=> recordConstant + | (arrayConstant)=> arrayConstant + | proceduralConstant + ; + +arrayConstant + : LPAREN! ( constant | arrayConstant ) ( COMMA! ( constant | arrayConstant ) )* RPAREN! + ; + +recordConstant + : LPAREN! ( identifier COLON! constant ) ( SEMI! ( identifier COLON! constant ) )* RPAREN! + ; + +addressConstant + : NUM_INT + ; + +proceduralConstant + : expression + ; + +typeDeclaration + : identifier EQUAL! type SEMI! + ; + +type +// : simpleType | subrangeType | enumeratedType | stringType | structuredType | pointerType | proceduralType | typeIdentifier + : simpleType | subrangeTypeOrTypeIdentifier | enumeratedType | stringType | structuredType | pointerType | proceduralType + ; + +simpleType + : ordinalType | realType + ; + +ordinalType + : INTEGER! | SHORTINT! | SMALLINT! | LONGINT! | INT64! | BYTE! | WORD! | CARDINAL! | QWORD! + | BOOLEAN! | BYTEBOOL! | LONGBOOL! | CHAR! + ; + +subrangeTypeOrTypeIdentifier + : constant (DOTDOT! constant)? + ; + +typeIdentifier + : identifier + ; + +subrangeType + : constant DOTDOT! constant + ; + +enumeratedType + : (LPAREN! identifier ASSIGN!)=> LPAREN! assignedEnumList RPAREN! + | LPAREN! identifierList RPAREN! + ; + +assignedEnumList + : (identifier ASSIGN! expression) ( COMMA! (identifier ASSIGN! expression) )* + ; + +realType + : REAL! | SINGLE! | DOUBLE! | EXTENDED! | COMP! + ; + +stringType + : STRING^ ( LBRACK! unsignedInteger RBRACK! )? + ; + +structuredType + : (PACKED!)? ( arrayType | recordType | objectType | classType | setType | fileType ) + ; + +arrayType + : ARRAY^ LBRACK! arrayIndexType ( COMMA! arrayIndexType )* RBRACK! OF! type + ; + +arrayIndexType + : ordinalType + | (expression DOTDOT!)=> arraySubrangeType + | enumeratedType + ; + +arraySubrangeType + : expression DOTDOT! expression + ; + +recordType + : RECORD^ (fieldList)* END! + ; + +fieldList + : fixedField | variantPart + ; + +fixedField + : identifierList COLON! type SEMI! + ; + +variantPart + : CASE^ (identifier COLON!)? identifier OF! variant ( SEMI! variant )* + ; + +variant + : (constant COMMA!)+ COLON! LPAREN! (fieldList)* RPAREN! + ; + +setType + : SET^ OF! ordinalType + ; + +fileType + : FILE^ OF! type + ; + +pointerType + : POINTER^ typeIdentifier + ; + +proceduralType + : (proceduralTypePart1 SEMI!)=> proceduralTypePart1 SEMI! callModifiers + | proceduralTypePart1 + ; + +proceduralTypePart1 + : ( functionHeader | procedureHeader ) (OF! OBJECT!)? + ; + +objectType + : OBJECT^ (heritage)? (componentList | objectVisibilitySpecifier ) END! + ; + +heritage + : LPAREN! identifier RPAREN! + ; + +componentList + : ( (fieldDefinition)+ )? ( (methodDefinition)+ )? + ; + +fieldDefinition + : identifierList COLON! type SEMI! + ; + +methodDefinition + : ( functionHeader | procedureHeader | constructorHeader | destructorHeader ) SEMI! methodDirectives + ; + +methodDirectives + : ( VIRTUAL! SEMI! (ABSTRACT! SEMI!)? )? (callModifiers SEMI!)? + ; + +objectVisibilitySpecifier + : PRIVATE! | PROTECTED! | PUBLIC! + ; + +constructorDeclaration + : constructorHeader SEMI! subroutineBlock + ; + +destructorDeclaration + : destructorHeader SEMI! subroutineBlock + ; + +constructorHeader + : CONSTRUCTOR^ ( identifier | qualifiedMethodIdentifier ) formalParameterList + ; + +destructorHeader + : DESTRUCTOR^ ( identifier | qualifiedMethodIdentifier ) formalParameterList + ; + +classType + : CLASS^ (heritage)? (classComponentList | classVisibilitySpecifier ) END! + ; + +classComponentList + : ( (fieldDefinition)+ )? ( ( (classMethodDefinition | propertyDefinition) )+ )? + ; + +classMethodDefinition + : ( ( (CLASS!)? (functionHeader | procedureHeader) ) | constructorHeader | destructorHeader ) SEMI! classMethodDirectives + ; + +classMethodDirectives + : ( directiveVariants SEMI! )? (callModifiers SEMI!)? + ; + +directiveVariants + : ( VIRTUAL! (ABSTRACT! SEMI!)? ) + | OVERRIDE! + | (MESSAGE! (integerConstant | stringConstant)) + ; + +classVisibilitySpecifier + : PRIVATE! | PROTECTED! | PUBLIC! | PUBLISHED! + ; + +propertyDefinition + : PROPERTY^ identifier (propertyInterface)? propertySpecifiers + ; + +propertyInterface + : (propertyParameterList)? COLON! typeIdentifier ("index" integerConstant)? + ; + +propertyParameterList + : LBRACK! parameterDeclaration (SEMI! parameterDeclaration)* RBRACK! + ; + +propertySpecifiers + : (readSpecifier)? (writeSpecifier)? (defaultSpecifier)? + ; + +readSpecifier + : "read" fieldOrMethod + ; + +writeSpecifier + : "write" fieldOrMethod + ; + +defaultSpecifier + : ( DEFAULT (constant)? ) + | "nodefault" + ; + +fieldOrMethod + : identifier + ; + +expression + : simpleExpression ( expressionSign simpleExpression )? + ; + +expressionSign +// : STAR! | LE! | GE! | LTH! | GT! | NOT_EQUAL! | IN! | IS! + : LE! | GE! | LTH! | GT! | NOT_EQUAL! | IN! | IS! | EQUAL! + ; + +simpleExpression + : term ( ( PLUS! | MINUS! | OR! | XOR! ) term )* + ; + +term + : factor ( (STAR! | SLASH! | DIV! | MOD! | AND! | SHL! | SHR!) factor )* + ; + +//TODO: distinguish between identifiers, typecasts and function calls -> semantic predicate +factor + : ( LPAREN! expression RPAREN! ) +// | (qualifiedMethodIdentifier2 LBRACK!)=> qualifiedMethodIdentifier2 LBRACK! arrayIndexType ( COMMA! arrayIndexType )* RBRACK! + | identifierOrValueTypecastOrFunctionCall +// | identifier +// | functionCall + | unsignedConstant + | ( NOT! factor ) + | ( (PLUS! | MINUS!) factor ) + | setConstructor +// | valueTypecast + | addressFactor + | TRUE + | FALSE + | identifier LBRACK! expression ( COMMA! expression )* RBRACK! + ; + +//FIXME: is this correct? +identifierOrValueTypecastOrFunctionCall + : (identifier LPAREN! expression COMMA!)=> identifier LPAREN! expressions RPAREN! + | (identifier LPAREN! expression RPAREN!)=> identifier LPAREN! expression RPAREN! +// | (qualifiedMethodIdentifier2 LPAREN! expression COMMA!)=> qualifiedMethodIdentifier2 LPAREN! expressions RPAREN! +// | (identifier DOT)=> qualifiedMethodIdentifier2 + | identifier + ; + +/*qualifiedMethodIdentifier2 + : identifier DOT identifier + ; +*/ +//( functionIdentifier | methodDesignator | qualifiedMethodDesignator | variableReference ) +functionCall + : identifier (actualParameterList)? + ; + +actualParameterList + : LPAREN! ( expressions )? RPAREN! + ; + +expressions + : expression ( COMMA! expression )* + ; + +setConstructor + : LBRACK! ( setGroup ( COMMA! setGroup )* )? RBRACK! + ; + +setGroup + : expression ( DOT! DOT! expression )? + ; + +valueTypecast + : typeIdentifier LPAREN! expression RPAREN! + ; + +//( variableReference | procedureIdentifier | functionIdentifier | qualifiedMethodIdentifier ) +addressFactor + : AT! identifier + ; + +statement +// : (label COLON!)? (simpleStatement | structuredStatement | asmStatement) + : (label COLON!)? (simpleStatement | structuredStatement) + ; + +simpleStatement + : assignmentStatement | procedureStatement | gotoStatement | raiseStatement + ; + +assignmentStatement + : identifierOrArrayIdentifier assignmentOperator expression + ; + +identifierOrArrayIdentifier + : identifier +// | (qualifiedMethodIdentifier LBRACK!)=> qualifiedMethodIdentifier LBRACK! arrayIndexType ( COMMA! arrayIndexType )* RBRACK! +// | qualifiedMethodIdentifier + | identifier LBRACK! expression ( COMMA! expression )* RBRACK! + ; + +assignmentOperator + : ASSIGN! | PLUSEQ | MINUSEQ | STAREQ | SLASHQE + ; + +procedureStatement + : identifier (actualParameterList)? + ; + +gotoStatement + : GOTO! label + ; + +structuredStatement + : compoundStatement | repetitiveStatement | conditionalStatement | exceptionStatement | withStatement + ; + +conditionalStatement + : ifStatement | caseStatement + ; + +repetitiveStatement + : forStatement | repeatStatement | whileStatement + ; + +compoundStatement + : BEGIN! END! + | BEGIN! (SEMI!)+ END! + | BEGIN! statement (SEMI! (statement)?)* END! + ; + +ifStatement + : IF^ expression THEN! statement + ( + // CONFLICT: the old "dangling-else" problem... + // ANTLR generates proper code matching + // as soon as possible. Hush warning. + options { + generateAmbigWarnings=false; + } + : ELSE! statement + )? + ; + +caseStatement + : CASE^ expression OF! + caseListElement ( SEMI! caseListElement )* + ( SEMI! ELSE! statement ( SEMI! statement )* )? + END! + ; + +caseListElement + : constList COLON^ statement + ; + +constList + : constant ( COMMA! constant )* + {#constList = #([CONSTLIST],#constList);} + ; + +whileStatement + : WHILE^ expression DO! statement + ; + +repeatStatement + : REPEAT^ statement ( SEMI! (statement)? )* UNTIL! expression + ; + +forStatement + : FOR^ identifier ASSIGN! forList DO! statement + ; + +forList + : initialValue (TO^ | DOWNTO^) finalValue + ; + +initialValue + : expression + ; + +finalValue + : expression + ; + +withStatement + : WITH^ recordVariableList DO! statement + ; + +recordVariableList + : variable ( COMMA! variable )* + ; + +/** A variable is an id with a suffix and can look like: + * id + * id[expr,...] + * id.id + * id.id[expr,...] + * id^ + * id^.id + * id^.id[expr,...] + * ... + * + * LL has a really hard time with this construct as it's naturally + * left-recursive. We have to turn into a simple loop rather than + * recursive loop, hence, the suffixes. I keep in the same rule + * for easy tree construction. + */ +variable + : ( AT^ identifier // AT is root of identifier; then other op becomes root + | identifier + ) + ( LBRACK^ expression ( COMMA! expression)* RBRACK! + | LBRACK2^ expression ( COMMA! expression)* RBRACK2! + | DOT^ identifier + | POINTER^ + )* + ; + +/*asmStatement + : ASM^ assemblerCode END! (registerList)? + ; + +registerList + : LBRACK! stringConstant ( COMMA! stringConstant )* + ; + +assemblerCode + : (.)* + ; +*/ +operatorDefinition + : OPERATOR^ ( assignmentOperatorDefinition | arithmeticOperatorDefinition | comparisonOperatorDefinition ) + identifier COLON! type SEMI! subroutineBlock + ; + +assignmentOperatorDefinition + : ASSIGN! LPAREN! valueParameter RPAREN! + ; + +arithmeticOperatorDefinition + : ( PLUS! | MINUS! | STAR! | SLASH! | (STAR! STAR!) ) LPAREN! formalParameterList RPAREN! + ; + +comparisonOperatorDefinition + : ( EQUAL! | LE! | GE! | GT! | LTH! ) LPAREN! formalParameterList RPAREN! + ; + +raiseStatement + : RAISE^ ( functionCall (AT! addressConstant)? )? + ; + +exceptionStatement + : tryStatement + ; + +tryStatement + : TRY^ (statements)? exceptOrFinallyPart END! + ; + +exceptOrFinallyPart + : EXCEPT! (exceptionHandlers)? + | FINALLY! (statements)? + ; + +statements + : statement ( SEMI! statement )* + ; + +exceptionHandlers + : statements | exceptionHandler ( SEMI! exceptionHandler )* ( ELSE! statements )? + ; + +exceptionHandler + : ON! (identifier COLON!)? identifier DO! statement + ; + +identifierList + : identifier ( COMMA! identifier )* + {#identifierList = #(#[IDLIST],#identifierList);} + ; + +label + : unsignedInteger + ; + +unsignedInteger + : NUM_INT + ; + +integerConstant + : unsignedInteger + |! s:sign n:unsignedInteger { #integerConstant=#(s,n); } + ; + +stringConstant + : string | constantChr + ; + +sign + : PLUS | MINUS + ; + +string + : STRING_LITERAL + ; + +constantChr + : CHR^ LPAREN! unsignedInteger RPAREN! + ; + +constant + : unsignedNumber + |! s:sign n:unsignedNumber { #constant=#(s,n); } + | identifier + |! s2:sign id:identifier { #constant=#(s2,id); } + | string + | constantChr + ; + +unsignedConstant + : unsignedNumber | constantChr | string | NIL! + ; + +unsignedNumber + : unsignedInteger + | unsignedReal + ; + +unsignedReal + : NUM_REAL + ; + +identifier + : IDENT + ; + + +//---------------------------------------------------------------------------- +// The Pascal scanner +//---------------------------------------------------------------------------- +class PascalLexer extends Lexer; + +options { + charVocabulary = '\0'..'\377'; + exportVocab = Pascal; // call the vocabulary "Pascal" + testLiterals = false; // don't automatically test for literals + k = 4; // four characters of lookahead + caseSensitive = false; + caseSensitiveLiterals = false; + defaultErrorHandler=false; +} + +tokens { + ABSOLUTE = "absolute" ; + ABSTRACT = "abstract" ; + ALIAS = "alias" ; + AND = "and" ; + ARRAY = "array" ; + AS = "as" ; + ASM = "asm" ; + ASSEMBLER = "assembler" ; + BEGIN = "begin" ; + BREAK = "break" ; + BOOLEAN = "boolean" ; + BYTE = "byte" ; + CARDINAL = "cardinal" ; + CASE = "case" ; + CDECL = "cdecl" ; + CHAR = "char" ; + CHR = "chr" ; + CLASS = "class" ; + COMP = "comp" ; + CONST = "const" ; + CONSTRUCTOR = "constructor" ; + CONTINUE = "continue" ; + DEFAULT = "default" ; + DESTRUCTOR = "destructor" ; + DISPOSE = "dispose" ; + DIV = "div" ; + DO = "do" ; + DOUBLE = "double" ; + DOWNTO = "downto" ; + ELSE = "else" ; + END = "end" ; + EXCEPT = "except" ; + EXPORT = "export" ; + EXPORTS = "exports" ; + EXTENDED = "extended" ; + EXTERNAL = "external" ; + EXIT = "exit" ; + FALSE = "false" ; + FILE = "file" ; + FINALLY = "finally" ; + FAR = "far" ; + FOR = "for" ; + FORWARD = "forward" ; + FUNCTION = "function" ; + GOTO = "goto" ; + IF = "if" ; + IN = "in" ; +// INDEX = "index" ; + IS = "is" ; + INHERITED = "inherited" ; + INLINE = "inline" ; + INT64 = "int64" ; + INTEGER = "integer" ; + LABEL = "label" ; + LIBRARY = "library" ; + LONGINT = "longint" ; + MOD = "mod" ; +// NAME = "name" ; + NEAR = "near" ; + NEW = "new" ; + NIL = "nil" ; + NOT = "not" ; + OBJECT = "object" ; + OF = "of" ; + ON = "on" ; + OPERATOR = "operator" ; + OR = "or" ; + OVERRIDE = "override" ; + PACKED = "packed" ; + PASCAL = "pascal" ; + POPSTACK = "popstack" ; + PRIVATE = "private" ; + PROCEDURE = "procedure" ; + PROTECTED = "protected" ; + PROGRAM = "program" ; + PROPERTY = "property" ; + PUBLIC = "public" ; + PUBLISHED = "published" ; + QWORD = "qword" ; + RAISE = "raise" ; + REAL = "real" ; + RECORD = "record" ; + REGISTER = "register" ; + REPEAT = "repeat" ; + SAFECALL = "safecall" ; + SAVEREGISTERS = "saveregisters" ; + SELF = "self" ; + SET = "set" ; + SHORTINT = "shortint" ; + SHR = "shr" ; + SHL = "shl" ; + SINGLE = "single" ; + SMALLINT = "smallint" ; + STDCALL = "stdcall" ; + THEN = "then" ; + TO = "to" ; + TRUE = "true" ; + TRY = "try" ; + TYPE = "type" ; + UNTIL = "until" ; + VAR = "var" ; + VIRTUAL = "virtual" ; + WHILE = "while" ; + WITH = "with" ; + WORD = "word" ; + XOR = "xor" ; + METHOD ; + ADDSUBOR ; + ASSIGNEQUAL ; + SIGN ; + FUNC ; + NODE_NOT_EMIT ; + MYASTVAR ; + LF ; + UNIT = "unit" ; + INTERFACE = "interface" ; + USES = "uses" ; + STRING = "string" ; + IMPLEMENTATION = "implementation" ; + FINALIZATION = "finalization" ; + INITIALIZATION = "initialization" ; + RESOURCESTRING = "resourcestring" ; +//pspsps ??? +} + +{ +private: + ProblemReporter* m_problemReporter; + unsigned int m_numberOfErrors; + +public: + void resetErrors() { m_numberOfErrors = 0; } + unsigned int numberOfErrors() const { return m_numberOfErrors; } + void setProblemReporter( ProblemReporter* r ) { m_problemReporter = r; } + + virtual void reportError( const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex ){ + m_problemReporter->reportError( ex.getMessage().c_str(), + ex.getFilename().c_str(), + ex.getLine(), + ex.getColumn() ); + ++m_numberOfErrors; + } + + virtual void reportError( const ANTLR_USE_NAMESPACE(std)string& errorMessage ){ + m_problemReporter->reportError( errorMessage.c_str(), + getFilename().c_str(), + getLine(), getColumn() ); + ++m_numberOfErrors; + } + + virtual void reportWarning( const ANTLR_USE_NAMESPACE(std)string& warnMessage ){ + m_problemReporter->reportWarning( warnMessage.c_str(), + getFilename().c_str(), + getLine(), getColumn() ); + } +} + +//---------------------------------------------------------------------------- +// OPERATORS +//---------------------------------------------------------------------------- +PLUS : '+' ; +MINUS : '-' ; +STAR : '*' ; +SLASH : '/' ; +ASSIGN : ":=" ; +COMMA : ',' ; +SEMI : ';' ; +COLON : ':' ; +EQUAL : '=' ; +NOT_EQUAL : "<>" ; +LTH : '<' ; +LE : "<=" ; +GE : ">=" ; +GT : '>' ; +LPAREN : '(' ; +RPAREN : ')' ; +LBRACK : '[' ; // line_tab[line] +LBRACK2 : "(." ; // line_tab(.line.) +RBRACK : ']' ; +RBRACK2 : ".)" ; +POINTER : '^' ; +AT : '@' ; +DOT : '.' ('.' {$setType(DOTDOT);})? ; +LCURLY : "{" ; +RCURLY : "}" ; +PLUSEQ : "+=" ; +MINUSEQ : "-=" ; +STAREQ : "*=" ; +SLASHQE : "/=" ; + + +// Whitespace -- ignored +WS : ( ' ' + | '\t' + | '\f' + // handle newlines + | ( "\r\n" // Evil DOS + | '\r' // Macintosh + | '\n' // Unix (the right way) + ) + { newline(); } + ) + { _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; } + ; + + +COMMENT_1 + : "(*" + ( options { generateAmbigWarnings=false; } + : { LA(2) != ')' }? '*' + | '\r' '\n' {newline();} + | '\r' {newline();} + | '\n' {newline();} + | ~('*' | '\n' | '\r') + )* + "*)" + {$setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP);} + ; + +COMMENT_2 + : '{' + ( options {generateAmbigWarnings=false;} + : '\r' '\n' {newline();} + | '\r' {newline();} + | '\n' {newline();} + | ~('}' | '\n' | '\r') + )* + '}' + {$setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP);} + ; + +COMMENT_3 + : "//" (~'\n')* '\n' + {$setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP);} + ; + +// 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'|'0'..'9'|'_')* //pspsps + ; + +// string literals +STRING_LITERAL + : '\'' ("\'\'" | ~('\''))* '\'' //pspsps * in stead of + because of e.g. '' + ; + +/** a numeric literal. Form is (from Wirth) + * digits + * digits . digits + * digits . digits exponent + * digits exponent + */ +NUM_INT + : ('0'..'9')+ // everything starts with a digit sequence + ( ( {(LA(2)!='.')&&(LA(2)!=')')}? // force k=2; avoid ".." +//PSPSPS example ARRAY (.1..99.) OF char; // after .. thinks it's a NUM_REAL + '.' {$setType(NUM_REAL);} // dot means we are float + ('0'..'9')+ (EXPONENT)? + )? + | EXPONENT {$setType(NUM_REAL);} // 'E' means we are float + ) + ; + +// a couple protected methods to assist in matching floating point numbers +protected +EXPONENT + : ('e') ('+'|'-')? ('0'..'9')+ + ; diff --git a/languages/pascal/pascal.tree.g b/languages/pascal/pascal.tree.g new file mode 100644 index 00000000..c597afb8 --- /dev/null +++ b/languages/pascal/pascal.tree.g @@ -0,0 +1,468 @@ +// +// Pascal Tree Super Grammar (symtab.g derives from this) +// +// Adapted from, +// Pascal User Manual And Report (Second Edition-1978) +// Kathleen Jensen - Niklaus Wirth +// +// By +// +// Hakki Dogusan dogusanh@tr-net.net.tr +// +// Then significantly enhanced by Piet Schoutteten +// with some guidance by Terence Parr. Piet added tree +// construction, and some tree walkers. +// +// +// Adopted to KDevelop by Alexander Dymo +// + +header "pre_include_hpp" { + #include + #include "PascalAST.hpp" + + #include + #include + #include +} + +header "post_include_hpp" { + #include + #include +} + +options { + language="Cpp"; +} + + +class PascalStoreWalker extends TreeParser; + +options { + importVocab = Pascal; + defaultErrorHandler = true; + ASTLabelType = "RefPascalAST"; +} + +{ +private: + QString m_fileName; + QStringList m_currentScope; + int m_currentAccess; + int m_anon; + CodeModel* m_model; + +public: + void setCodeModel( CodeModel* model ) { m_model = model; } + CodeModel* codeModel() { return m_model; } + const CodeModel* codeModel() const { return m_model; } + + QString fileName() const { return m_fileName; } + void setFileName( const QString& fileName ) { m_fileName = fileName; } + + void init(){ + m_currentScope.clear(); + m_currentAccess = CodeModelItem::Public; + m_anon = 0; + } + + void wipeout() { m_model->wipeout(); } +} + +program + : programHeading + block + ; + +programHeading + : #(PROGRAM IDENT identifierList) + | #(UNIT IDENT) + ; + +identifier + : IDENT + ; + +block + : ( labelDeclarationPart + | constantDefinitionPart + | typeDefinitionPart + | variableDeclarationPart + | procedureAndFunctionDeclarationPart + | usesUnitsPart + | IMPLEMENTATION + )* + compoundStatement + ; + +usesUnitsPart + : #(USES identifierList) + ; + +labelDeclarationPart + : #(LABEL ( label )+) + ; + +label + : NUM_INT + ; + +constantDefinitionPart + : #(CONST ( constantDefinition )+ ) + ; + +constantDefinition + : #(EQUAL IDENT constant) + ; + +constant + : NUM_INT + | NUM_REAL + | #( PLUS + ( NUM_INT + | NUM_REAL + | IDENT + ) + ) + | #( MINUS + ( NUM_INT + | NUM_REAL + | IDENT + ) + ) + | IDENT + | STRING_LITERAL + | #(CHR (NUM_INT|NUM_REAL)) + ; + +string + : STRING_LITERAL + ; + +typeDefinitionPart + : #(TYPE ( typeDefinition )+) + ; + +typeDefinition + : #(TYPEDECL IDENT + ( type + | #(FUNCTION (formalParameterList)? resultType) + | #(PROCEDURE (formalParameterList)?) + ) + ) + ; + +type + : #(SCALARTYPE identifierList) + | #(DOTDOT constant constant) + | typeIdentifier + | structuredType + | #(POINTER typeIdentifier) + ; + +typeIdentifier + : IDENT + | CHAR + | BOOLEAN + | INTEGER + | REAL + | #( STRING + ( IDENT + | NUM_INT + | NUM_REAL + | + ) + ) + ; + +structuredType + : #(PACKED unpackedStructuredType) + | unpackedStructuredType + ; + +unpackedStructuredType + : arrayType + | recordType + | setType + | fileType + ; + +/** Note here that the syntactic diff between brackets disappears. + * If the brackets mean different things semantically, we need + * two different alternatives here. + */ +arrayType + : #(ARRAY typeList type) + ; + +typeList + : #( TYPELIST ( type )+ ) + ; + +recordType + : #(RECORD fieldList) + ; + +fieldList + : #( FIELDLIST + ( fixedPart ( variantPart )? + | variantPart + ) + ) + ; + +fixedPart + : ( recordSection )+ + ; + +recordSection + : #(FIELD identifierList type) + ; + +variantPart + : #( CASE tag ( variant )+ ) + ; + +tag + : #(VARIANT_TAG identifier typeIdentifier) + | #(VARIANT_TAG_NO_ID typeIdentifier) + ; + +variant + : #(VARIANT_CASE constList fieldList) + ; + +setType + : #(SET type) + ; + +fileType + : #(FILE (type)?) + ; + +/** Yields a list of VARDECL-rooted subtrees with VAR at the overall root */ +variableDeclarationPart + : #( VAR ( variableDeclaration )+ ) + ; + +variableDeclaration + : #(VARDECL identifierList type) + ; + +procedureAndFunctionDeclarationPart + : procedureOrFunctionDeclaration + ; + +procedureOrFunctionDeclaration + : procedureDeclaration + | functionDeclaration + ; + +procedureDeclaration + : #(PROCEDURE IDENT (formalParameterList)? block ) + ; + +formalParameterList + : #(ARGDECLS ( formalParameterSection )+) + ; + +formalParameterSection + : parameterGroup + | #(VAR parameterGroup) + | #(FUNCTION parameterGroup) + | #(PROCEDURE parameterGroup) + ; + +parameterGroup + : #(ARGDECL identifierList typeIdentifier) + ; + +identifierList + : #(IDLIST (IDENT)+) + ; + +constList + : #(CONSTLIST ( constant )+) + ; + +functionDeclaration + : #(FUNCTION IDENT (formalParameterList)? resultType block) + ; + +resultType + : typeIdentifier + ; + +statement + : #(COLON label unlabelledStatement) + | unlabelledStatement + ; + +unlabelledStatement + : simpleStatement + | structuredStatement + ; + +simpleStatement + : assignmentStatement + | procedureStatement + | gotoStatement + ; + +assignmentStatement + : #(ASSIGN variable expression) + ; + +/** A variable is an id with a suffix and can look like: + * id + * id[expr,...] + * id.id + * id.id[expr,...] + * id^ + * id^.id + * id^.id[expr,...] + * ... + * + * LL has a really hard time with this construct as it's naturally + * left-recursive. We have to turn into a simple loop rather than + * recursive loop, hence, the suffixes. I keep in the same rule + * for easy tree construction. + */ +variable + : #(LBRACK variable (expression)+) + | #(LBRACK2 variable (expression)+) + | #(DOT variable IDENT) + | #(POINTER variable) + | #(AT IDENT) + | IDENT + ; + +expression + : #(EQUAL expression expression) + | #(NOT_EQUAL expression expression) + | #(LTH expression expression) + | #(LE expression expression) + | #(GE expression expression) + | #(GT expression expression) + | #(IN expression expression) + | #(PLUS expression (expression)?) + | #(MINUS expression (expression)?) + | #(OR expression expression) + | #(STAR expression expression) + | #(SLASH expression expression) + | #(DIV expression expression) + | #(MOD expression expression) + | #(AND expression expression) + | #(NOT expression) + | variable + | functionDesignator + | set + | NUM_INT + | NUM_REAL + | #(CHR (NUM_INT|NUM_REAL)) + | string + | NIL + ; + +functionDesignator + : #(FUNC_CALL IDENT (parameterList)?) + ; + +parameterList + : #( ARGLIST (actualParameter)+ ) + ; + +set + : #(SET (element)*) + ; + +element + : #(DOTDOT expression expression) + | expression + ; + +procedureStatement + : #(PROC_CALL IDENT ( parameterList )?) + ; + +actualParameter + : expression + ; + +gotoStatement + : #(GOTO label) + ; + +structuredStatement + : compoundStatement + | conditionalStatement + | repetetiveStatement + | withStatement + ; + +compoundStatement + : statements + ; + +statements + : #(BLOCK (statement)*) + ; + +conditionalStatement + : ifStatement + | caseStatement + ; + +ifStatement + : #(IF expression statement (statement)?) + ; + +caseStatement //pspsps ??? + : #(CASE expression + ( caseListElement )+ + ( statements )? + ) + ; + +caseListElement + : #(COLON constList statement) + ; + +repetetiveStatement + : whileStatement + | repeatStatement + | forStatement + ; + +whileStatement + : #(WHILE expression statement) + ; + +repeatStatement + : #(REPEAT statements expression) + ; + +forStatement + : #(FOR IDENT forList statement) + ; + +forList + : #(TO initialValue finalValue) + | #(DOWNTO initialValue finalValue) + ; + +initialValue + : expression + ; + +finalValue + : expression + ; + +withStatement + : #(WITH recordVariableList statement) + ; + +recordVariableList + : ( variable )+ + ; diff --git a/languages/pascal/pascalsupport_part.cpp b/languages/pascal/pascalsupport_part.cpp new file mode 100644 index 00000000..0c5f96f2 --- /dev/null +++ b/languages/pascal/pascalsupport_part.cpp @@ -0,0 +1,323 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "catalog.h" +#include +#include +#include +#include +#include + +#include "pascalsupport_part.h" +#include "problemreporter.h" +#include "PascalLexer.hpp" +#include "PascalParser.hpp" +#include "PascalStoreWalker.hpp" + +struct PascalSupportPartData{ + ProblemReporter* problemReporter; + + PascalSupportPartData() + : problemReporter( 0 ) + {} +}; + +typedef KDevGenericFactory PascalSupportFactory; +static const KDevPluginInfo data("kdevpascalsupport"); +K_EXPORT_COMPONENT_FACTORY( libkdevpascalsupport, PascalSupportFactory( data ) ) + +PascalSupportPart::PascalSupportPart(QObject *parent, const char *name, const QStringList &) + : KDevLanguageSupport(&data, parent, name ? name : "KDevPascalSupport" ), + d( new PascalSupportPartData() ) +{ + setInstance(PascalSupportFactory::instance()); + setXMLFile("kdevpascalsupport.rc"); + + d->problemReporter = new ProblemReporter( this ); + connect( core(), SIGNAL(configWidget(KDialogBase*)), + d->problemReporter, SLOT(configWidget(KDialogBase*)) ); + + 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( core(), SIGNAL(configWidget(KDialogBase*)), + this, SLOT(configWidget(KDialogBase*)) ); + connect( core( ), SIGNAL( projectConfigWidget( KDialogBase* ) ), this, + SLOT( projectConfigWidget( KDialogBase* ) ) ); + + mainWindow()->embedOutputView( d->problemReporter, i18n("Problems"), i18n("problem reporter") ); + QWhatsThis::add(d->problemReporter, i18n("Problem reporter

This window shows various \"problems\" in your project. " + "It displays errors reported by a language parser.")); +} + +PascalSupportPart::~PascalSupportPart() +{ + mainWindow()->removeView( d->problemReporter ); + delete( d->problemReporter ); + + delete( d ); +} + +PascalSupportPart::Features PascalSupportPart::features() +{ + return Features(Classes | Structs | Functions | Variables | Declarations); +} + +void PascalSupportPart::projectOpened() +{ + 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(projectCompiled()), + this, SLOT(slotProjectCompiled()) ); + + m_projectFileList = project()->allFiles(); + m_projectClosed = false; + + QTimer::singleShot(0, this, SLOT(initialParse())); +} + +void PascalSupportPart::projectClosed() +{ + m_projectClosed = true; +} + +void PascalSupportPart::configWidget(KDialogBase *dlg) +{ + Q_UNUSED( dlg ); + return; +} + +void PascalSupportPart::projectConfigWidget(KDialogBase *dlg) +{ + Q_UNUSED( dlg ); + return; +} + +void PascalSupportPart::contextMenu(QPopupMenu *popup, const Context *context) +{ + Q_UNUSED( popup ); + Q_UNUSED( context ); + return; +} + +void PascalSupportPart::savedFile(const KURL &fileName) +{ + maybeParse(fileName.path()); + emit updatedSourceInfo(); +} + +void PascalSupportPart::addedFilesToProject(const QStringList &fileList) +{ + for (QStringList::ConstIterator it = fileList.begin(); it != fileList.end() ;++it) + { + QString fn = project()->projectDirectory() + "/" + *it; + maybeParse( fn ); + kapp->processEvents( 500 ); + emit addedSourceInfo(fn); + } +} + +void PascalSupportPart::removedFilesFromProject(const QStringList &fileList) +{ + for (QStringList::ConstIterator it = fileList.begin(); it != fileList.end() ;++it) + { + QString fn = project()->projectDirectory() + "/" + *it; + + emit aboutToRemoveSourceInfo(fn); + codeModel()->removeFile( codeModel()->fileByName(fn) ); + } +} + +void PascalSupportPart::slotProjectCompiled() +{ + return; +} + +void PascalSupportPart::initialParse( ) +{ + kdDebug(9013) << "------------------------------------------> initialParse()" << endl; + + if (project()) + { + kapp->setOverrideCursor(waitCursor); + + /// @todo Progress indicator! + + QStringList files = project()->allFiles(); + for (QStringList::Iterator it = files.begin(); it != files.end() ;++it){ + QString fn = project()->projectDirectory() + "/" + *it; + maybeParse( fn ); + kapp->processEvents( 500 ); + } + + emit updatedSourceInfo(); + + kapp->restoreOverrideCursor(); + mainWindow()->statusBar()->message( i18n("Found 1 problem", "Found %n problems", d->problemReporter->childCount()) ); + } +} + +void PascalSupportPart::maybeParse( const QString & fileName ) +{ + kdDebug(9013) << "Maybe parse: " << fileName << endl; + + KMimeType::Ptr mime = KMimeType::findByURL( KURL( fileName ) ); + if( !mime || mime->name() != "text/x-pascal" ) + return; + + mainWindow()->statusBar()->message( i18n("Parsing file: %1").arg(fileName) ); + parse( fileName ); +} + +void PascalSupportPart::parse( const QString & fileName ) +{ + kdDebug(9013) << "PascalSupportPart::parse() -- " << fileName << endl; + + std::ifstream stream( QFile::encodeName( fileName ).data() ); + QCString _fn = fileName.utf8(); + std::string fn( _fn.data() ); + + PascalLexer lexer( stream ); + lexer.setFilename( fn ); + lexer.setProblemReporter( d->problemReporter ); + + PascalParser parser( lexer ); + parser.setFilename( fn ); + parser.setProblemReporter( d->problemReporter ); + + try{ + antlr::ASTFactory my_factory( "PascalAST", PascalAST::factory ); + parser.initializeASTFactory(my_factory); + parser.setASTFactory( &my_factory ); + + lexer.resetErrors(); + parser.resetErrors(); + + parser.compilationUnit(); + int errors = lexer.numberOfErrors() + parser.numberOfErrors(); + RefPascalAST ast = RefPascalAST( parser.getAST() ); + + if( errors == 0 && ast != antlr::nullAST ){ + kdDebug(9013) << "-------------------> start StoreWalker" << endl; +/* PascalStoreWalker walker; + walker.setFileName( fileName ); + walker.setCodeModel( codeModel() ); + walker.compilationUnit( ast );*/ + } + + } catch( antlr::ANTLRException& ex ){ + kdDebug() << "*exception*: " << ex.toString().c_str() << endl; + d->problemReporter->reportError( ex.getMessage().c_str(), + fileName, + lexer.getLine(), + lexer.getColumn() ); + } +} + +KMimeType::List PascalSupportPart::mimeTypes( ) +{ + KMimeType::List list; + KMimeType::Ptr mime = KMimeType::mimeType( "text/x-pascal" ); + if( mime ) + list << mime; + return list; +} + +QString PascalSupportPart::formatTag( const Tag & inputTag ) +{ + Tag tag = inputTag; + + switch( tag.kind() ) + { + case Tag::Kind_Namespace: + return QString::fromLatin1("unit ") + tag.name(); + + case Tag::Kind_Class: + return QString::fromLatin1("class ") + tag.name(); + + case Tag::Kind_Function: + case Tag::Kind_FunctionDeclaration: + { + return tag.name() + "()"; + } + break; + + case Tag::Kind_Variable: + case Tag::Kind_VariableDeclaration: + { + return QString::fromLatin1("var ") + tag.name(); + } + break; + } + return tag.name(); +} + +QString PascalSupportPart::formatModelItem( const CodeModelItem * item, bool shortDescription ) +{ + if (item->isFunction() || item->isFunctionDefinition() ) + { + const FunctionModel *model = static_cast(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()); + } + + function += model->name() + "(" + args + ")"; + + if( !shortDescription ) + function += (model->isVirtual() ? QString("virtual; ") : QString("") ) + model->resultType() + " "; + + return function; + } + else if (item->isVariable()) + { + const VariableModel *model = static_cast(item); + if( shortDescription ) + return model->name(); + return model->name() + ": " + model->type(); + } + else if (item->isArgument()) + { + const ArgumentModel *model = static_cast(item); + QString arg; + arg += model->name(); + arg += ": " + model->type(); + if( !shortDescription ) + arg += model->defaultValue().isEmpty() ? QString("") : QString(" = ") + model->defaultValue(); + return arg.stripWhiteSpace(); + } + else + return KDevLanguageSupport::formatModelItem( item, shortDescription ); +} + +#include "pascalsupport_part.moc" diff --git a/languages/pascal/pascalsupport_part.h b/languages/pascal/pascalsupport_part.h new file mode 100644 index 00000000..4319d1f9 --- /dev/null +++ b/languages/pascal/pascalsupport_part.h @@ -0,0 +1,62 @@ +/*************************************************************************** + * Copyright (C) 2003 Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 __KDEVPART_PASCALSUPPORT_H__ +#define __KDEVPART_PASCALSUPPORT_H__ + +#include +#include "kdevlanguagesupport.h" + +class PascalSupportWidget; +class KDialogBase; +class QPopupMenu; +class Context; +class PascalSupportPartData; + +class PascalSupportPart : public KDevLanguageSupport +{ + Q_OBJECT +public: + PascalSupportPart(QObject *parent, const char *name, const QStringList &); + ~PascalSupportPart(); + + virtual Features features(); + virtual KMimeType::List mimeTypes(); + + virtual QString formatTag( const Tag& tag ); + virtual QString formatModelItem( const CodeModelItem *item, bool shortDescription=false ); + +private slots: + 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 slotProjectCompiled(); + + void initialParse(); + +private: + void maybeParse(const QString &fileName); + void parse(const QString &fileName); + + QGuardedPtr m_widget; + + bool m_projectClosed; + QStringList m_projectFileList; + + PascalSupportPartData* d; + +}; + +#endif diff --git a/languages/pascal/pascaltemplates b/languages/pascal/pascaltemplates new file mode 100644 index 00000000..771f7cca --- /dev/null +++ b/languages/pascal/pascaltemplates @@ -0,0 +1,30 @@ + + +