private boolean phpMode;
- final static int TT_EOF = 0;
- final static int TT_UNDEFINED = 1;
- final static int TT_HTML = 2;
-
- final static int TT_MOD = 30;
- final static int TT_NOT = 31;
- final static int TT_DOT = 32;
- final static int TT_POW = 33;
- final static int TT_DIV = 34;
- final static int TT_MULTIPLY = 35;
- final static int TT_SUBTRACT = 36;
- final static int TT_ADD = 37;
- final static int TT_EQUAL = 38;
- final static int TT_UNEQUAL = 39;
- final static int TT_GREATER = 40;
- final static int TT_GREATEREQUAL = 41;
- final static int TT_LESS = 42;
- final static int TT_LESSEQUAL = 43;
- final static int TT_AND = 44;
- final static int TT_OR = 45;
- final static int TT_HASH = 46;
- final static int TT_DDOT = 47;
- final static int TT_DOTASSIGN = 48;
-
- final static int TT_ASSIGN = 49;
- final static int TT_REF = 50;
- final static int TT_FOREACH = 51;
- final static int TT_AMPERSAND = 52;
- final static int TT_DOLLARLISTOPEN = 53;
- final static int TT_TILDE = 54;
- final static int TT_TILDEASSIGN = 55;
- final static int TT_MODASSIGN = 56;
- final static int TT_POWASSIGN = 57;
- final static int TT_RSHIFTASSIGN = 58;
- final static int TT_LSHIFTASSIGN = 59;
- final static int TT_ANDASSIGN = 60;
- final static int TT_QUESTIONMARK = 61;
- final static int TT_DDOT2 = 62;
- final static int TT_AT = 63;
- // final static int TT_HEREDOC = 64;
-
- final static int TT_DOLLAROPEN = 127;
- final static int TT_ARGOPEN = 128;
- final static int TT_ARGCLOSE = 129;
- final static int TT_LISTOPEN = 130;
- final static int TT_LISTCLOSE = 131;
- final static int TT_PARTOPEN = 132;
- final static int TT_PARTCLOSE = 133;
- final static int TT_COMMA = 134;
-
- final static int TT_STRING = 136;
- final static int TT_IDENTIFIER = 138;
- final static int TT_DIGIT = 139;
- final static int TT_SEMICOLON = 140;
- final static int TT_SLOT = 141;
- final static int TT_SLOTSEQUENCE = 142;
- final static int TT_DECREMENT = 144;
- final static int TT_INCREMENT = 145;
- final static int TT_ADDTO = 146;
- final static int TT_DIVIDEBY = 147;
- final static int TT_SUBTRACTFROM = 148;
- final static int TT_TIMESBY = 149;
- final static int TT_VARIABLE = 150;
- final static int TT_INT_NUMBER = 151;
- final static int TT_DOUBLE_NUMBER = 152;
- final static int TT_INTERPOLATED_STRING = 153;
- final static int TT_STRING_CONSTANT = 154;
-
- final static int TT_LSHIFT = 155;
- final static int TT_RSHIFT = 156;
- final static int TT_EX_EQUAL = 157;
- final static int TT_EX_UNEQUAL = 158;
- final static int TT_LINE = 159;
- // final static int TT_AT = 153; // @
+ final static int TokenNameEOF = 0;
+ final static int TokenNameUNDEFINED = 1;
+ final static int TokenNameHTML = 2;
+
+ final static int TokenNameREMAINDER = 30;
+ final static int TokenNameNOT = 31;
+ final static int TokenNameDOT = 32;
+ final static int TokenNameXOR = 33;
+ final static int TokenNameDIVIDE = 34;
+ final static int TokenNameMULTIPLY = 35;
+ final static int TokenNameSUBTRACT = 36;
+ final static int TokenNameADD = 37;
+ final static int TokenNameEQUAL = 38;
+ final static int TokenNameUNEQUAL = 39;
+ final static int TokenNameGREATER = 40;
+ final static int TokenNameGREATEREQUAL = 41;
+ final static int TokenNameLESS = 42;
+ final static int TokenNameLESSEQUAL = 43;
+ final static int TokenNameAND = 44;
+ final static int TokenNameOR = 45;
+ final static int TokenNameHASH = 46;
+ final static int TokenNameDDOT = 47;
+ final static int TokenNameDOTASSIGN = 48;
+
+ final static int TokenNameASSIGN = 49;
+ final static int TokenNameREF = 50;
+ final static int TokenNameFOREACH = 51;
+ final static int TokenNameAMPERSAND = 52;
+ final static int TokenNameDOLLARLISTOPEN = 53;
+ final static int TokenNameTILDE = 54;
+ final static int TokenNameTILDEASSIGN = 55;
+ final static int TokenNameREMAINDER_EQUAL = 56;
+ final static int TokenNameXOR_EQUAL = 57;
+ final static int TokenNameRIGHT_SHIFT_EQUAL = 58;
+ final static int TokenNameLEFT_SHIFT_EQUAL = 59;
+ final static int TokenNameANDASSIGN = 60;
+ final static int TokenNameQUESTIONMARK = 61;
+ final static int TokenNameDDOT2 = 62;
+ final static int TokenNameAT = 63;
+ // final static int TokenNameHEREDOC = 64;
+
+ final static int TokenNameDOLLAROPEN = 127;
+ final static int TokenNameARGOPEN = 128;
+ final static int TokenNameARGCLOSE = 129;
+ final static int TokenNameLISTOPEN = 130;
+ final static int TokenNameLISTCLOSE = 131;
+ final static int TokenNamePARTOPEN = 132;
+ final static int TokenNamePARTCLOSE = 133;
+ final static int TokenNameCOMMA = 134;
+
+ final static int TokenNameSTRING = 136;
+ final static int TokenNameIDENTIFIER = 138;
+ final static int TokenNameDIGIT = 139;
+ final static int TokenNameSEMICOLON = 140;
+ final static int TokenNameSLOT = 141;
+ final static int TokenNameSLOTSEQUENCE = 142;
+ final static int TokenNameDECREMENT = 144;
+ final static int TokenNameINCREMENT = 145;
+ final static int TokenNameADDTO = 146;
+ final static int TokenNameDIVIDE_EQUAL = 147;
+ final static int TokenNameSUBTRACTFROM = 148;
+ final static int TokenNameTIMESBY = 149;
+ final static int TokenNameVARIABLE = 150;
+ final static int TokenNameINT_NUMBER = 151;
+ final static int TokenNameDOUBLE_NUMBER = 152;
+ final static int TokenNameINTERPOLATED_STRING = 153;
+ final static int TokenNameSTRING_CONSTANT = 154;
+
+ final static int TokenNameLEFT_SHIFT = 155;
+ final static int TokenNameRSHIFT = 156;
+ final static int TokenNameEX_EQUAL = 157;
+ final static int TokenNameEX_UNEQUAL = 158;
+ final static int TokenNameLINE = 159;
+ // final static int TokenNameAT = 153; // @
/**
* Class Constructor.
*
this.fileToParse = fileToParse;
this.phpList = null;
this.str = "";
- this.token = TT_EOF;
+ this.token = TokenNameEOF;
this.chIndx = 0;
this.rowCount = 1;
this.columnCount = 0;
chIndx = str.length() + 1;
ch = ' ';
- // token = TT_EOF;
+ // token = TokenNameEOF;
phpEnd = true;
}
while (str.length() > chIndx) {
ch = str.charAt(chIndx++);
- token = TT_UNDEFINED;
+ token = TokenNameUNDEFINED;
if (ch == '\n') {
rowCount++;
columnCount = chIndx;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '{') {
chIndx++;
- token = TT_DOLLAROPEN;
+ token = TokenNameDOLLAROPEN;
return;
}
}
if (openString) {
throwSyntaxError("Open string character '\"' at end of file.");
}
- token = TT_INTERPOLATED_STRING;
+ token = TokenNameINTERPOLATED_STRING;
return;
} else if (ch == '\'') {
// read string until end
if (openString) {
throwSyntaxError("Open string character \"'\" at end of file.", startRow);
}
- token = TT_STRING_CONSTANT;
+ token = TokenNameSTRING_CONSTANT;
return;
} else if (ch == '`') {
// read string until end
if (openString) {
throwSyntaxError("Open string character \"`\" at end of file.", startRow);
}
- token = TT_STRING_CONSTANT;
+ token = TokenNameSTRING_CONSTANT;
return;
}
switch (ch) {
case '(' :
- token = TT_ARGOPEN;
+ token = TokenNameARGOPEN;
break;
case ')' :
- token = TT_ARGCLOSE;
+ token = TokenNameARGCLOSE;
break;
case '{' :
- token = TT_LISTOPEN;
+ token = TokenNameLISTOPEN;
break;
case '}' :
- token = TT_LISTCLOSE;
+ token = TokenNameLISTCLOSE;
break;
case '[' :
- token = TT_PARTOPEN;
+ token = TokenNamePARTOPEN;
break;
case ']' :
- token = TT_PARTCLOSE;
+ token = TokenNamePARTCLOSE;
break;
case ',' :
- token = TT_COMMA;
+ token = TokenNameCOMMA;
break;
case '?' :
- token = TT_QUESTIONMARK;
+ token = TokenNameQUESTIONMARK;
break;
case '@' :
- token = TT_AT;
+ token = TokenNameAT;
break;
case '~' :
- token = TT_TILDE;
+ token = TokenNameTILDE;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_TILDEASSIGN;
+ token = TokenNameTILDEASSIGN;
break;
}
}
break;
case '.' :
- token = TT_DOT;
+ token = TokenNameDOT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_DOTASSIGN;
+ token = TokenNameDOTASSIGN;
break;
}
break;
case '"' :
- token = TT_STRING;
+ token = TokenNameSTRING;
break;
case '%' :
- token = TT_MOD;
+ token = TokenNameREMAINDER;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_MODASSIGN;
+ token = TokenNameREMAINDER_EQUAL;
break;
}
}
break;
case ';' :
- token = TT_SEMICOLON;
+ token = TokenNameSEMICOLON;
break;
case '^' :
- token = TT_POW;
+ token = TokenNameXOR;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_POWASSIGN;
+ token = TokenNameXOR_EQUAL;
break;
}
}
break;
case '/' :
- token = TT_DIV;
+ token = TokenNameDIVIDE;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_DIVIDEBY;
+ token = TokenNameDIVIDE_EQUAL;
break;
}
break;
case '*' :
- token = TT_MULTIPLY;
+ token = TokenNameMULTIPLY;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '*') {
chIndx++;
- token = TT_POW;
+ token = TokenNameXOR;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_TIMESBY;
+ token = TokenNameTIMESBY;
break;
}
break;
case '+' :
- token = TT_ADD;
+ token = TokenNameADD;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '+') {
chIndx++;
- token = TT_INCREMENT;
+ token = TokenNameINCREMENT;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_ADDTO;
+ token = TokenNameADDTO;
break;
}
}
break;
case '-' :
- token = TT_SUBTRACT;
+ token = TokenNameSUBTRACT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '-') {
chIndx++;
- token = TT_DECREMENT;
+ token = TokenNameDECREMENT;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_SUBTRACTFROM;
+ token = TokenNameSUBTRACTFROM;
break;
}
if (str.charAt(chIndx) == '>') {
chIndx++;
- token = TT_REF;
+ token = TokenNameREF;
break;
}
break;
case '=' :
- token = TT_ASSIGN;
+ token = TokenNameASSIGN;
if (str.length() > chIndx) {
ch = str.charAt(chIndx);
if (ch == '=') {
chIndx++;
- token = TT_EQUAL;
+ token = TokenNameEQUAL;
if (str.length() > chIndx) {
ch = str.charAt(chIndx);
if (ch == '=') {
chIndx++;
- token = TT_EX_EQUAL;
+ token = TokenNameEX_EQUAL;
}
}
break;
}
if (ch == '>') {
chIndx++;
- token = TT_FOREACH;
+ token = TokenNameFOREACH;
break;
}
break;
case '!' :
- token = TT_NOT;
+ token = TokenNameNOT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_UNEQUAL;
+ token = TokenNameUNEQUAL;
if (str.length() > chIndx) {
ch = str.charAt(chIndx);
if (ch == '=') {
chIndx++;
- token = TT_EX_UNEQUAL;
+ token = TokenNameEX_UNEQUAL;
}
}
break;
break;
case '>' :
- token = TT_GREATER;
+ token = TokenNameGREATER;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_GREATEREQUAL;
+ token = TokenNameGREATEREQUAL;
break;
}
if (str.charAt(chIndx) == '>') {
chIndx++;
- token = TT_RSHIFT;
+ token = TokenNameRSHIFT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_RSHIFTASSIGN;
+ token = TokenNameRIGHT_SHIFT_EQUAL;
break;
}
}
break;
case '<' :
- token = TT_LESS;
+ token = TokenNameLESS;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_LESSEQUAL;
+ token = TokenNameLESSEQUAL;
break;
}
if (str.charAt(chIndx) == '<') {
chIndx++;
- token = TT_LSHIFT;
+ token = TokenNameLEFT_SHIFT;
if (str.charAt(chIndx) == '<') {
// heredoc
int startRow = rowCount;
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '_')) {
chIndx++;
getIdentifier();
- token = TT_STRING_CONSTANT;
+ token = TokenNameSTRING_CONSTANT;
while (str.length() > chIndx) {
ch = str.charAt(chIndx++);
if (ch == '\n') {
throwSyntaxError("Open heredoc syntax after operator '<<<'.", startRow);
} else if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_LSHIFTASSIGN;
+ token = TokenNameLEFT_SHIFT_EQUAL;
break;
}
break;
break;
case '|' :
- token = TT_LINE;
+ token = TokenNameLINE;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '|') {
chIndx++;
- token = TT_OR;
+ token = TokenNameOR;
break;
}
break;
case '&' :
- token = TT_AMPERSAND;
+ token = TokenNameAMPERSAND;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '&') {
chIndx++;
- token = TT_AND;
+ token = TokenNameAND;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_ANDASSIGN;
+ token = TokenNameANDASSIGN;
break;
}
break;
break;
case ':' :
- token = TT_DDOT;
+ token = TokenNameDDOT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == ':') {
chIndx++;
- token = TT_DDOT2;
+ token = TokenNameDDOT2;
}
}
break;
case '#' :
- token = TT_HASH;
+ token = TokenNameHASH;
break;
// case '@' :
- // token = TT_AT;
+ // token = TokenNameAT;
//
// break;
default :
throwSyntaxError("unexpected character: '" + ch + "'");
}
- if (token == TT_UNDEFINED) {
+ if (token == TokenNameUNDEFINED) {
throwSyntaxError("token not found");
}
chIndx = str.length() + 1;
ch = ' ';
- token = TT_EOF;
+ token = TokenNameEOF;
phpEnd = true;
PHPString temp;
if (phpList != null) {
if (currentPHPString < phpList.size()) {
- token = TT_UNDEFINED;
+ token = TokenNameUNDEFINED;
temp = (PHPString) phpList.get(currentPHPString++);
this.str = temp.getPHPString();
- this.token = TT_EOF;
+ this.token = TokenNameEOF;
this.chIndx = 0;
this.rowCount = temp.getLineNumber();
this.columnCount = 0;
getNextToken();
phpEnd = true;
} else {
- token = TT_UNDEFINED;
+ token = TokenNameUNDEFINED;
return;
}
}
if (!phpMode) {
while (str.length() > chIndx) {
- token = TT_UNDEFINED;
+ token = TokenNameUNDEFINED;
ch = str.charAt(chIndx++);
if (ch == '\n') {
if (phpMode) {
while (str.length() > chIndx) {
ch = str.charAt(chIndx++);
- token = TT_UNDEFINED;
+ token = TokenNameUNDEFINED;
if (ch == '\n') {
rowCount++;
columnCount = chIndx;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '{') {
chIndx++;
- token = TT_DOLLAROPEN;
+ token = TokenNameDOLLAROPEN;
return;
}
}
ch2 = str.charAt(chIndx);
if (ch2 == '>') {
chIndx++;
- token = TT_HTML;
+ token = TokenNameHTML;
// php end
phpMode = false;
phpEnd = true;
ch2 = str.charAt(chIndx);
if (ch2 == '>') {
chIndx++;
- token = TT_HTML;
+ token = TokenNameHTML;
// php end
phpMode = false;
phpEnd = true;
continue;
} else if (ch == '"') {
- getString('"',TT_INTERPOLATED_STRING,"Open string character '\"' at end of file.");
+ getString('"',TokenNameINTERPOLATED_STRING,"Open string character '\"' at end of file.");
return;
} else if (ch == '\'') {
- getString('\'',TT_STRING_CONSTANT,"Open string character \"'\" at end of file.");
+ getString('\'',TokenNameSTRING_CONSTANT,"Open string character \"'\" at end of file.");
return;
} else if (ch == '`') {
- getString('`',TT_STRING_CONSTANT,"Open string character \"`\" at end of file.");
+ getString('`',TokenNameSTRING_CONSTANT,"Open string character \"`\" at end of file.");
setMarker("Other string delimiters prefered (found \"`\").", rowCount, PHPParser.INFO);
return;
}
switch (ch) {
case '(' :
- token = TT_ARGOPEN;
+ token = TokenNameARGOPEN;
break;
case ')' :
- token = TT_ARGCLOSE;
+ token = TokenNameARGCLOSE;
break;
case '{' :
- token = TT_LISTOPEN;
+ token = TokenNameLISTOPEN;
break;
case '}' :
- token = TT_LISTCLOSE;
+ token = TokenNameLISTCLOSE;
break;
case '[' :
- token = TT_PARTOPEN;
+ token = TokenNamePARTOPEN;
break;
case ']' :
- token = TT_PARTCLOSE;
+ token = TokenNamePARTCLOSE;
break;
case ',' :
- token = TT_COMMA;
+ token = TokenNameCOMMA;
break;
case '?' :
- token = TT_QUESTIONMARK;
+ token = TokenNameQUESTIONMARK;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '>') {
chIndx++;
- token = TT_HTML;
+ token = TokenNameHTML;
// php end
phpMode = false;
phpEnd = true;
break;
case '@' :
- token = TT_AT;
+ token = TokenNameAT;
break;
case '~' :
- token = TT_TILDE;
+ token = TokenNameTILDE;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_TILDEASSIGN;
+ token = TokenNameTILDEASSIGN;
break;
}
}
break;
case '.' :
- token = TT_DOT;
+ token = TokenNameDOT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_DOTASSIGN;
+ token = TokenNameDOTASSIGN;
break;
}
break;
case '"' :
- token = TT_STRING;
+ token = TokenNameSTRING;
break;
case '%' :
- token = TT_MOD;
+ token = TokenNameREMAINDER;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_MODASSIGN;
+ token = TokenNameREMAINDER_EQUAL;
break;
}
}
break;
case ';' :
- token = TT_SEMICOLON;
+ token = TokenNameSEMICOLON;
break;
case '^' :
- token = TT_POW;
+ token = TokenNameXOR;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_POWASSIGN;
+ token = TokenNameXOR_EQUAL;
break;
}
}
break;
case '/' :
- token = TT_DIV;
+ token = TokenNameDIVIDE;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_DIVIDEBY;
+ token = TokenNameDIVIDE_EQUAL;
break;
}
break;
case '*' :
- token = TT_MULTIPLY;
+ token = TokenNameMULTIPLY;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '*') {
chIndx++;
- token = TT_POW;
+ token = TokenNameXOR;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_TIMESBY;
+ token = TokenNameTIMESBY;
break;
}
break;
case '+' :
- token = TT_ADD;
+ token = TokenNameADD;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '+') {
chIndx++;
- token = TT_INCREMENT;
+ token = TokenNameINCREMENT;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_ADDTO;
+ token = TokenNameADDTO;
break;
}
}
break;
case '-' :
- token = TT_SUBTRACT;
+ token = TokenNameSUBTRACT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '-') {
chIndx++;
- token = TT_DECREMENT;
+ token = TokenNameDECREMENT;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_SUBTRACTFROM;
+ token = TokenNameSUBTRACTFROM;
break;
}
if (str.charAt(chIndx) == '>') {
chIndx++;
- token = TT_REF;
+ token = TokenNameREF;
break;
}
break;
case '=' :
- token = TT_ASSIGN;
+ token = TokenNameASSIGN;
if (str.length() > chIndx) {
ch = str.charAt(chIndx);
if (ch == '=') {
chIndx++;
- token = TT_EQUAL;
+ token = TokenNameEQUAL;
if (str.length() > chIndx) {
ch = str.charAt(chIndx);
if (ch == '=') {
chIndx++;
- token = TT_EX_EQUAL;
+ token = TokenNameEX_EQUAL;
}
}
break;
}
if (ch == '>') {
chIndx++;
- token = TT_FOREACH;
+ token = TokenNameFOREACH;
break;
}
break;
case '!' :
- token = TT_NOT;
+ token = TokenNameNOT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_UNEQUAL;
+ token = TokenNameUNEQUAL;
if (str.length() > chIndx) {
ch = str.charAt(chIndx);
if (ch == '=') {
chIndx++;
- token = TT_EX_UNEQUAL;
+ token = TokenNameEX_UNEQUAL;
}
}
break;
break;
case '>' :
- token = TT_GREATER;
+ token = TokenNameGREATER;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_GREATEREQUAL;
+ token = TokenNameGREATEREQUAL;
break;
}
if (str.charAt(chIndx) == '>') {
chIndx++;
- token = TT_RSHIFT;
+ token = TokenNameRSHIFT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_RSHIFTASSIGN;
+ token = TokenNameRIGHT_SHIFT_EQUAL;
break;
}
}
break;
case '<' :
- token = TT_LESS;
+ token = TokenNameLESS;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_LESSEQUAL;
+ token = TokenNameLESSEQUAL;
break;
}
if (str.charAt(chIndx) == '<') {
chIndx++;
- token = TT_LSHIFT;
+ token = TokenNameLEFT_SHIFT;
if (str.charAt(chIndx) == '<') {
// heredoc
int startRow = rowCount;
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '_')) {
chIndx++;
getIdentifier();
- token = TT_STRING_CONSTANT;
+ token = TokenNameSTRING_CONSTANT;
while (str.length() > chIndx) {
ch = str.charAt(chIndx++);
if (ch == '\n') {
throwSyntaxError("Open heredoc syntax after operator '<<<'.", startRow);
} else if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_LSHIFTASSIGN;
+ token = TokenNameLEFT_SHIFT_EQUAL;
break;
}
break;
break;
case '|' :
- token = TT_LINE;
+ token = TokenNameLINE;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '|') {
chIndx++;
- token = TT_OR;
+ token = TokenNameOR;
break;
}
break;
case '&' :
- token = TT_AMPERSAND;
+ token = TokenNameAMPERSAND;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '&') {
chIndx++;
- token = TT_AND;
+ token = TokenNameAND;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_ANDASSIGN;
+ token = TokenNameANDASSIGN;
break;
}
break;
break;
case ':' :
- token = TT_DDOT;
+ token = TokenNameDDOT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == ':') {
chIndx++;
- token = TT_DDOT2;
+ token = TokenNameDDOT2;
}
}
break;
case '#' :
- token = TT_HASH;
+ token = TokenNameHASH;
break;
// case '@' :
- // token = TT_AT;
+ // token = TokenNameAT;
//
// break;
default :
throwSyntaxError("unexpected character: '" + ch + "'");
}
- if (token == TT_UNDEFINED) {
+ if (token == TokenNameUNDEFINED) {
throwSyntaxError("token not found");
}
chIndx = str.length() + 1;
ch = ' ';
- token = TT_EOF;
+ token = TokenNameEOF;
phpEnd = true;
//PHPString temp;
// if (phpList != null) {
// if (currentPHPString < phpList.size()) {
- // token = TT_UNDEFINED;
+ // token = TokenNameUNDEFINED;
// temp = (PHPString) phpList.get(currentPHPString++);
// this.str = temp.getPHPString();
- // this.token = TT_EOF;
+ // this.token = TokenNameEOF;
// this.chIndx = 0;
// this.rowCount = temp.getLineNumber();
// this.columnCount = 0;
// getNextToken();
// phpEnd = true;
// } else {
- // token = TT_UNDEFINED;
+ // token = TokenNameUNDEFINED;
// return;
// }
// }
getChar();
// attention recursive call:
getIdentifier();
- token = TT_VARIABLE;
+ token = TokenNameVARIABLE;
return;
} else {
- token = TT_IDENTIFIER;
+ token = TokenNameIDENTIFIER;
}
getChar();
/**
* Get a number.
* if it's a <code>double</code> the number will be stored in <code>doubleNumber</code> and the token will have the
- * value {@link PHPParser#TT_DOUBLE_NUMBER}<br />
+ * value {@link PHPParser#TokenNameDOUBLE_NUMBER}<br />
* if it's a <code>double</code> the number will be stored in <code>longNumber</code> and the token will have the
- * value {@link PHPParser#TT_INT_NUMBER}
+ * value {@link PHPParser#TokenNameINT_NUMBER}
*/
private void getNumber() {
StringBuffer inum = new StringBuffer();
try {
if (dFlag != ' ') {
doubleNumber = new Double(inum.toString());
- token = TT_DOUBLE_NUMBER;
+ token = TokenNameDOUBLE_NUMBER;
return;
} else {
longNumber = Long.valueOf(inum.toString(), numFormat);
- token = TT_INT_NUMBER;
+ token = TokenNameINT_NUMBER;
return;
}
/**
* Get a String.
* @param openChar the opening char ('\'', '"', '`')
- * @param typeString the type of string {@link #TT_STRING_CONSTANT},{@link #TT_INTERPOLATED_STRING}
+ * @param typeString the type of string {@link #TokenNameSTRING_CONSTANT},{@link #TokenNameINTERPOLATED_STRING}
* @param errorMsg the error message in case of parse error in the string
*/
private void getString(final char openChar, final int typeString, final String errorMsg) {
}
}
if (openString) {
- if (typeString == TT_STRING_CONSTANT) {
+ if (typeString == TokenNameSTRING_CONSTANT) {
throwSyntaxError(errorMsg, startRow);
} else {
throwSyntaxError(errorMsg);
this.str = ((PHPString) phpList.get(currentPHPString++)).getPHPString();
}
}
- this.token = TT_EOF;
+ this.token = TokenNameEOF;
this.chIndx = 0;
this.rowCount = rowCount;
this.columnCount = 0;
getNextToken();
do {
try {
- if (token != TT_EOF && token != TT_UNDEFINED) {
+ if (token != TokenNameEOF && token != TokenNameUNDEFINED) {
statementList();
}
- if (token != TT_EOF && token != TT_UNDEFINED) {
- if (token == TT_ARGCLOSE) {
+ if (token != TokenNameEOF && token != TokenNameUNDEFINED) {
+ if (token == TokenNameARGCLOSE) {
throwSyntaxError("Too many closing ')'; end-of-file not reached.");
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameLISTCLOSE) {
throwSyntaxError("Too many closing '}'; end-of-file not reached.");
}
- if (token == TT_PARTCLOSE) {
+ if (token == TokenNamePARTCLOSE) {
throwSyntaxError("Too many closing ']'; end-of-file not reached.");
}
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
throwSyntaxError("Read character '('; end-of-file not reached.");
}
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLISTOPEN) {
throwSyntaxError("Read character '{'; end-of-file not reached.");
}
- if (token == TT_PARTOPEN) {
+ if (token == TokenNamePARTOPEN) {
throwSyntaxError("Read character '['; end-of-file not reached.");
}
// if an error occured,
// try to find keywords 'class' or 'function'
// to parse the rest of the string
- while (token != TT_EOF && token != TT_UNDEFINED) {
- if (token == TT_class || token == TT_function) {
+ while (token != TokenNameEOF && token != TokenNameUNDEFINED) {
+ if (token == TokenNameclass || token == TokenNamefunction) {
break;
}
getNextToken();
}
- if (token == TT_EOF || token == TT_UNDEFINED) {
+ if (token == TokenNameEOF || token == TokenNameUNDEFINED) {
return;
}
}
*/
public void parse(String s) throws CoreException {
this.str = s;
- this.token = TT_EOF;
+ this.token = TokenNameEOF;
this.chIndx = 0;
this.rowCount = 1;
this.columnCount = 0;
getNextToken();
do {
try {
- if (token != TT_EOF && token != TT_UNDEFINED) {
+ if (token != TokenNameEOF && token != TokenNameUNDEFINED) {
statementList();
}
- if (token != TT_EOF && token != TT_UNDEFINED) {
- if (token == TT_ARGCLOSE) {
+ if (token != TokenNameEOF && token != TokenNameUNDEFINED) {
+ if (token == TokenNameARGCLOSE) {
throwSyntaxError("Too many closing ')'; end-of-file not reached.");
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameLISTCLOSE) {
throwSyntaxError("Too many closing '}'; end-of-file not reached.");
}
- if (token == TT_PARTCLOSE) {
+ if (token == TokenNamePARTCLOSE) {
throwSyntaxError("Too many closing ']'; end-of-file not reached.");
}
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
throwSyntaxError("Read character '('; end-of-file not reached.");
}
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLISTOPEN) {
throwSyntaxError("Read character '{'; end-of-file not reached.");
}
- if (token == TT_PARTOPEN) {
+ if (token == TokenNamePARTOPEN) {
throwSyntaxError("Read character '['; end-of-file not reached.");
}
// if an error occured,
// try to find keywords 'class' or 'function'
// to parse the rest of the string
- while (token != TT_EOF && token != TT_UNDEFINED) {
- if (token == TT_class || token == TT_function) {
+ while (token != TokenNameEOF && token != TokenNameUNDEFINED) {
+ if (token == TokenNameclass || token == TokenNamefunction) {
break;
}
getNextToken();
}
- if (token == TT_EOF || token == TT_UNDEFINED) {
+ if (token == TokenNameEOF || token == TokenNameUNDEFINED) {
return;
}
} catch (SyntaxError sytaxErr2) {
// stack.push(outlineInfo.getDeclarations());
this.str = s;
- this.token = TT_EOF;
+ this.token = TokenNameEOF;
this.chIndx = 0;
this.rowCount = 1;
this.columnCount = 0;
String oldIdentifier;
IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
try {
- while (token != TT_EOF && token != TT_UNDEFINED) {
- if (token == TT_VARIABLE) {
+ while (token != TokenNameEOF && token != TokenNameUNDEFINED) {
+ if (token == TokenNameVARIABLE) {
outlineInfo.addVariable(identifier);
getNextToken();
- } else if (token == TT_var) {
+ } else if (token == TokenNamevar) {
getNextToken();
- if (token == TT_VARIABLE && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_VAR)) {
+ if (token == TokenNameVARIABLE && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_VAR)) {
getNextToken();
outlineInfo.addVariable(identifier);
- if (token != TT_SEMICOLON) {
+ if (token != TokenNameSEMICOLON) {
oldIdentifier = identifier;
getNextToken();
switch (token) {
- case TT_VARIABLE : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length(),identifier));
+ case TokenNameVARIABLE : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length(),identifier));
break;
- case TT_IDENTIFIER : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length(),identifier));
+ case TokenNameIDENTIFIER : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length(),identifier));
break;
- case TT_DOUBLE_NUMBER : current.add(new PHPVarDeclaration(current, oldIdentifier + doubleNumber, chIndx - identifier.length(),doubleNumber.toString()));
+ case TokenNameDOUBLE_NUMBER : current.add(new PHPVarDeclaration(current, oldIdentifier + doubleNumber, chIndx - identifier.length(),doubleNumber.toString()));
break;
- case TT_INT_NUMBER : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length(),longNumber.toString()));
+ case TokenNameINT_NUMBER : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length(),longNumber.toString()));
break;
- case TT_INTERPOLATED_STRING : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length(),stringValue));
+ case TokenNameINTERPOLATED_STRING : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length(),stringValue));
break;
- case TT_STRING_CONSTANT : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length(),stringValue));
+ case TokenNameSTRING_CONSTANT : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length(),stringValue));
break;
default : current.add(new PHPVarDeclaration(current, oldIdentifier, chIndx - identifier.length()));
break;
current.add(new PHPVarDeclaration(current, identifier, chIndx - identifier.length()));
}
}
- } else if (token == TT_function) {
+ } else if (token == TokenNamefunction) {
getNextToken();
- if (token == TT_AMPERSAND) {
+ if (token == TokenNameAMPERSAND) {
getNextToken();
}
- if (token == TT_IDENTIFIER && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_FUNC)) {
+ if (token == TokenNameIDENTIFIER && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_FUNC)) {
outlineInfo.addVariable(identifier);
temp = new PHPFunctionDeclaration(current, identifier, chIndx - identifier.length());
current.add(temp);
getNextToken();
parseDeclarations(outlineInfo, temp, true);
}
- } else if (token == TT_class) {
+ } else if (token == TokenNameclass) {
getNextToken();
- if (token == TT_IDENTIFIER && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_CLASS)) {
+ if (token == TokenNameIDENTIFIER && store.getBoolean(PHPeclipsePlugin.PHP_OUTLINE_CLASS)) {
outlineInfo.addVariable(identifier);
temp = new PHPClassDeclaration(current, identifier, chIndx - identifier.length());
current.add(temp);
getNextToken();
//skip tokens for classname, extends and others until we have the opening '{'
- while (token != TT_LISTOPEN && token != TT_EOF && token != TT_UNDEFINED) {
+ while (token != TokenNameLISTOPEN && token != TokenNameEOF && token != TokenNameUNDEFINED) {
getNextToken();
}
parseDeclarations(outlineInfo, temp, true);
// stack.pop();
}
- } else if (token == TT_LISTOPEN) {
+ } else if (token == TokenNameLISTOPEN) {
getNextToken();
counter++;
- } else if (token == TT_LISTCLOSE) {
+ } else if (token == TokenNameLISTCLOSE) {
getNextToken();
--counter;
if (counter == 0 && goBack) {
return;
}
- } else if (token == TT_require || token == TT_require_once || token == TT_include || token == TT_include_once) {
+ } else if (token == TokenNamerequire || token == TokenNamerequire_once || token == TokenNameinclude || token == TokenNameinclude_once) {
expression();
outlineInfo.addVariable(identifier);
current.add(new PHPReqIncDeclaration(current, identifier, chIndx - identifier.length(),expression.toString()));
private void statementList() throws CoreException {
do {
statement();
- if ((token == TT_LISTCLOSE)
- || (token == TT_case)
- || (token == TT_default)
- || (token == TT_elseif)
- || (token == TT_endif)
- || (token == TT_endfor)
- || (token == TT_endforeach)
- || (token == TT_endwhile)
- || (token == TT_endswitch)
- || (token == TT_EOF)
- || (token == TT_UNDEFINED)) {
+ if ((token == TokenNameLISTCLOSE)
+ || (token == TokenNamecase)
+ || (token == TokenNamedefault)
+ || (token == TokenNameelseif)
+ || (token == TokenNameendif)
+ || (token == TokenNameendfor)
+ || (token == TokenNameendforeach)
+ || (token == TokenNameendwhile)
+ || (token == TokenNameendswitch)
+ || (token == TokenNameEOF)
+ || (token == TokenNameUNDEFINED)) {
return;
}
} while (true);
private void compoundStatement() throws CoreException {
// '{' [statement-list] '}'
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLISTOPEN) {
getNextToken();
} else {
throwSyntaxError("'{' expected in compound-statement.");
}
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
statementList();
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameLISTCLOSE) {
getNextToken();
} else {
throwSyntaxError("'}' expected in compound-statement.");
}
private void statement() throws CoreException {
- // if (token > TT_KEYWORD && token != TT_list && token != TT_new) {
+ // if (token > TokenNameKEYWORD && token != TokenNamelist && token != TokenNamenew) {
String keyword = identifier;
- if (token == TT_include || token == TT_include_once) {
+ if (token == TokenNameinclude || token == TokenNameinclude_once) {
getNextToken();
expression();
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
if (!phpEnd) {
getNextToken();
}
return;
- } else if (token == TT_require || token == TT_require_once) {
+ } else if (token == TokenNamerequire || token == TokenNamerequire_once) {
getNextToken();
//constant();
expression();
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
if (!phpEnd) {
getNextToken();
}
return;
- } else if (token == TT_if) {
+ } else if (token == TokenNameif) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'if' keyword.");
}
expression();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameARGCLOSE) {
getNextToken();
} else {
throwSyntaxError("')' expected after 'if' condition.");
ifStatement();
return;
- } else if (token == TT_switch) {
+ } else if (token == TokenNameswitch) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'switch' keyword.");
}
expression();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameARGCLOSE) {
getNextToken();
} else {
throwSyntaxError("')' expected after 'switch' condition.");
}
switchStatement();
return;
- } else if (token == TT_for) {
+ } else if (token == TokenNamefor) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'for' keyword.");
}
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
expressionList();
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
throwSyntaxError("';' expected after 'for'.");
}
}
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
expressionList();
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
throwSyntaxError("';' expected after 'for'.");
}
}
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameARGCLOSE) {
getNextToken();
} else {
expressionList();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameARGCLOSE) {
getNextToken();
} else {
throwSyntaxError("')' expected after 'for'.");
}
forStatement();
return;
- } else if (token == TT_while) {
+ } else if (token == TokenNamewhile) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'while' keyword.");
}
expression();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameARGCLOSE) {
getNextToken();
} else {
throwSyntaxError("')' expected after 'while' condition.");
}
whileStatement();
return;
- } else if (token == TT_do) {
+ } else if (token == TokenNamedo) {
getNextToken();
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLISTOPEN) {
getNextToken();
} else {
throwSyntaxError("'{' expected after 'do' keyword.");
}
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
statementList();
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameLISTCLOSE) {
getNextToken();
} else {
throwSyntaxError("'}' expected after 'do' keyword.");
}
- if (token == TT_while) {
+ if (token == TokenNamewhile) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'while' keyword.");
}
expression();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameARGCLOSE) {
getNextToken();
} else {
throwSyntaxError("')' expected after 'while' condition.");
} else {
throwSyntaxError("'while' expected after 'do' keyword.");
}
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
if (!phpEnd) {
getNextToken();
}
return;
- } else if (token == TT_foreach) {
+ } else if (token == TokenNameforeach) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'foreach' keyword.");
}
expression();
- if (token == TT_as) {
+ if (token == TokenNameas) {
getNextToken();
} else {
throwSyntaxError("'as' expected after 'foreach' exxpression.");
}
variable();
- if (token == TT_FOREACH) {
+ if (token == TokenNameFOREACH) {
getNextToken();
variable();
}
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameARGCLOSE) {
getNextToken();
} else {
throwSyntaxError("')' expected after 'foreach' expression.");
foreachStatement();
return;
- } else if (token == TT_continue || token == TT_break || token == TT_return) {
+ } else if (token == TokenNamecontinue || token == TokenNamebreak || token == TokenNamereturn) {
getNextToken();
- if (token != TT_SEMICOLON) {
+ if (token != TokenNameSEMICOLON) {
expression();
}
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
if (!phpEnd) {
}
return;
- } else if (token == TT_echo) {
+ } else if (token == TokenNameecho) {
getNextToken();
expressionList();
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
if (!phpEnd) {
getNextToken();
}
return;
- // } else if (token == TT_print) {
+ // } else if (token == TokenNameprint) {
// getNextToken();
// expression();
- // if (token == TT_SEMICOLON) {
+ // if (token == TokenNameSEMICOLON) {
// getNextToken();
// } else {
// if (!phpEnd) {
// }
// return;
- } else if (token == TT_global || token == TT_static) {
+ } else if (token == TokenNameglobal || token == TokenNamestatic) {
getNextToken();
variableList();
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
if (!phpEnd) {
}
return;
- // } else if (token == TT_unset) {
+ // } else if (token == TokenNameunset) {
// getNextToken();
- // if (token == TT_ARGOPEN) {
+ // if (token == TokenNameARGOPEN) {
// getNextToken();
// } else {
// throwSyntaxError("'(' expected after 'unset' keyword.");
// }
// variableList();
- // if (token == TT_ARGCLOSE) {
+ // if (token == TokenNameARGCLOSE) {
// getNextToken();
// } else {
// throwSyntaxError("')' expected after 'unset' statement.");
// }
- // if (token == TT_SEMICOLON) {
+ // if (token == TokenNameSEMICOLON) {
// getNextToken();
// } else {
// if (!phpEnd) {
// }
// return;
- // } else if (token == TT_exit || token == TT_die) {
+ // } else if (token == TokenNameexit || token == TokenNamedie) {
// getNextToken();
- // if (token != TT_SEMICOLON) {
+ // if (token != TokenNameSEMICOLON) {
// exitStatus();
// }
- // if (token == TT_SEMICOLON) {
+ // if (token == TokenNameSEMICOLON) {
// getNextToken();
// } else {
// if (!phpEnd) {
// }
// return;
- } else if (token == TT_define) {
+ } else if (token == TokenNamedefine) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'define' keyword.");
}
expression();
- if (token == TT_COMMA) {
+ if (token == TokenNameCOMMA) {
getNextToken();
} else {
throwSyntaxError("',' expected after first 'define' constant.");
}
expression();
- if (token == TT_COMMA) {
+ if (token == TokenNameCOMMA) {
getNextToken();
expression();
}
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameARGCLOSE) {
getNextToken();
} else {
throwSyntaxError("')' expected after 'define' statement.");
}
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
if (!phpEnd) {
getNextToken();
}
return;
- } else if (token == TT_function) {
+ } else if (token == TokenNamefunction) {
getNextToken();
functionDefinition();
return;
- } else if (token == TT_class) {
+ } else if (token == TokenNameclass) {
getNextToken();
classDeclarator();
classBody();
return;
// } else {
// throwSyntaxError("Unexpected keyword '" + keyword + "'");
- } else if (token == TT_LISTOPEN) {
+ } else if (token == TokenNameLISTOPEN) {
// compoundStatement
getNextToken();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
statementList();
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameLISTCLOSE) {
getNextToken();
return;
} else {
throwSyntaxError("'}' expected.");
}
} else {
- if (token != TT_SEMICOLON) {
+ if (token != TokenNameSEMICOLON) {
expression();
}
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
return;
} else {
private void classDeclarator() throws CoreException {
//identifier
//identifier 'extends' identifier
- if (token == TT_IDENTIFIER) {
+ if (token == TokenNameIDENTIFIER) {
getNextToken();
- if (token == TT_extends) {
+ if (token == TokenNameextends) {
getNextToken();
- if (token == TT_IDENTIFIER) {
+ if (token == TokenNameIDENTIFIER) {
getNextToken();
} else {
throwSyntaxError("Class name expected after keyword 'extends'.");
private void classBody() throws CoreException {
//'{' [class-element-list] '}'
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLISTOPEN) {
getNextToken();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
classElementList();
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameLISTCLOSE) {
getNextToken();
} else {
throwSyntaxError("'}' expected at end of class body.");
private void classElementList() throws CoreException {
do {
classElement();
- } while (token == TT_function || token == TT_var);
+ } while (token == TokenNamefunction || token == TokenNamevar);
}
private void classElement() throws CoreException {
//class-property
//function-definition
- if (token == TT_function) {
+ if (token == TokenNamefunction) {
getNextToken();
functionDefinition();
- } else if (token == TT_var) {
+ } else if (token == TokenNamevar) {
getNextToken();
classProperty();
} else {
//'var' variable ';'
//'var' variable '=' constant ';'
do {
- if (token == TT_VARIABLE) {
+ if (token == TokenNameVARIABLE) {
getNextToken();
- if (token == TT_ASSIGN) {
+ if (token == TokenNameASSIGN) {
getNextToken();
constant();
}
} else {
throwSyntaxError("Variable expected after keyword 'var'.");
}
- if (token != TT_COMMA) {
+ if (token != TokenNameCOMMA) {
break;
}
getNextToken();
} while (true);
- if (token == TT_SEMICOLON) {
+ if (token == TokenNameSEMICOLON) {
getNextToken();
} else {
throwSyntaxError("';' expected after variable declaration.");
private void functionDeclarator() throws CoreException {
//identifier '(' [parameter-list] ')'
- if (token == TT_AMPERSAND) {
+ if (token == TokenNameAMPERSAND) {
getNextToken();
}
- if (token == TT_IDENTIFIER) {
+ if (token == TokenNameIDENTIFIER) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
} else {
throwSyntaxError("'(' expected in function declaration.");
}
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
parameterList();
}
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
throwSyntaxError("')' expected in function declaration.");
} else {
getNextToken();
//parameter-list ',' parameter-declaration
do {
parameterDeclaration();
- if (token != TT_COMMA) {
+ if (token != TokenNameCOMMA) {
break;
}
getNextToken();
private void parameterDeclaration() throws CoreException {
//variable
//variable-reference
- if (token == TT_AMPERSAND) {
+ if (token == TokenNameAMPERSAND) {
getNextToken();
- if (token == TT_VARIABLE) {
+ if (token == TokenNameVARIABLE) {
getNextToken();
} else {
throwSyntaxError("Variable expected after reference operator '&'.");
}
}
//variable '=' constant
- if (token == TT_VARIABLE) {
+ if (token == TokenNameVARIABLE) {
getNextToken();
- if (token == TT_ASSIGN) {
+ if (token == TokenNameASSIGN) {
getNextToken();
constant();
}
}
private void labeledStatementList() throws CoreException {
- if (token != TT_case && token != TT_default) {
+ if (token != TokenNamecase && token != TokenNamedefault) {
throwSyntaxError("'case' or 'default' expected.");
}
do {
- if (token == TT_case) {
+ if (token == TokenNamecase) {
getNextToken();
constant();
- if (token == TT_DDOT) {
+ if (token == TokenNameDDOT) {
getNextToken();
- if (token == TT_case || token == TT_default) { // empty case statement ?
+ if (token == TokenNamecase || token == TokenNamedefault) { // empty case statement ?
continue;
}
statementList();
- } else if (token == TT_SEMICOLON) {
+ } else if (token == TokenNameSEMICOLON) {
setMarker("':' expected after 'case' keyword found ';'.", rowCount, PHPParser.INFO);
getNextToken();
- if (token == TT_case) { // empty case statement ?
+ if (token == TokenNamecase) { // empty case statement ?
continue;
}
statementList();
} else {
throwSyntaxError("':' character after 'case' constant expected.");
}
- } else { // TT_default
+ } else { // TokenNamedefault
getNextToken();
- if (token == TT_DDOT) {
+ if (token == TokenNameDDOT) {
getNextToken();
statementList();
} else {
throwSyntaxError("':' character after 'default' expected.");
}
}
- } while (token == TT_case || token == TT_default);
+ } while (token == TokenNamecase || token == TokenNamedefault);
}
// public void labeledStatement() {
- // if (token == TT_case) {
+ // if (token == TokenNamecase) {
// getNextToken();
// constant();
- // if (token == TT_DDOT) {
+ // if (token == TokenNameDDOT) {
// getNextToken();
// statement();
// } else {
// throwSyntaxError("':' character after 'case' constant expected.");
// }
// return;
- // } else if (token == TT_default) {
+ // } else if (token == TokenNamedefault) {
// getNextToken();
- // if (token == TT_DDOT) {
+ // if (token == TokenNameDDOT) {
// getNextToken();
// statement();
// } else {
private void ifStatement() throws CoreException {
// ':' statement-list [elseif-list] [else-colon-statement] 'endif' ';'
- if (token == TT_DDOT) {
+ if (token == TokenNameDDOT) {
getNextToken();
statementList();
switch (token) {
- case TT_else :
+ case TokenNameelse :
getNextToken();
- if (token == TT_DDOT) {
+ if (token == TokenNameDDOT) {
getNextToken();
statementList();
} else {
- if (token == TT_if) { //'else if'
+ if (token == TokenNameif) { //'else if'
getNextToken();
elseifStatementList();
} else {
}
}
break;
- case TT_elseif :
+ case TokenNameelseif :
getNextToken();
elseifStatementList();
break;
}
- if (token != TT_endif) {
+ if (token != TokenNameendif) {
throwSyntaxError("'endif' expected.");
}
getNextToken();
- if (token != TT_SEMICOLON) {
+ if (token != TokenNameSEMICOLON) {
throwSyntaxError("';' expected after if-statement.");
}
getNextToken();
} else {
// statement [else-statement]
statement();
- if (token == TT_elseif) {
+ if (token == TokenNameelseif) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'elseif' keyword.");
}
expression();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameARGCLOSE) {
getNextToken();
} else {
throwSyntaxError("')' expected after 'elseif' condition.");
}
ifStatement();
- } else if (token == TT_else) {
+ } else if (token == TokenNameelse) {
getNextToken();
statement();
}
do {
elseifStatement();
switch (token) {
- case TT_else :
+ case TokenNameelse :
getNextToken();
- if (token == TT_DDOT) {
+ if (token == TokenNameDDOT) {
getNextToken();
statementList();
return;
} else {
- if (token == TT_if) { //'else if'
+ if (token == TokenNameif) { //'else if'
getNextToken();
} else {
throwSyntaxError("':' expected after 'else'.");
}
}
break;
- case TT_elseif :
+ case TokenNameelseif :
getNextToken();
break;
default :
}
private void elseifStatement() throws CoreException {
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
expression();
- if (token != TT_ARGOPEN) {
+ if (token != TokenNameARGOPEN) {
throwSyntaxError("')' expected in else-if-statement.");
}
getNextToken();
- if (token != TT_DDOT) {
+ if (token != TokenNameDDOT) {
throwSyntaxError("':' expected in else-if-statement.");
}
getNextToken();
}
private void switchStatement() throws CoreException {
- if (token == TT_DDOT) {
+ if (token == TokenNameDDOT) {
// ':' [labeled-statement-list] 'endswitch' ';'
getNextToken();
labeledStatementList();
- if (token != TT_endswitch) {
+ if (token != TokenNameendswitch) {
throwSyntaxError("'endswitch' expected.");
}
getNextToken();
- if (token != TT_SEMICOLON) {
+ if (token != TokenNameSEMICOLON) {
throwSyntaxError("';' expected after switch-statement.");
}
getNextToken();
} else {
// '{' [labeled-statement-list] '}'
- if (token != TT_LISTOPEN) {
+ if (token != TokenNameLISTOPEN) {
throwSyntaxError("'{' expected in switch statement.");
}
getNextToken();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
labeledStatementList();
}
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
throwSyntaxError("'}' expected in switch statement.");
}
getNextToken();
}
private void forStatement() throws CoreException {
- if (token == TT_DDOT) {
+ if (token == TokenNameDDOT) {
getNextToken();
statementList();
- if (token != TT_endfor) {
+ if (token != TokenNameendfor) {
throwSyntaxError("'endfor' expected.");
}
getNextToken();
- if (token != TT_SEMICOLON) {
+ if (token != TokenNameSEMICOLON) {
throwSyntaxError("';' expected after for-statement.");
}
getNextToken();
private void whileStatement() throws CoreException {
// ':' statement-list 'endwhile' ';'
- if (token == TT_DDOT) {
+ if (token == TokenNameDDOT) {
getNextToken();
statementList();
- if (token != TT_endwhile) {
+ if (token != TokenNameendwhile) {
throwSyntaxError("'endwhile' expected.");
}
getNextToken();
- if (token != TT_SEMICOLON) {
+ if (token != TokenNameSEMICOLON) {
throwSyntaxError("';' expected after while-statement.");
}
getNextToken();
}
private void foreachStatement() throws CoreException {
- if (token == TT_DDOT) {
+ if (token == TokenNameDDOT) {
getNextToken();
statementList();
- if (token != TT_endforeach) {
+ if (token != TokenNameendforeach) {
throwSyntaxError("'endforeach' expected.");
}
getNextToken();
- if (token != TT_SEMICOLON) {
+ if (token != TokenNameSEMICOLON) {
throwSyntaxError("';' expected after foreach-statement.");
}
getNextToken();
}
private void exitStatus() throws CoreException {
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
} else {
throwSyntaxError("'(' expected in 'exit-status'.");
}
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
expression();
}
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameARGCLOSE) {
getNextToken();
} else {
throwSyntaxError("')' expected after 'exit-status'.");
private void expressionList() throws CoreException {
do {
expression();
- if (token == TT_COMMA) {
+ if (token == TokenNameCOMMA) {
getNextToken();
} else {
break;
}
expression.append(str.charAt(i));
}
- // if (token == TT_STRING_CONSTANT || token == TT_INTERPOLATED_STRING) {
+ // if (token == TokenNameSTRING_CONSTANT || token == TokenNameINTERPOLATED_STRING) {
// getNextToken();
// } else {
logicalinclusiveorExpression();
- // while (token != TT_SEMICOLON) {
+ // while (token != TokenNameSEMICOLON) {
// getNextToken();
// // }
// }
String ident;
boolean castFlag = false;
switch (token) {
- case TT_new :
+ case TokenNamenew :
getNextToken();
expression();
break;
- case TT_null :
+ case TokenNamenull :
getNextToken();
break;
- case TT_false :
+ case TokenNamefalse :
getNextToken();
break;
- case TT_true :
+ case TokenNametrue :
getNextToken();
break;
- case TT_STRING_CONSTANT :
+ case TokenNameSTRING_CONSTANT :
getNextToken();
break;
- case TT_INTERPOLATED_STRING :
+ case TokenNameINTERPOLATED_STRING :
getNextToken();
break;
- case TT_ARGOPEN :
+ case TokenNameARGOPEN :
getNextToken();
- if (token == TT_IDENTIFIER) {
+ if (token == TokenNameIDENTIFIER) {
// check if identifier is a type:
ident = identifier;
String str = identifier.toLowerCase();
}
if (castFlag) {
getNextToken();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
throwSyntaxError(") expected after cast-type '" + ident + "'.");
}
getNextToken();
if (!castFlag) {
expression();
}
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
throwSyntaxError(") expected in postfix-expression.");
}
getNextToken();
break;
- case TT_DOUBLE_NUMBER :
+ case TokenNameDOUBLE_NUMBER :
getNextToken();
break;
- case TT_INT_NUMBER :
+ case TokenNameINT_NUMBER :
getNextToken();
break;
- case TT_DOLLAROPEN :
+ case TokenNameDOLLAROPEN :
getNextToken();
expression();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
throwSyntaxError("'}' expected after indirect variable token '${'.");
}
getNextToken();
break;
- case TT_VARIABLE :
+ case TokenNameVARIABLE :
ident = identifier;
getNextToken();
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLISTOPEN) {
getNextToken();
expression();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
throwSyntaxError("'}' expected after variable '" + ident + "' in variable-expression.");
}
getNextToken();
- } else if (token == TT_ARGOPEN) {
+ } else if (token == TokenNameARGOPEN) {
getNextToken();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
expressionList();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
throwSyntaxError("')' expected after variable '" + ident + "' in postfix-expression.");
}
}
getNextToken();
}
break;
- case TT_IDENTIFIER :
+ case TokenNameIDENTIFIER :
ident = identifier;
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
expressionList();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
throwSyntaxError("')' expected after identifier '" + ident + "' in postfix-expression.");
}
}
getNextToken();
}
break;
- case TT_print :
+ case TokenNameprint :
getNextToken();
expression();
- // if (token == TT_SEMICOLON) {
+ // if (token == TokenNameSEMICOLON) {
// getNextToken();
// } else {
// if (!phpEnd) {
// getNextToken();
// }
break;
- case TT_list :
+ case TokenNamelist :
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
- if (token == TT_COMMA) {
+ if (token == TokenNameCOMMA) {
getNextToken();
}
expressionList();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
throwSyntaxError("')' expected after 'list' keyword.");
}
getNextToken();
- // if (token == TT_SET) {
+ // if (token == TokenNameSET) {
// getNextToken();
// logicalinclusiveorExpression();
// }
throwSyntaxError("'(' expected after 'list' keyword.");
}
break;
- // case TT_exit :
+ // case TokenNameexit :
// getNextToken();
- // if (token != TT_SEMICOLON) {
+ // if (token != TokenNameSEMICOLON) {
// exitStatus();
// }
- // if (token == TT_SEMICOLON) {
+ // if (token == TokenNameSEMICOLON) {
// getNextToken();
// } else {
// if (!phpEnd) {
// getNextToken();
// }
// break;
- // case TT_die :
+ // case TokenNamedie :
// getNextToken();
- // if (token != TT_SEMICOLON) {
+ // if (token != TokenNameSEMICOLON) {
// exitStatus();
// }
- // if (token == TT_SEMICOLON) {
+ // if (token == TokenNameSEMICOLON) {
// getNextToken();
// } else {
// if (!phpEnd) {
// }
// break;
- // case TT_array :
+ // case TokenNamearray :
// getNextToken();
- // if (token == TT_ARGOPEN) {
+ // if (token == TokenNameARGOPEN) {
// getNextToken();
- // if (token == TT_COMMA) {
+ // if (token == TokenNameCOMMA) {
// getNextToken();
// }
// expressionList();
- // if (token != TT_ARGCLOSE) {
+ // if (token != TokenNameARGCLOSE) {
// throwSyntaxError("')' expected after 'list' keyword.");
// }
// getNextToken();
- // if (token == TT_SET) {
+ // if (token == TokenNameSET) {
// getNextToken();
// logicalinclusiveorExpression();
// }
boolean while_flag = true;
do {
switch (token) {
- case TT_PARTOPEN :
+ case TokenNamePARTOPEN :
getNextToken();
expression();
- if (token != TT_PARTCLOSE) {
+ if (token != TokenNamePARTCLOSE) {
throwSyntaxError("] expected in postfix-expression.");
}
getNextToken();
break;
- case TT_DDOT2 : // ::
- case TT_REF : // ->
+ case TokenNameDDOT2 : // ::
+ case TokenNameREF : // ->
getNextToken();
- if (token > TT_KEYWORD) {
+ if (token > TokenNameKEYWORD) {
ident = identifier;
setMarker("Avoid using keyword '" + ident + "' as variable name.", rowCount, PHPParser.INFO);
}
switch (token) {
- case TT_VARIABLE :
+ case TokenNameVARIABLE :
ident = identifier;
getNextToken();
- // if (token == TT_ARGOPEN) {
+ // if (token == TokenNameARGOPEN) {
// getNextToken();
// expressionList();
- // if (token != TT_ARGCLOSE) {
+ // if (token != TokenNameARGCLOSE) {
// throwSyntaxError(") expected after variable '" + ident + "'.");
// }
// getNextToken();
// }
break;
- case TT_IDENTIFIER :
+ case TokenNameIDENTIFIER :
ident = identifier;
getNextToken();
break;
- case TT_LISTOPEN :
+ case TokenNameLISTOPEN :
getNextToken();
expression();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
throwSyntaxError("} expected in postfix-expression.");
}
getNextToken();
break;
default :
throwSyntaxError("Syntax error after '->' token.");
- } while (token == TT_PARTOPEN || token == TT_ARGOPEN || token == TT_LISTOPEN) {
- if (token == TT_PARTOPEN) {
+ } while (token == TokenNamePARTOPEN || token == TokenNameARGOPEN || token == TokenNameLISTOPEN) {
+ if (token == TokenNamePARTOPEN) {
getNextToken();
expressionList();
- if (token != TT_PARTCLOSE) {
+ if (token != TokenNamePARTCLOSE) {
throwSyntaxError("] expected after '->'.");
}
getNextToken();
}
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
expressionList();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
throwSyntaxError(") expected after '->'.");
}
getNextToken();
}
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLISTOPEN) {
getNextToken();
expression();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
throwSyntaxError("} expected after '->'.");
}
getNextToken();
}
}
break;
- case TT_INCREMENT :
+ case TokenNameINCREMENT :
getNextToken();
break;
- case TT_DECREMENT :
+ case TokenNameDECREMENT :
getNextToken();
break;
default :
private void unaryExpression() throws CoreException {
switch (token) {
- case TT_INCREMENT :
+ case TokenNameINCREMENT :
getNextToken();
unaryExpression();
break;
- case TT_DECREMENT :
+ case TokenNameDECREMENT :
getNextToken();
unaryExpression();
break;
// '@' '&' '*' '+' '-' '~' '!'
- case TT_AT :
+ case TokenNameAT :
getNextToken();
castExpression();
break;
- case TT_AMPERSAND :
+ case TokenNameAMPERSAND :
getNextToken();
castExpression();
break;
- case TT_MULTIPLY :
+ case TokenNameMULTIPLY :
getNextToken();
castExpression();
break;
- case TT_ADD :
+ case TokenNameADD :
getNextToken();
castExpression();
break;
- case TT_SUBTRACT :
+ case TokenNameSUBTRACT :
getNextToken();
castExpression();
break;
- case TT_TILDE :
+ case TokenNameTILDE :
getNextToken();
castExpression();
break;
- case TT_NOT :
+ case TokenNameNOT :
getNextToken();
castExpression();
break;
}
private void castExpression() throws CoreException {
- // if (token == TT_ARGOPEN) {
+ // if (token == TokenNameARGOPEN) {
// getNextToken();
// typeName();
- // if (token != TT_ARGCLOSE) {
+ // if (token != TokenNameARGCLOSE) {
// throwSyntaxError(") expected after cast-expression.");
// }
// getNextToken();
//'real' 'double' 'float'
//'int' 'integer'
String ident = "";
- if (token == TT_IDENTIFIER) {
+ if (token == TokenNameIDENTIFIER) {
ident = identifier;
String str = identifier.toLowerCase();
getNextToken();
private void assignExpression() throws CoreException {
castExpression();
- if (token == TT_ASSIGN) { // =
+ if (token == TokenNameASSIGN) { // =
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_DOTASSIGN) { // .=
+ } else if (token == TokenNameDOTASSIGN) { // .=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_FOREACH) { // =>
+ } else if (token == TokenNameFOREACH) { // =>
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_ADDTO) { // +=
+ } else if (token == TokenNameADDTO) { // +=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_SUBTRACTFROM) { // -=
+ } else if (token == TokenNameSUBTRACTFROM) { // -=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_TIMESBY) { // *=
+ } else if (token == TokenNameTIMESBY) { // *=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_DIVIDEBY) { // *=
+ } else if (token == TokenNameDIVIDE_EQUAL) { // *=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_MODASSIGN) { // %=
+ } else if (token == TokenNameREMAINDER_EQUAL) { // %=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_ANDASSIGN) { // &=
+ } else if (token == TokenNameANDASSIGN) { // &=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_POWASSIGN) { // ^=
+ } else if (token == TokenNameXOR_EQUAL) { // ^=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_LSHIFTASSIGN) { // <<=
+ } else if (token == TokenNameLEFT_SHIFT_EQUAL) { // <<=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_RSHIFTASSIGN) { // >>=
+ } else if (token == TokenNameRIGHT_SHIFT_EQUAL) { // >>=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_TILDEASSIGN) { // ~=
+ } else if (token == TokenNameTILDEASSIGN) { // ~=
getNextToken();
logicalinclusiveorExpression();
}
private void multiplicativeExpression() throws CoreException {
do {
assignExpression();
- if (token != TT_MULTIPLY && token != TT_DIV && token != TT_MOD) {
+ if (token != TokenNameMULTIPLY && token != TokenNameDIVIDE && token != TokenNameREMAINDER) {
return;
}
getNextToken();
private void concatenationExpression() throws CoreException {
do {
multiplicativeExpression();
- if (token != TT_DOT) {
+ if (token != TokenNameDOT) {
return;
}
getNextToken();
private void additiveExpression() throws CoreException {
do {
concatenationExpression();
- if (token != TT_ADD && token != TT_SUBTRACT) {
+ if (token != TokenNameADD && token != TokenNameSUBTRACT) {
return;
}
getNextToken();
private void shiftExpression() throws CoreException {
do {
additiveExpression();
- if (token != TT_LSHIFT && token != TT_RSHIFT) {
+ if (token != TokenNameLEFT_SHIFT && token != TokenNameRSHIFT) {
return;
}
getNextToken();
private void relationalExpression() throws CoreException {
do {
shiftExpression();
- if (token != TT_LESS && token != TT_GREATER && token != TT_LESSEQUAL && token != TT_GREATEREQUAL) {
+ if (token != TokenNameLESS && token != TokenNameGREATER && token != TokenNameLESSEQUAL && token != TokenNameGREATEREQUAL) {
return;
}
getNextToken();
private void identicalExpression() throws CoreException {
do {
relationalExpression();
- if (token != TT_EX_EQUAL && token != TT_EX_UNEQUAL) {
+ if (token != TokenNameEX_EQUAL && token != TokenNameEX_UNEQUAL) {
return;
}
getNextToken();
private void equalityExpression() throws CoreException {
do {
identicalExpression();
- if (token != TT_EQUAL && token != TT_UNEQUAL) {
+ if (token != TokenNameEQUAL && token != TokenNameUNEQUAL) {
return;
}
getNextToken();
private void ternaryExpression() throws CoreException {
equalityExpression();
- if (token == TT_QUESTIONMARK) {
+ if (token == TokenNameQUESTIONMARK) {
getNextToken();
expression();
- if (token == TT_DDOT) {
+ if (token == TokenNameDDOT) {
getNextToken();
expression();
} else {
private void andExpression() throws CoreException {
do {
ternaryExpression();
- if (token != TT_AMPERSAND) {
+ if (token != TokenNameAMPERSAND) {
return;
}
getNextToken();
private void exclusiveorExpression() throws CoreException {
do {
andExpression();
- if (token != TT_POW) {
+ if (token != TokenNameXOR) {
return;
}
getNextToken();
private void inclusiveorExpression() throws CoreException {
do {
exclusiveorExpression();
- if (token != TT_LINE) {
+ if (token != TokenNameLINE) {
return;
}
getNextToken();
private void booleanandExpression() throws CoreException {
do {
inclusiveorExpression();
- if (token != TT_AND) {
+ if (token != TokenNameAND) {
return;
}
getNextToken();
private void booleanorExpression() throws CoreException {
do {
booleanandExpression();
- if (token != TT_OR) {
+ if (token != TokenNameOR) {
return;
}
getNextToken();
private void logicalandExpression() throws CoreException {
do {
booleanorExpression();
- if (token != TT_and) {
+ if (token != TokenNameand) {
return;
}
getNextToken();
private void logicalexclusiveorExpression() throws CoreException {
do {
logicalandExpression();
- if (token != TT_xor) {
+ if (token != TokenNamexor) {
return;
}
getNextToken();
private void logicalinclusiveorExpression() throws CoreException {
do {
logicalexclusiveorExpression();
- if (token != TT_or) {
+ if (token != TokenNameor) {
return;
}
getNextToken();
}
// public void assignmentExpression() {
- // if (token == TT_VARIABLE) {
+ // if (token == TokenNameVARIABLE) {
// getNextToken();
- // if (token == TT_SET) {
+ // if (token == TokenNameSET) {
// getNextToken();
// logicalinclusiveorExpression();
// }
private void variableList() throws CoreException {
do {
variable();
- if (token == TT_COMMA) {
+ if (token == TokenNameCOMMA) {
getNextToken();
} else {
break;
}
private void variable() throws CoreException {
- if (token == TT_DOLLAROPEN) {
+ if (token == TokenNameDOLLAROPEN) {
getNextToken();
expression();
;
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameLISTCLOSE) {
throwSyntaxError("'}' expected after indirect variable token '${'.");
}
getNextToken();
} else {
- if (token == TT_VARIABLE) {
+ if (token == TokenNameVARIABLE) {
getNextToken();
- if (token == TT_PARTOPEN) {
+ if (token == TokenNamePARTOPEN) {
getNextToken();
expression();
- if (token != TT_PARTCLOSE) {
+ if (token != TokenNamePARTCLOSE) {
throwSyntaxError("']' expected in variable-list.");
}
getNextToken();
- } else if (token == TT_ASSIGN) {
+ } else if (token == TokenNameASSIGN) {
getNextToken();
constant();
}
private void constant() throws CoreException {
String ident;
switch (token) {
- case TT_ADD :
+ case TokenNameADD :
getNextToken();
switch (token) {
- case TT_DOUBLE_NUMBER :
+ case TokenNameDOUBLE_NUMBER :
getNextToken();
break;
- case TT_INT_NUMBER :
+ case TokenNameINT_NUMBER :
getNextToken();
break;
default :
throwSyntaxError("Constant expected after '+' presign.");
}
break;
- case TT_SUBTRACT :
+ case TokenNameSUBTRACT :
getNextToken();
switch (token) {
- case TT_DOUBLE_NUMBER :
+ case TokenNameDOUBLE_NUMBER :
getNextToken();
break;
- case TT_INT_NUMBER :
+ case TokenNameINT_NUMBER :
getNextToken();
break;
default :
throwSyntaxError("Constant expected after '-' presign.");
}
break;
- case TT_null :
+ case TokenNamenull :
getNextToken();
break;
- case TT_false :
+ case TokenNamefalse :
getNextToken();
break;
- case TT_true :
+ case TokenNametrue :
getNextToken();
break;
- case TT_IDENTIFIER :
+ case TokenNameIDENTIFIER :
ident = identifier;
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameARGOPEN) {
getNextToken();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
expressionList();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameARGCLOSE) {
throwSyntaxError("')' expected after identifier '" + ident + "' in postfix-expression.");
}
}
getNextToken();
}
break;
- case TT_STRING_CONSTANT :
+ case TokenNameSTRING_CONSTANT :
getNextToken();
break;
- case TT_INTERPOLATED_STRING :
+ case TokenNameINTERPOLATED_STRING :
getNextToken();
break;
- case TT_DOUBLE_NUMBER :
+ case TokenNameDOUBLE_NUMBER :
getNextToken();
break;
- case TT_INT_NUMBER :
+ case TokenNameINT_NUMBER :
getNextToken();
break;
default :