import net.sourceforge.phpeclipse.actions.PHPStartApacheAction;
import net.sourceforge.phpeclipse.phpeditor.PHPString;
import net.sourceforge.phpeclipse.phpeditor.php.PHPKeywords;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
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 TokenNameERROR = 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 TokenNameMINUS = 36;
+ final static int TokenNamePLUS = 37;
+ final static int TokenNameEQUAL_EQUAL = 38;
+ final static int TokenNameNOT_EQUAL = 39;
+ final static int TokenNameGREATER = 40;
+ final static int TokenNameGREATER_EQUAL = 41;
+ final static int TokenNameLESS = 42;
+ final static int TokenNameLESS_EQUAL = 43;
+ final static int TokenNameAND_AND = 44;
+ final static int TokenNameOR_OR = 45;
+ // final static int TokenNameHASH = 46;
+ final static int TokenNameCOLON = 47;
+ final static int TokenNameDOT_EQUAL = 48;
+
+ final static int TokenNameEQUAL = 49;
+ final static int TokenNameMINUS_GREATER = 50; // ->
+ final static int TokenNameFOREACH = 51;
+ final static int TokenNameAND = 52;
+ //final static int TokenNameDOLLARLISTOPEN = 53;
+ final static int TokenNameTWIDDLE = 54;
+ final static int TokenNameTWIDDLE_EQUAL = 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 TokenNameAND_EQUAL = 60;
+ final static int TokenNameQUESTION = 61;
+ final static int TokenNameCOLON_COLON = 62;
+ final static int TokenNameAT = 63;
+ // final static int TokenNameHEREDOC = 64;
+
+ final static int TokenNameDOLLAROPEN = 127;
+ final static int TokenNameLPAREN = 128;
+ final static int TokenNameRPAREN = 129;
+ final static int TokenNameLBRACE = 130;
+ final static int TokenNameRBRACE = 131;
+ final static int TokenNameLBRACKET = 132;
+ final static int TokenNameRBRACKET = 133;
+ final static int TokenNameCOMMA = 134;
+
+ final static int TokenNameStringLiteral = 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 TokenNameMINUS_MINUS = 144;
+ final static int TokenNamePLUS_PLUS = 145;
+ final static int TokenNamePLUS_EQUAL = 146;
+ final static int TokenNameDIVIDE_EQUAL = 147;
+ final static int TokenNameMINUS_EQUAL = 148;
+ final static int TokenNameMULTIPLY_EQUAL = 149;
+ final static int TokenNameVariable = 150;
+ final static int TokenNameIntegerLiteral = 151;
+ final static int TokenNameDoubleLiteral = 152;
+ final static int TokenNameStringInterpolated = 153;
+ final static int TokenNameStringConstant = 154;
+
+ final static int TokenNameLEFT_SHIFT = 155;
+ final static int TokenNameRIGHT_SHIFT = 156;
+ final static int TokenNameEQUAL_EQUAL_EQUAL = 157;
+ final static int TokenNameNOT_EQUAL_EQUAL = 158;
+ final static int TokenNameOR = 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;
}
- private void getNextToken_OldVersion() throws CoreException {
- phpEnd = false;
-
- while (str.length() > chIndx) {
- ch = str.charAt(chIndx++);
- token = TT_UNDEFINED;
- if (ch == '\n') {
- rowCount++;
- columnCount = chIndx;
- continue; // while loop
- }
- if (str.length() == chIndx) {
- phpEnd = true;
- }
- if (!Character.isWhitespace(ch)) {
- if (ch == '$') {
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '{') {
- chIndx++;
- token = TT_DOLLAROPEN;
- return;
- }
- }
- getIdentifier();
- return;
- }
- if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '_') || (ch == '$')) {
- getIdentifier();
- return;
- }
- if (ch >= '0' && ch <= '9') {
- getNumber();
- return;
- }
- if (ch == '/') {
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '/') {
- chIndx++;
- // read comment until end of line:
- while ((str.length() > chIndx) && (str.charAt(chIndx) != '\n')) {
- chIndx++;
- }
- continue;
- } else if (str.charAt(chIndx) == '*') {
- chIndx++;
- // multi line comment:
- while (str.length() > chIndx) {
- if (str.charAt(chIndx) == '*' && (str.length() > (chIndx + 1)) && str.charAt(chIndx + 1) == '/') {
- chIndx += 2;
- break;
- }
- ch = str.charAt(chIndx++);
- if (ch == '\n') {
- rowCount++;
- columnCount = chIndx;
- }
- }
- continue;
- }
- }
- } else if (ch == '#') {
- // read comment until end of line:
- while ((str.length() > chIndx) && (str.charAt(chIndx) != '\n')) {
- chIndx++;
- }
- continue;
- } else if (ch == '"') {
- // read string until end
- boolean openString = true;
- while (str.length() > chIndx) {
- ch = str.charAt(chIndx++);
- if (ch == '\\') {
- if (str.length() > chIndx) {
- ch = str.charAt(chIndx++);
- }
- } else if (ch == '"') {
- openString = false;
- break;
- } else if (ch == '\n') {
- rowCount++;
- columnCount = chIndx;
- }
- }
- if (openString) {
- throwSyntaxError("Open string character '\"' at end of file.");
- }
- token = TT_INTERPOLATED_STRING;
- return;
- } else if (ch == '\'') {
- // read string until end
- boolean openString = true;
- int startRow = rowCount;
- while (str.length() > chIndx) {
- ch = str.charAt(chIndx++);
- if (ch == '\\') {
- if (str.length() > chIndx) {
- ch = str.charAt(chIndx++);
- }
- } else if (ch == '\'') {
- openString = false;
- break;
- } else if (ch == '\n') {
- rowCount++;
- columnCount = chIndx;
- }
- }
- if (openString) {
- throwSyntaxError("Open string character \"'\" at end of file.", startRow);
- }
- token = TT_STRING_CONSTANT;
- return;
- } else if (ch == '`') {
- // read string until end
- boolean openString = true;
- int startRow = rowCount;
- while (str.length() > chIndx) {
- ch = str.charAt(chIndx++);
- if (ch == '\\') {
- if (str.length() > chIndx) {
- ch = str.charAt(chIndx++);
- }
- } else if (ch == '`') {
- openString = false;
- break;
- } else if (ch == '\n') {
- rowCount++;
- columnCount = chIndx;
- }
- }
- if (openString) {
- throwSyntaxError("Open string character \"`\" at end of file.", startRow);
- }
- token = TT_STRING_CONSTANT;
- return;
- }
-
- switch (ch) {
-
- case '(' :
- token = TT_ARGOPEN;
-
- break;
- case ')' :
- token = TT_ARGCLOSE;
-
- break;
- case '{' :
- token = TT_LISTOPEN;
-
- break;
- case '}' :
- token = TT_LISTCLOSE;
-
- break;
- case '[' :
- token = TT_PARTOPEN;
-
- break;
- case ']' :
- token = TT_PARTCLOSE;
-
- break;
- case ',' :
- token = TT_COMMA;
-
- break;
- case '?' :
- token = TT_QUESTIONMARK;
- break;
- case '@' :
- token = TT_AT;
- break;
- case '~' :
- token = TT_TILDE;
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_TILDEASSIGN;
-
- break;
- }
- }
- break;
- case '.' :
- token = TT_DOT;
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_DOTASSIGN;
-
- break;
- }
- }
-
- break;
- case '"' :
- token = TT_STRING;
-
- break;
- case '%' :
- token = TT_MOD;
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_MODASSIGN;
-
- break;
- }
- }
- break;
- case ';' :
- token = TT_SEMICOLON;
-
- break;
- case '^' :
- token = TT_POW;
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_POWASSIGN;
-
- break;
- }
- }
- break;
- case '/' :
- token = TT_DIV;
-
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_DIVIDEBY;
-
- break;
- }
- }
-
- break;
- case '*' :
- token = TT_MULTIPLY;
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '*') {
- chIndx++;
- token = TT_POW;
-
- break;
- }
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_TIMESBY;
-
- break;
- }
- }
-
- break;
- case '+' :
- token = TT_ADD;
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '+') {
- chIndx++;
- token = TT_INCREMENT;
-
- break;
- }
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_ADDTO;
-
- break;
- }
- }
- break;
- case '-' :
- token = TT_SUBTRACT;
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '-') {
- chIndx++;
- token = TT_DECREMENT;
-
- break;
- }
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_SUBTRACTFROM;
-
- break;
- }
- if (str.charAt(chIndx) == '>') {
- chIndx++;
- token = TT_REF;
-
- break;
- }
- }
-
- break;
- case '=' :
- token = TT_ASSIGN;
-
- if (str.length() > chIndx) {
- ch = str.charAt(chIndx);
-
- if (ch == '=') {
- chIndx++;
- token = TT_EQUAL;
- if (str.length() > chIndx) {
- ch = str.charAt(chIndx);
-
- if (ch == '=') {
- chIndx++;
- token = TT_EX_EQUAL;
- }
- }
- break;
- }
- if (ch == '>') {
- chIndx++;
- token = TT_FOREACH;
-
- break;
- }
- }
-
- break;
- case '!' :
- token = TT_NOT;
-
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_UNEQUAL;
- if (str.length() > chIndx) {
- ch = str.charAt(chIndx);
-
- if (ch == '=') {
- chIndx++;
- token = TT_EX_UNEQUAL;
- }
- }
- break;
- }
- }
-
- break;
- case '>' :
- token = TT_GREATER;
-
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_GREATEREQUAL;
- break;
- }
- if (str.charAt(chIndx) == '>') {
- chIndx++;
- token = TT_RSHIFT;
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_RSHIFTASSIGN;
- break;
- }
- }
- break;
- }
- }
-
- break;
- case '<' :
- token = TT_LESS;
-
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_LESSEQUAL;
-
- break;
- }
- if (str.charAt(chIndx) == '<') {
- chIndx++;
- token = TT_LSHIFT;
- if (str.charAt(chIndx) == '<') {
- // heredoc
- int startRow = rowCount;
- if (str.length() > chIndx) {
-
- ch = str.charAt(++chIndx);
- if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '_')) {
- chIndx++;
- getIdentifier();
- token = TT_STRING_CONSTANT;
- while (str.length() > chIndx) {
- ch = str.charAt(chIndx++);
- if (ch == '\n') {
- if (str.length() >= chIndx + identifier.length()) {
- if (str.substring(chIndx, chIndx + identifier.length()).equals(identifier)) {
- chIndx += identifier.length();
- return;
- }
- }
- }
- }
- }
- }
- throwSyntaxError("Open heredoc syntax after operator '<<<'.", startRow);
- } else if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_LSHIFTASSIGN;
- break;
- }
- break;
- }
- }
-
- break;
-
- case '|' :
- token = TT_LINE;
-
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '|') {
- chIndx++;
- token = TT_OR;
-
- break;
- }
- }
-
- break;
- case '&' :
- token = TT_AMPERSAND;
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == '&') {
- chIndx++;
- token = TT_AND;
- break;
- }
- if (str.charAt(chIndx) == '=') {
- chIndx++;
- token = TT_ANDASSIGN;
- break;
- }
- break;
- }
-
- break;
- case ':' :
- token = TT_DDOT;
- if (str.length() > chIndx) {
- if (str.charAt(chIndx) == ':') {
- chIndx++;
- token = TT_DDOT2;
- }
- }
- break;
- case '#' :
- token = TT_HASH;
-
- break;
- // case '@' :
- // token = TT_AT;
- //
- // break;
- default :
- throwSyntaxError("unexpected character: '" + ch + "'");
- }
-
- if (token == TT_UNDEFINED) {
- throwSyntaxError("token not found");
- }
-
- return;
- }
- }
-
- chIndx = str.length() + 1;
- ch = ' ';
- token = TT_EOF;
- phpEnd = true;
- PHPString temp;
- if (phpList != null) {
- if (currentPHPString < phpList.size()) {
- token = TT_UNDEFINED;
- temp = (PHPString) phpList.get(currentPHPString++);
- this.str = temp.getPHPString();
- this.token = TT_EOF;
- this.chIndx = 0;
- this.rowCount = temp.getLineNumber();
- this.columnCount = 0;
- getNextToken();
- phpEnd = true;
- } else {
- token = TT_UNDEFINED;
- return;
- }
- }
- }
+// private void getNextToken_OldVersion() throws CoreException {
+// phpEnd = false;
+//
+// while (str.length() > chIndx) {
+// ch = str.charAt(chIndx++);
+// token = TokenNameERROR;
+// if (ch == '\n') {
+// rowCount++;
+// columnCount = chIndx;
+// continue; // while loop
+// }
+// if (str.length() == chIndx) {
+// phpEnd = true;
+// }
+// if (!Character.isWhitespace(ch)) {
+// if (ch == '$') {
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '{') {
+// chIndx++;
+// token = TokenNameDOLLAROPEN;
+// return;
+// }
+// }
+// getIdentifier();
+// return;
+// }
+// if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '_') || (ch == '$')) {
+// getIdentifier();
+// return;
+// }
+// if (ch >= '0' && ch <= '9') {
+// getNumber();
+// return;
+// }
+// if (ch == '/') {
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '/') {
+// chIndx++;
+// // read comment until end of line:
+// while ((str.length() > chIndx) && (str.charAt(chIndx) != '\n')) {
+// chIndx++;
+// }
+// continue;
+// } else if (str.charAt(chIndx) == '*') {
+// chIndx++;
+// // multi line comment:
+// while (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '*' && (str.length() > (chIndx + 1)) && str.charAt(chIndx + 1) == '/') {
+// chIndx += 2;
+// break;
+// }
+// ch = str.charAt(chIndx++);
+// if (ch == '\n') {
+// rowCount++;
+// columnCount = chIndx;
+// }
+// }
+// continue;
+// }
+// }
+// } else if (ch == '#') {
+// // read comment until end of line:
+// while ((str.length() > chIndx) && (str.charAt(chIndx) != '\n')) {
+// chIndx++;
+// }
+// continue;
+// } else if (ch == '"') {
+// // read string until end
+// boolean openString = true;
+// while (str.length() > chIndx) {
+// ch = str.charAt(chIndx++);
+// if (ch == '\\') {
+// if (str.length() > chIndx) {
+// ch = str.charAt(chIndx++);
+// }
+// } else if (ch == '"') {
+// openString = false;
+// break;
+// } else if (ch == '\n') {
+// rowCount++;
+// columnCount = chIndx;
+// }
+// }
+// if (openString) {
+// throwSyntaxError("Open string character '\"' at end of file.");
+// }
+// token = TokenNameINTERPOLATED_STRING;
+// return;
+// } else if (ch == '\'') {
+// // read string until end
+// boolean openString = true;
+// int startRow = rowCount;
+// while (str.length() > chIndx) {
+// ch = str.charAt(chIndx++);
+// if (ch == '\\') {
+// if (str.length() > chIndx) {
+// ch = str.charAt(chIndx++);
+// }
+// } else if (ch == '\'') {
+// openString = false;
+// break;
+// } else if (ch == '\n') {
+// rowCount++;
+// columnCount = chIndx;
+// }
+// }
+// if (openString) {
+// throwSyntaxError("Open string character \"'\" at end of file.", startRow);
+// }
+// token = TokenNameStringConstant;
+// return;
+// } else if (ch == '`') {
+// // read string until end
+// boolean openString = true;
+// int startRow = rowCount;
+// while (str.length() > chIndx) {
+// ch = str.charAt(chIndx++);
+// if (ch == '\\') {
+// if (str.length() > chIndx) {
+// ch = str.charAt(chIndx++);
+// }
+// } else if (ch == '`') {
+// openString = false;
+// break;
+// } else if (ch == '\n') {
+// rowCount++;
+// columnCount = chIndx;
+// }
+// }
+// if (openString) {
+// throwSyntaxError("Open string character \"`\" at end of file.", startRow);
+// }
+// token = TokenNameStringConstant;
+// return;
+// }
+//
+// switch (ch) {
+//
+// case '(' :
+// token = TokenNameLPAREN;
+//
+// break;
+// case ')' :
+// token = TokenNameRPAREN;
+//
+// break;
+// case '{' :
+// token = TokenNameLBRACE;
+//
+// break;
+// case '}' :
+// token = TokenNameRBRACE;
+//
+// break;
+// case '[' :
+// token = TokenNameLBRACKET;
+//
+// break;
+// case ']' :
+// token = TokenNameRBRACKET;
+//
+// break;
+// case ',' :
+// token = TokenNameCOMMA;
+//
+// break;
+// case '?' :
+// token = TokenNameQUESTION;
+// break;
+// case '@' :
+// token = TokenNameAT;
+// break;
+// case '~' :
+// token = TokenNameTWIDDLE;
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameTWIDDLE_EQUAL;
+//
+// break;
+// }
+// }
+// break;
+// case '.' :
+// token = TokenNameDOT;
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameDOT_EQUAL;
+//
+// break;
+// }
+// }
+//
+// break;
+// case '"' :
+// token = TokenNameStringLiteral;
+//
+// break;
+// case '%' :
+// token = TokenNameREMAINDER;
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameREMAINDER_EQUAL;
+//
+// break;
+// }
+// }
+// break;
+// case ';' :
+// token = TokenNameSEMICOLON;
+//
+// break;
+// case '^' :
+// token = TokenNameXOR;
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameXOR_EQUAL;
+//
+// break;
+// }
+// }
+// break;
+// case '/' :
+// token = TokenNameDIVIDE;
+//
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameDIVIDE_EQUAL;
+//
+// break;
+// }
+// }
+//
+// break;
+// case '*' :
+// token = TokenNameMULTIPLY;
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '*') {
+// chIndx++;
+// token = TokenNameXOR;
+//
+// break;
+// }
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameMULTIPLY_EQUAL;
+//
+// break;
+// }
+// }
+//
+// break;
+// case '+' :
+// token = TokenNamePLUS;
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '+') {
+// chIndx++;
+// token = TokenNamePLUS_PLUS;
+//
+// break;
+// }
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNamePLUS_EQUAL;
+//
+// break;
+// }
+// }
+// break;
+// case '-' :
+// token = TokenNameMINUS;
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '-') {
+// chIndx++;
+// token = TokenNameMINUS_MINUS;
+//
+// break;
+// }
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameMINUS_EQUAL;
+//
+// break;
+// }
+// if (str.charAt(chIndx) == '>') {
+// chIndx++;
+// token = TokenNameMINUS_GREATER;
+//
+// break;
+// }
+// }
+//
+// break;
+// case '=' :
+// token = TokenNameEQUAL;
+//
+// if (str.length() > chIndx) {
+// ch = str.charAt(chIndx);
+//
+// if (ch == '=') {
+// chIndx++;
+// token = TokenNameEQUAL_EQUAL;
+// if (str.length() > chIndx) {
+// ch = str.charAt(chIndx);
+//
+// if (ch == '=') {
+// chIndx++;
+// token = TokenNameEQUAL_EQUAL_EQUAL;
+// }
+// }
+// break;
+// }
+// if (ch == '>') {
+// chIndx++;
+// token = TokenNameFOREACH;
+//
+// break;
+// }
+// }
+//
+// break;
+// case '!' :
+// token = TokenNameNOT;
+//
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameNOT_EQUAL;
+// if (str.length() > chIndx) {
+// ch = str.charAt(chIndx);
+//
+// if (ch == '=') {
+// chIndx++;
+// token = TokenNameNOT_EQUAL_EQUAL;
+// }
+// }
+// break;
+// }
+// }
+//
+// break;
+// case '>' :
+// token = TokenNameGREATER;
+//
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameGREATER_EQUAL;
+// break;
+// }
+// if (str.charAt(chIndx) == '>') {
+// chIndx++;
+// token = TokenNameRIGHT_SHIFT;
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameRIGHT_SHIFT_EQUAL;
+// break;
+// }
+// }
+// break;
+// }
+// }
+//
+// break;
+// case '<' :
+// token = TokenNameLESS;
+//
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameLESS_EQUAL;
+//
+// break;
+// }
+// if (str.charAt(chIndx) == '<') {
+// chIndx++;
+// token = TokenNameLEFT_SHIFT;
+// if (str.charAt(chIndx) == '<') {
+// // heredoc
+// int startRow = rowCount;
+// if (str.length() > chIndx) {
+//
+// ch = str.charAt(++chIndx);
+// if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '_')) {
+// chIndx++;
+// getIdentifier();
+// token = TokenNameStringConstant;
+// while (str.length() > chIndx) {
+// ch = str.charAt(chIndx++);
+// if (ch == '\n') {
+// if (str.length() >= chIndx + identifier.length()) {
+// if (str.substring(chIndx, chIndx + identifier.length()).equals(identifier)) {
+// chIndx += identifier.length();
+// return;
+// }
+// }
+// }
+// }
+// }
+// }
+// throwSyntaxError("Open heredoc syntax after operator '<<<'.", startRow);
+// } else if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameLEFT_SHIFT_EQUAL;
+// break;
+// }
+// break;
+// }
+// }
+//
+// break;
+//
+// case '|' :
+// token = TokenNameOR;
+//
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '|') {
+// chIndx++;
+// token = TokenNameOR_OR;
+//
+// break;
+// }
+// }
+//
+// break;
+// case '&' :
+// token = TokenNameAND;
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == '&') {
+// chIndx++;
+// token = TokenNameAND_AND;
+// break;
+// }
+// if (str.charAt(chIndx) == '=') {
+// chIndx++;
+// token = TokenNameAND_EQUAL;
+// break;
+// }
+// break;
+// }
+//
+// break;
+// case ':' :
+// token = TokenNameCOLON;
+// if (str.length() > chIndx) {
+// if (str.charAt(chIndx) == ':') {
+// chIndx++;
+// token = TokenNameCOLON_COLON;
+// }
+// }
+// break;
+// case '#' :
+// token = TokenNameHASH;
+//
+// break;
+// // case '@' :
+// // token = TokenNameAT;
+// //
+// // break;
+// default :
+// throwSyntaxError("unexpected character: '" + ch + "'");
+// }
+//
+// if (token == TokenNameERROR) {
+// throwSyntaxError("token not found");
+// }
+//
+// return;
+// }
+// }
+//
+// chIndx = str.length() + 1;
+// ch = ' ';
+// token = TokenNameEOF;
+// phpEnd = true;
+// PHPString temp;
+// if (phpList != null) {
+// if (currentPHPString < phpList.size()) {
+// token = TokenNameERROR;
+// temp = (PHPString) phpList.get(currentPHPString++);
+// this.str = temp.getPHPString();
+// this.token = TokenNameEOF;
+// this.chIndx = 0;
+// this.rowCount = temp.getLineNumber();
+// this.columnCount = 0;
+// getNextToken();
+// phpEnd = true;
+// } else {
+// token = TokenNameERROR;
+// return;
+// }
+// }
+// }
/**
* gets the next token from input
*/
if (!phpMode) {
while (str.length() > chIndx) {
- token = TT_UNDEFINED;
+ token = TokenNameERROR;
ch = str.charAt(chIndx++);
if (ch == '\n') {
if (phpMode) {
while (str.length() > chIndx) {
ch = str.charAt(chIndx++);
- token = TT_UNDEFINED;
+ token = TokenNameERROR;
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('"',TokenNameStringInterpolated,"Open string character '\"' at end of file.");
return;
} else if (ch == '\'') {
- getString('\'',TT_STRING_CONSTANT,"Open string character \"'\" at end of file.");
+ getString('\'',TokenNameStringConstant,"Open string character \"'\" at end of file.");
return;
} else if (ch == '`') {
- getString('`',TT_STRING_CONSTANT,"Open string character \"`\" at end of file.");
+ getString('`',TokenNameStringConstant,"Open string character \"`\" at end of file.");
setMarker("Other string delimiters prefered (found \"`\").", rowCount, PHPParser.INFO);
return;
}
switch (ch) {
case '(' :
- token = TT_ARGOPEN;
+ token = TokenNameLPAREN;
break;
case ')' :
- token = TT_ARGCLOSE;
+ token = TokenNameRPAREN;
break;
case '{' :
- token = TT_LISTOPEN;
+ token = TokenNameLBRACE;
break;
case '}' :
- token = TT_LISTCLOSE;
+ token = TokenNameRBRACE;
break;
case '[' :
- token = TT_PARTOPEN;
+ token = TokenNameLBRACKET;
break;
case ']' :
- token = TT_PARTCLOSE;
+ token = TokenNameRBRACKET;
break;
case ',' :
- token = TT_COMMA;
+ token = TokenNameCOMMA;
break;
case '?' :
- token = TT_QUESTIONMARK;
+ token = TokenNameQUESTION;
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 = TokenNameTWIDDLE;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_TILDEASSIGN;
+ token = TokenNameTWIDDLE_EQUAL;
break;
}
}
break;
case '.' :
- token = TT_DOT;
+ token = TokenNameDOT;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_DOTASSIGN;
+ token = TokenNameDOT_EQUAL;
break;
}
break;
case '"' :
- token = TT_STRING;
+ token = TokenNameStringLiteral;
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 = TokenNameMULTIPLY_EQUAL;
break;
}
break;
case '+' :
- token = TT_ADD;
+ token = TokenNamePLUS;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '+') {
chIndx++;
- token = TT_INCREMENT;
+ token = TokenNamePLUS_PLUS;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_ADDTO;
+ token = TokenNamePLUS_EQUAL;
break;
}
}
break;
case '-' :
- token = TT_SUBTRACT;
+ token = TokenNameMINUS;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '-') {
chIndx++;
- token = TT_DECREMENT;
+ token = TokenNameMINUS_MINUS;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_SUBTRACTFROM;
+ token = TokenNameMINUS_EQUAL;
break;
}
if (str.charAt(chIndx) == '>') {
chIndx++;
- token = TT_REF;
+ token = TokenNameMINUS_GREATER;
break;
}
break;
case '=' :
- token = TT_ASSIGN;
+ token = TokenNameEQUAL;
if (str.length() > chIndx) {
ch = str.charAt(chIndx);
if (ch == '=') {
chIndx++;
- token = TT_EQUAL;
+ token = TokenNameEQUAL_EQUAL;
if (str.length() > chIndx) {
ch = str.charAt(chIndx);
if (ch == '=') {
chIndx++;
- token = TT_EX_EQUAL;
+ token = TokenNameEQUAL_EQUAL_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 = TokenNameNOT_EQUAL;
if (str.length() > chIndx) {
ch = str.charAt(chIndx);
if (ch == '=') {
chIndx++;
- token = TT_EX_UNEQUAL;
+ token = TokenNameNOT_EQUAL_EQUAL;
}
}
break;
break;
case '>' :
- token = TT_GREATER;
+ token = TokenNameGREATER;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_GREATEREQUAL;
+ token = TokenNameGREATER_EQUAL;
break;
}
if (str.charAt(chIndx) == '>') {
chIndx++;
- token = TT_RSHIFT;
+ token = TokenNameRIGHT_SHIFT;
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 = TokenNameLESS_EQUAL;
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 = TokenNameStringConstant;
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 = TokenNameOR;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '|') {
chIndx++;
- token = TT_OR;
+ token = TokenNameOR_OR;
break;
}
break;
case '&' :
- token = TT_AMPERSAND;
+ token = TokenNameAND;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == '&') {
chIndx++;
- token = TT_AND;
+ token = TokenNameAND_AND;
break;
}
if (str.charAt(chIndx) == '=') {
chIndx++;
- token = TT_ANDASSIGN;
+ token = TokenNameAND_EQUAL;
break;
}
break;
break;
case ':' :
- token = TT_DDOT;
+ token = TokenNameCOLON;
if (str.length() > chIndx) {
if (str.charAt(chIndx) == ':') {
chIndx++;
- token = TT_DDOT2;
+ token = TokenNameCOLON_COLON;
}
}
break;
- case '#' :
- token = TT_HASH;
-
- break;
+// case '#' :
+// token = TokenNameHASH;
+//
+// break;
// case '@' :
- // token = TT_AT;
+ // token = TokenNameAT;
//
// break;
default :
throwSyntaxError("unexpected character: '" + ch + "'");
}
- if (token == TT_UNDEFINED) {
+ if (token == TokenNameERROR) {
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 = TokenNameDoubleLiteral;
return;
} else {
longNumber = Long.valueOf(inum.toString(), numFormat);
- token = TT_INT_NUMBER;
+ token = TokenNameIntegerLiteral;
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 == TokenNameStringConstant) {
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 != TokenNameERROR) {
statementList();
}
- if (token != TT_EOF && token != TT_UNDEFINED) {
- if (token == TT_ARGCLOSE) {
+ if (token != TokenNameEOF && token != TokenNameERROR) {
+ if (token == TokenNameRPAREN) {
throwSyntaxError("Too many closing ')'; end-of-file not reached.");
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameRBRACE) {
throwSyntaxError("Too many closing '}'; end-of-file not reached.");
}
- if (token == TT_PARTCLOSE) {
+ if (token == TokenNameRBRACKET) {
throwSyntaxError("Too many closing ']'; end-of-file not reached.");
}
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameLPAREN) {
throwSyntaxError("Read character '('; end-of-file not reached.");
}
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLBRACE) {
throwSyntaxError("Read character '{'; end-of-file not reached.");
}
- if (token == TT_PARTOPEN) {
+ if (token == TokenNameLBRACKET) {
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 != TokenNameERROR) {
+ if (token == TokenNameclass || token == TokenNamefunction) {
break;
}
getNextToken();
}
- if (token == TT_EOF || token == TT_UNDEFINED) {
+ if (token == TokenNameEOF || token == TokenNameERROR) {
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 != TokenNameERROR) {
statementList();
}
- if (token != TT_EOF && token != TT_UNDEFINED) {
- if (token == TT_ARGCLOSE) {
+ if (token != TokenNameEOF && token != TokenNameERROR) {
+ if (token == TokenNameRPAREN) {
throwSyntaxError("Too many closing ')'; end-of-file not reached.");
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameRBRACE) {
throwSyntaxError("Too many closing '}'; end-of-file not reached.");
}
- if (token == TT_PARTCLOSE) {
+ if (token == TokenNameRBRACKET) {
throwSyntaxError("Too many closing ']'; end-of-file not reached.");
}
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameLPAREN) {
throwSyntaxError("Read character '('; end-of-file not reached.");
}
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLBRACE) {
throwSyntaxError("Read character '{'; end-of-file not reached.");
}
- if (token == TT_PARTOPEN) {
+ if (token == TokenNameLBRACKET) {
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 != TokenNameERROR) {
+ if (token == TokenNameclass || token == TokenNamefunction) {
break;
}
getNextToken();
}
- if (token == TT_EOF || token == TT_UNDEFINED) {
+ if (token == TokenNameEOF || token == TokenNameERROR) {
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 != TokenNameERROR) {
+ 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 TokenNameDoubleLiteral : 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 TokenNameIntegerLiteral : 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 TokenNameStringInterpolated : 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 TokenNameStringConstant : 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 == TokenNameAND) {
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 != TokenNameLBRACE && token != TokenNameEOF && token != TokenNameERROR) {
getNextToken();
}
parseDeclarations(outlineInfo, temp, true);
// stack.pop();
}
- } else if (token == TT_LISTOPEN) {
+ } else if (token == TokenNameLBRACE) {
getNextToken();
counter++;
- } else if (token == TT_LISTCLOSE) {
+ } else if (token == TokenNameRBRACE) {
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 == TokenNameRBRACE)
+ || (token == TokenNamecase)
+ || (token == TokenNamedefault)
+ || (token == TokenNameelseif)
+ || (token == TokenNameendif)
+ || (token == TokenNameendfor)
+ || (token == TokenNameendforeach)
+ || (token == TokenNameendwhile)
+ || (token == TokenNameendswitch)
+ || (token == TokenNameEOF)
+ || (token == TokenNameERROR)) {
return;
}
} while (true);
private void compoundStatement() throws CoreException {
// '{' [statement-list] '}'
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLBRACE) {
getNextToken();
} else {
throwSyntaxError("'{' expected in compound-statement.");
}
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameRBRACE) {
statementList();
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameRBRACE) {
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 == TokenNameLPAREN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'if' keyword.");
}
expression();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameRPAREN) {
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 == TokenNameLPAREN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'switch' keyword.");
}
expression();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameRPAREN) {
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 == TokenNameLPAREN) {
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 == TokenNameRPAREN) {
getNextToken();
} else {
expressionList();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameRPAREN) {
getNextToken();
} else {
throwSyntaxError("')' expected after 'for'.");
}
forStatement();
return;
- } else if (token == TT_while) {
+ } else if (token == TokenNamewhile) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameLPAREN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'while' keyword.");
}
expression();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameRPAREN) {
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 == TokenNameLBRACE) {
getNextToken();
} else {
throwSyntaxError("'{' expected after 'do' keyword.");
}
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameRBRACE) {
statementList();
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameRBRACE) {
getNextToken();
} else {
throwSyntaxError("'}' expected after 'do' keyword.");
}
- if (token == TT_while) {
+ if (token == TokenNamewhile) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameLPAREN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'while' keyword.");
}
expression();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameRPAREN) {
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 == TokenNameLPAREN) {
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 == TokenNameRPAREN) {
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 == TokenNameLPAREN) {
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 == TokenNameRPAREN) {
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 == TokenNameLBRACE) {
// compoundStatement
getNextToken();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameRBRACE) {
statementList();
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameRBRACE) {
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 == TokenNameLBRACE) {
getNextToken();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameRBRACE) {
classElementList();
}
- if (token == TT_LISTCLOSE) {
+ if (token == TokenNameRBRACE) {
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 == TokenNameEQUAL) {
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 == TokenNameAND) {
getNextToken();
}
- if (token == TT_IDENTIFIER) {
+ if (token == TokenNameIdentifier) {
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameLPAREN) {
getNextToken();
} else {
throwSyntaxError("'(' expected in function declaration.");
}
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
parameterList();
}
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
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 == TokenNameAND) {
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 == TokenNameEQUAL) {
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 == TokenNameCOLON) {
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 == TokenNameCOLON) {
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 == TokenNameCOLON) {
getNextToken();
statementList();
switch (token) {
- case TT_else :
+ case TokenNameelse :
getNextToken();
- if (token == TT_DDOT) {
+ if (token == TokenNameCOLON) {
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 == TokenNameLPAREN) {
getNextToken();
} else {
throwSyntaxError("'(' expected after 'elseif' keyword.");
}
expression();
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameRPAREN) {
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 == TokenNameCOLON) {
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 == TokenNameLPAREN) {
getNextToken();
expression();
- if (token != TT_ARGOPEN) {
+ if (token != TokenNameLPAREN) {
throwSyntaxError("')' expected in else-if-statement.");
}
getNextToken();
- if (token != TT_DDOT) {
+ if (token != TokenNameCOLON) {
throwSyntaxError("':' expected in else-if-statement.");
}
getNextToken();
}
private void switchStatement() throws CoreException {
- if (token == TT_DDOT) {
+ if (token == TokenNameCOLON) {
// ':' [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 != TokenNameLBRACE) {
throwSyntaxError("'{' expected in switch statement.");
}
getNextToken();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameRBRACE) {
labeledStatementList();
}
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameRBRACE) {
throwSyntaxError("'}' expected in switch statement.");
}
getNextToken();
}
private void forStatement() throws CoreException {
- if (token == TT_DDOT) {
+ if (token == TokenNameCOLON) {
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 == TokenNameCOLON) {
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 == TokenNameCOLON) {
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 == TokenNameLPAREN) {
getNextToken();
} else {
throwSyntaxError("'(' expected in 'exit-status'.");
}
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
expression();
}
- if (token == TT_ARGCLOSE) {
+ if (token == TokenNameRPAREN) {
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 TokenNameStringConstant :
getNextToken();
break;
- case TT_INTERPOLATED_STRING :
+ case TokenNameStringInterpolated :
getNextToken();
break;
- case TT_ARGOPEN :
+ case TokenNameLPAREN :
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 != TokenNameRPAREN) {
throwSyntaxError(") expected after cast-type '" + ident + "'.");
}
getNextToken();
if (!castFlag) {
expression();
}
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
throwSyntaxError(") expected in postfix-expression.");
}
getNextToken();
break;
- case TT_DOUBLE_NUMBER :
+ case TokenNameDoubleLiteral :
getNextToken();
break;
- case TT_INT_NUMBER :
+ case TokenNameIntegerLiteral :
getNextToken();
break;
- case TT_DOLLAROPEN :
+ case TokenNameDOLLAROPEN :
getNextToken();
expression();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameRBRACE) {
throwSyntaxError("'}' expected after indirect variable token '${'.");
}
getNextToken();
break;
- case TT_VARIABLE :
+ case TokenNameVariable :
ident = identifier;
getNextToken();
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLBRACE) {
getNextToken();
expression();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameRBRACE) {
throwSyntaxError("'}' expected after variable '" + ident + "' in variable-expression.");
}
getNextToken();
- } else if (token == TT_ARGOPEN) {
+ } else if (token == TokenNameLPAREN) {
getNextToken();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
expressionList();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
throwSyntaxError("')' expected after variable '" + ident + "' in postfix-expression.");
}
}
getNextToken();
}
break;
- case TT_IDENTIFIER :
+ case TokenNameIdentifier :
ident = identifier;
getNextToken();
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameLPAREN) {
getNextToken();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
expressionList();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
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 == TokenNameLPAREN) {
getNextToken();
- if (token == TT_COMMA) {
+ if (token == TokenNameCOMMA) {
getNextToken();
}
expressionList();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
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 TokenNameLBRACKET :
getNextToken();
expression();
- if (token != TT_PARTCLOSE) {
+ if (token != TokenNameRBRACKET) {
throwSyntaxError("] expected in postfix-expression.");
}
getNextToken();
break;
- case TT_DDOT2 : // ::
- case TT_REF : // ->
+ case TokenNameCOLON_COLON : // ::
+ case TokenNameMINUS_GREATER : // ->
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 TokenNameLBRACE :
getNextToken();
expression();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameRBRACE) {
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 == TokenNameLBRACKET || token == TokenNameLPAREN || token == TokenNameLBRACE) {
+ if (token == TokenNameLBRACKET) {
getNextToken();
expressionList();
- if (token != TT_PARTCLOSE) {
+ if (token != TokenNameRBRACKET) {
throwSyntaxError("] expected after '->'.");
}
getNextToken();
}
- if (token == TT_ARGOPEN) {
+ if (token == TokenNameLPAREN) {
getNextToken();
expressionList();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
throwSyntaxError(") expected after '->'.");
}
getNextToken();
}
- if (token == TT_LISTOPEN) {
+ if (token == TokenNameLBRACE) {
getNextToken();
expression();
- if (token != TT_LISTCLOSE) {
+ if (token != TokenNameRBRACE) {
throwSyntaxError("} expected after '->'.");
}
getNextToken();
}
}
break;
- case TT_INCREMENT :
+ case TokenNamePLUS_PLUS :
getNextToken();
break;
- case TT_DECREMENT :
+ case TokenNameMINUS_MINUS :
getNextToken();
break;
default :
private void unaryExpression() throws CoreException {
switch (token) {
- case TT_INCREMENT :
+ case TokenNamePLUS_PLUS :
getNextToken();
unaryExpression();
break;
- case TT_DECREMENT :
+ case TokenNameMINUS_MINUS :
getNextToken();
unaryExpression();
break;
// '@' '&' '*' '+' '-' '~' '!'
- case TT_AT :
+ case TokenNameAT :
getNextToken();
castExpression();
break;
- case TT_AMPERSAND :
+ case TokenNameAND :
getNextToken();
castExpression();
break;
- case TT_MULTIPLY :
+ case TokenNameMULTIPLY :
getNextToken();
castExpression();
break;
- case TT_ADD :
+ case TokenNamePLUS :
getNextToken();
castExpression();
break;
- case TT_SUBTRACT :
+ case TokenNameMINUS :
getNextToken();
castExpression();
break;
- case TT_TILDE :
+ case TokenNameTWIDDLE :
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 == TokenNameEQUAL) { // =
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_DOTASSIGN) { // .=
+ } else if (token == TokenNameDOT_EQUAL) { // .=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_FOREACH) { // =>
+ } else if (token == TokenNameFOREACH) { // =>
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_ADDTO) { // +=
+ } else if (token == TokenNamePLUS_EQUAL) { // +=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_SUBTRACTFROM) { // -=
+ } else if (token == TokenNameMINUS_EQUAL) { // -=
getNextToken();
logicalinclusiveorExpression();
- } else if (token == TT_TIMESBY) { // *=
+ } else if (token == TokenNameMULTIPLY_EQUAL) { // *=
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 == TokenNameAND_EQUAL) { // &=
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 == TokenNameTWIDDLE_EQUAL) { // ~=
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 != TokenNamePLUS && token != TokenNameMINUS) {
return;
}
getNextToken();
private void shiftExpression() throws CoreException {
do {
additiveExpression();
- if (token != TT_LSHIFT && token != TT_RSHIFT) {
+ if (token != TokenNameLEFT_SHIFT && token != TokenNameRIGHT_SHIFT) {
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 != TokenNameLESS_EQUAL && token != TokenNameGREATER_EQUAL) {
return;
}
getNextToken();
private void identicalExpression() throws CoreException {
do {
relationalExpression();
- if (token != TT_EX_EQUAL && token != TT_EX_UNEQUAL) {
+ if (token != TokenNameEQUAL_EQUAL_EQUAL && token != TokenNameNOT_EQUAL_EQUAL) {
return;
}
getNextToken();
private void equalityExpression() throws CoreException {
do {
identicalExpression();
- if (token != TT_EQUAL && token != TT_UNEQUAL) {
+ if (token != TokenNameEQUAL_EQUAL && token != TokenNameNOT_EQUAL) {
return;
}
getNextToken();
private void ternaryExpression() throws CoreException {
equalityExpression();
- if (token == TT_QUESTIONMARK) {
+ if (token == TokenNameQUESTION) {
getNextToken();
expression();
- if (token == TT_DDOT) {
+ if (token == TokenNameCOLON) {
getNextToken();
expression();
} else {
private void andExpression() throws CoreException {
do {
ternaryExpression();
- if (token != TT_AMPERSAND) {
+ if (token != TokenNameAND) {
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 != TokenNameOR) {
return;
}
getNextToken();
private void booleanandExpression() throws CoreException {
do {
inclusiveorExpression();
- if (token != TT_AND) {
+ if (token != TokenNameAND_AND) {
return;
}
getNextToken();
private void booleanorExpression() throws CoreException {
do {
booleanandExpression();
- if (token != TT_OR) {
+ if (token != TokenNameOR_OR) {
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 != TokenNameRBRACE) {
throwSyntaxError("'}' expected after indirect variable token '${'.");
}
getNextToken();
} else {
- if (token == TT_VARIABLE) {
+ if (token == TokenNameVariable) {
getNextToken();
- if (token == TT_PARTOPEN) {
+ if (token == TokenNameLBRACKET) {
getNextToken();
expression();
- if (token != TT_PARTCLOSE) {
+ if (token != TokenNameRBRACKET) {
throwSyntaxError("']' expected in variable-list.");
}
getNextToken();
- } else if (token == TT_ASSIGN) {
+ } else if (token == TokenNameEQUAL) {
getNextToken();
constant();
}
private void constant() throws CoreException {
String ident;
switch (token) {
- case TT_ADD :
+ case TokenNamePLUS :
getNextToken();
switch (token) {
- case TT_DOUBLE_NUMBER :
+ case TokenNameDoubleLiteral :
getNextToken();
break;
- case TT_INT_NUMBER :
+ case TokenNameIntegerLiteral :
getNextToken();
break;
default :
throwSyntaxError("Constant expected after '+' presign.");
}
break;
- case TT_SUBTRACT :
+ case TokenNameMINUS :
getNextToken();
switch (token) {
- case TT_DOUBLE_NUMBER :
+ case TokenNameDoubleLiteral :
getNextToken();
break;
- case TT_INT_NUMBER :
+ case TokenNameIntegerLiteral :
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 == TokenNameLPAREN) {
getNextToken();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
expressionList();
- if (token != TT_ARGCLOSE) {
+ if (token != TokenNameRPAREN) {
throwSyntaxError("')' expected after identifier '" + ident + "' in postfix-expression.");
}
}
getNextToken();
}
break;
- case TT_STRING_CONSTANT :
+ case TokenNameStringConstant :
getNextToken();
break;
- case TT_INTERPOLATED_STRING :
+ case TokenNameStringInterpolated :
getNextToken();
break;
- case TT_DOUBLE_NUMBER :
+ case TokenNameDoubleLiteral :
getNextToken();
break;
- case TT_INT_NUMBER :
+ case TokenNameIntegerLiteral :
getNextToken();
break;
default :
MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.EXTERNAL_PARSER_PREF));
String command = form.format(arguments);
- String parserResult = PHPStartApacheAction.execute(command, "External parser: ");
+ String parserResult = PHPStartApacheAction.getParserOutput(command, "External parser: ");
- try {
+ try {
// parse the buffer to find the errors and warnings
createMarkers(parserResult, file);
} catch (CoreException e) {