You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1310 lines
40 KiB
1310 lines
40 KiB
/* $ANTLR 2.7.7 (20061129): "pascal.g" -> "PascalLexer.cpp"$ */
|
|
#include "PascalLexer.h"
|
|
#include <antlr/CharBuffer.h>
|
|
#include <antlr/TokenStreamException.h>
|
|
#include <antlr/TokenStreamIOException.h>
|
|
#include <antlr/TokenStreamRecognitionException.h>
|
|
#include <antlr/CharStreamException.h>
|
|
#include <antlr/CharStreamIOException.h>
|
|
#include <antlr/NoViableAltForCharException.h>
|
|
|
|
#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);
|
|
|