}
public Token operator(int ch) throws IOException
{
GenericInputStream input = _input;
switch(ch) {
case '!':
ch = input.read();
if (ch == '=') {
ch = input.read();
if (ch == '=') {
return createToken(EXACT_NOT_EQUAL, "!==");
} else {
_backup = ch;
return createToken(NOT_EQUAL, "!=");
}
} else if (ch == '~') {
return createToken(NO_MATCH, "!~");
} else {
_backup = ch;
return createToken(NEGATION, "!");
}
case '%':
ch = input.read();
if (ch == '=') {
return createToken(ASSIGN_REMAINDER, "%=");
} else {
_backup = ch;
return createToken(REMAINDER, "%");
}
case '&':
ch = input.read();
if (ch == '&') {
return createToken(BOOLEAN_AND, "&&");
} else if (ch == '=') {
return createToken(ASSIGN_CONCAT, "&=");
} else {
_backup = ch;
return createToken(ET, "&");
}
case '*':
ch = input.read();
if (ch == '=') {
return createToken(ASSIGN_MULTIPLY, "*=");
} else {
_backup = ch;
return createToken(STAR, "*");
}
case '?':
ch = input.read();
if (ch == '?') {
return createToken(HOOKHOOK, "??");
} else if (ch == '=') {
return createToken(ASSIGN_INIT, "=?");
} else {
_backup = ch;
return createToken(HOOK, "?");
}
case '+':
ch = input.read();
if (ch == '+') {
return createToken(PLUSPLUS, "++");
} else if (ch == '=') {
return createToken(ASSIGN_ADD, "+=");
} else {
_backup = ch;
return createToken(PLUS, "+");
}
case '-':
ch = input.read();
if (ch == '-') {
return createToken(MINUSMINUS, "--");
} else if (ch == '=') {
return createToken(ASSIGN_SUBSTRACT, "-=");
} else if (ch == '>') {
return createToken(ARROW, "->");
} else {
_backup = ch;
return createToken(MINUS, "-");
}
case '.':
ch = input.read();
if (ch == '.') {
return createToken(RANGE, "..");
} else {
_backup = ch;
return createToken(DOT, ".");
}
case '/':
ch = input.read();
if (ch == '*') {
return skipToEndOfComment();
} else if (ch == '/') {
return skipToEndOfLineComment("//");
} else if (ch == '=') {
return createToken(ASSIGN_DIVIDE, "/=");
} else {
if (_allowPattern) {
return readPattern(ch);
} else {
_backup = ch;
return createToken(SLASH, "/");
}
}
case '<':
ch = input.read();
if (ch == '=') {
ch = input.read();
if (ch == '>') {
return createToken(COMPARE, "<=>");
} else if (ch == '=') {
ch = input.read();
if (ch == '>') {
return createToken(EXACT_COMPARE, "<==>");
}
_backup = ch;
} else {
_backup = ch;
return createToken(LESS_OR_EQUAL, "<=");
}
} else {
_backup = ch;
return createToken(LESS, "<");
}
case '=':
ch = input.read();
if (ch == '=') {
ch = input.read();
if (ch == '=') {
return createToken(EXACT_EQUAL, "===");
} else {
_backup = ch;
return createToken(EQUAL, "==");
}
} else if (ch == '>') {
return createToken(MAP, "=>");
} else {
_backup = ch;
return createToken(ASSIGN, "=");
}
case '>':
ch = input.read();
if (ch == '=') {
return createToken(GREATER_OR_EQUAL, ">=");
} else {
_backup = ch;
return createToken(GREATER, ">");
}
case '^':
ch = input.read();
if (ch == '^') {
return createToken(BOOLEAN_XOR, "^^");
} else {
_backup = ch;
return createToken(CARET, "^");
/*_parser.error(_parser.toLocation(_beginLine, _beginColumn),
"Invalid operator ^, ^^ assumed");
_beginColumn++;
return createToken(BOOLEAN_XOR, "^");*/
}
case '|':
ch = input.read();
if (ch == '|') {
return createToken(BOOLEAN_OR, "||");
} else {
_backup = ch;
return createToken(PIPE, "|");