if (getNextChar('='))
return TokenName.REMAINDER_EQUAL;
return TokenName.REMAINDER;
+
case '<': {
int oldPosition = currentPosition;
+
try {
currentCharacter = source[currentPosition++];
} catch (IndexOutOfBoundsException e) {
currentPosition = oldPosition;
return TokenName.LESS;
}
+
switch (currentCharacter) {
- case '=':
- return TokenName.LESS_EQUAL;
- case '>':
- return TokenName.NOT_EQUAL;
- case '<':
- if (getNextChar('='))
- return TokenName.LEFT_SHIFT_EQUAL;
- if (getNextChar('<')) {
- currentCharacter = source[currentPosition++];
- while (Character.isWhitespace(currentCharacter)) {
- currentCharacter = source[currentPosition++];
- }
- int heredocStart = currentPosition - 1;
- int heredocLength = 0;
- if (isPHPIdentifierStart(currentCharacter)) {
- currentCharacter = source[currentPosition++];
- } else {
- return TokenName.ERROR;
+ case '=':
+ return TokenName.LESS_EQUAL;
+
+ case '>':
+ return TokenName.NOT_EQUAL;
+
+ case '<':
+ if (getNextChar ('=')) {
+ return TokenName.LEFT_SHIFT_EQUAL;
}
- while (isPHPIdentifierPart(currentCharacter)) {
+
+ if (getNextChar('<')) {
currentCharacter = source[currentPosition++];
- }
- heredocLength = currentPosition - heredocStart
- - 1;
- // heredoc end-tag determination
- boolean endTag = true;
- char ch;
- do {
- ch = source[currentPosition++];
- if (ch == '\r' || ch == '\n') {
- if (recordLineSeparator) {
- pushLineSeparator();
- } else {
- currentLine = null;
- }
- for (int i = 0; i < heredocLength; i++) {
- if (source[currentPosition + i] != source[heredocStart
- + i]) {
- endTag = false;
- break;
+
+ while (Character.isWhitespace(currentCharacter)) {
+ currentCharacter = source[currentPosition++];
+ }
+
+ int heredocStart = currentPosition - 1;
+ int heredocLength = 0;
+
+ if (isPHPIdentifierStart (currentCharacter)) {
+ currentCharacter = source[currentPosition++];
+ }
+ else {
+ return TokenName.ERROR;
+ }
+
+ while (isPHPIdentifierPart(currentCharacter)) {
+ currentCharacter = source[currentPosition++];
+ }
+
+ heredocLength = currentPosition - heredocStart - 1;
+
+ // heredoc end-tag determination
+ boolean endTag = true;
+ char ch;
+ do {
+ ch = source[currentPosition++];
+
+ if (ch == '\r' || ch == '\n') {
+ if (recordLineSeparator) {
+ pushLineSeparator();
+ }
+ else {
+ currentLine = null;
+ }
+
+ for (int i = 0; i < heredocLength; i++) {
+ if (source[currentPosition + i] != source[heredocStart + i]) {
+ endTag = false;
+ break;
+ }
+ }
+
+ if (endTag) {
+ currentPosition += heredocLength - 1;
+ currentCharacter = source[currentPosition++];
+ break; // do...while loop
+ }
+ else {
+ endTag = true;
}
}
- if (endTag) {
- currentPosition += heredocLength - 1;
- currentCharacter = source[currentPosition++];
- break; // do...while loop
- } else {
- endTag = true;
- }
- }
- } while (true);
- return TokenName.HEREDOC;
+ } while (true);
+
+ return TokenName.HEREDOC;
+ }
+ return TokenName.LEFT_SHIFT;
}
- return TokenName.LEFT_SHIFT;
+ currentPosition = oldPosition;
+ return TokenName.LESS;
}
- currentPosition = oldPosition;
- return TokenName.LESS;
- }
+
case '>': {
int test;
if ((test = getNextChar('=', '>')) == 0)