LemonJS/parsers/filters/lexer.js

2046 lines
74 KiB
JavaScript

/* Generated by re2c 1.0.3 on Tue Jan 29 10:00:10 2019 */
var types = [
"SLASH",
"LSB",
"RSB",
"LCB",
"RCB",
"COLON",
"COMMA",
"DOT",
"REM",
"GT",
"GTE",
"LT",
"LTE",
"EQ",
"NEQ",
"LIKE",
"NLIKE",
"AND",
"OR",
"NOT",
"ADDRESS",
"OID",
"TIME",
"TIMEDIFF",
"INTEGER_LITERAL",
"FLOAT_LITERAL",
"BOOL_LITERAL",
"ID"
];
var errors = {
"-2": "not found close quote or singleQuote",
"-1": "not found any lexemes or errors or anything else",
"0": "success",
"1": "found unknown symbol"
};
var Lexer = function(_string) {
this._last_found_lexeme = {
error: -1
};
this._end = false;
this._error = false;
this._string = _string;
this._state = 1;
this._yy_char = null;
this._yy_lex_start = 0;
this._yy_cursor = 0;
this._yy_marker = 0;
this._yy_accept = 0;
};
Lexer.prototype = {
types: types,
errors: errors,
_notFoundCloseQuote: function() {
this._error = true;
this._last_found_lexeme = {
error: 2,
start: this._yy_lex_start,
end: this._yy_cursor
};
console.log(print_f("Not found close quote start: %s", this._yy_cursor));
},
_unknownSymbol: function() {
this._error = true;
this._last_found_lexeme = {
error: 1,
start: this._yy_lex_start,
end: this._yy_cursor
};
console.log(print_f("Found unknown symbol on position: %s", this._yy_cursor));
},
_foundLexeme: function(_lexeme) {
console.log(print_f("found lex: %s; start: %s; end: %s; result => %s", _lexeme, this._yy_lex_start, this._yy_cursor, this._string.substring(this._yy_lex_start, this._yy_cursor)));
this._last_found_lexeme = {
error: 0,
lexeme: _lexeme,
value: this._string.substring(this._yy_lex_start, this._yy_cursor),
start: this._yy_lex_start,
end: this._yy_cursor
};
},
_endOfString: function() {
console.log(print_f("search end\n"));
this._end = true;
this._last_found_lexeme = {
error: -2
};
},
_searchString: function() {
var _quote = this._string[this._yy_cursor - 1];
var found_back_slash = false;
while (this._yy_cursor < this._string.length) {
this._yy_char = this._string[this._yy_cursor];
if (_quote == '"') {
switch (this._yy_char) {
case "\\":
found_back_slash = true;
break;
case '"':
if (!found_back_slash) {
this._yy_cursor++;
this._foundLexeme("STRING_LITERAL");
return;
}
found_back_slash = false;
break;
}
} else if (_quote == "'") {
switch (this._yy_char) {
case "\\":
found_back_slash = true;
break;
case "'":
if (!found_back_slash) {
this._yy_cursor++;
this._foundLexeme("STRING_LITERAL");
return;
}
found_back_slash = false;
break;
}
}
this._yy_cursor++;
}
this._notFoundCloseQuote();
},
_set_next: function() {
this._yy_accept = 0;
this._state = 1;
this._yy_lex_start = this._yy_cursor;
this._yy_marker = this._yy_cursor;
},
next: function() {
if (this._end || this._error) return null;
this.search();
return this.token();
},
token: function() {
return this._last_found_lexeme;
},
search: function() {
if (this._end) return false;
while (true) {
switch (this._state) {
case 1:
this._yy_char = this._string[this._yy_cursor];
(function() {
switch (this._yy_char) {
case undefined:
this._state = 2;
break;
case '\t':
case '\n':
case '\r':
case ' ':
this._state = 6;
break;
case '!':
this._state = 8;
break;
case '"':
case '\'':
this._state = 9;
break;
case '%':
this._state = 11;
break;
case '(':
this._state = 13;
break;
case ')':
this._state = 15;
break;
case ',':
this._state = 17;
break;
case '-':
this._state = 19;
break;
case '.':
this._state = 20;
break;
case '/':
this._state = 22;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 24;
break;
case ':':
this._state = 27;
break;
case '<':
this._state = 29;
break;
case '=':
this._state = 31;
break;
case '>':
this._state = 32;
break;
case 'A':
this._state = 34;
break;
case 'B':
case 'C':
case 'D':
case 'E':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'M':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'b':
case 'c':
case 'd':
case 'e':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'm':
case 'p':
case 'q':
case 'r':
case 's':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
case 'F':
case 'f':
this._state = 38;
break;
case 'L':
case 'l':
this._state = 39;
break;
case 'N':
case 'n':
this._state = 40;
break;
case 'O':
this._state = 41;
break;
case 'T':
this._state = 42;
break;
case '[':
this._state = 43;
break;
case ']':
this._state = 45;
break;
case 'a':
this._state = 47;
break;
case 'o':
this._state = 48;
break;
case 't':
this._state = 49;
break;
default:
this._state = 4;
break;
}
}.bind(this))();
break;
case 2:
++this._yy_cursor; {
this._endOfString();
return;
}
case 4:
++this._yy_cursor;
case 5:
{
this._unknownSymbol();this._set_next();
return;
}
case 6:
++this._yy_cursor; {
this._set_next();
break;
}
case 8:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '=':
this._state = 50;
break;
default:
this._state = 5;
break;
}
}.bind(this))();
break;
case 9:
++this._yy_cursor; {
this._state = 100000000;
break;
}
case 11:
++this._yy_cursor; {
this._foundLexeme("REM");
this._set_next();
return;
}
case 13:
++this._yy_cursor; {
this._foundLexeme("LCB");
this._set_next();
return;
}
case 15:
++this._yy_cursor; {
this._foundLexeme("RCB");
this._set_next();
return;
}
case 17:
++this._yy_cursor; {
this._foundLexeme("COMMA");
this._set_next();
return;
}
case 19:
this._yy_accept = 0;
this._yy_char = this._string[(this._yy_marker = ++this._yy_cursor)];
(function() {
switch (this._yy_char) {
case '.':
this._state = 52;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 24;
break;
default:
this._state = 5;
break;
}
}.bind(this))();
break;
case 20:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 54;
break;
default:
this._state = 21;
break;
}
}.bind(this))();
break;
case 21:
{
this._foundLexeme("DOT");this._set_next();
return;
}
case 22:
++this._yy_cursor; {
this._foundLexeme("SLASH");
this._set_next();
return;
}
case 24:
this._yy_accept = 1;
this._yy_char = this._string[(this._yy_marker = ++this._yy_cursor)];
(function() {
switch (this._yy_char) {
case '.':
this._state = 52;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 24;
break;
default:
this._state = 26;
break;
}
}.bind(this))();
break;
case 26:
{
this._foundLexeme("INTEGER_LITERAL");this._set_next();
return;
}
case 27:
++this._yy_cursor; {
this._foundLexeme("COLON");
this._set_next();
return;
}
case 29:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '=':
this._state = 57;
break;
default:
this._state = 30;
break;
}
}.bind(this))();
break;
case 30:
{
this._foundLexeme("LT");this._set_next();
return;
}
case 31:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '=':
this._state = 59;
break;
default:
this._state = 5;
break;
}
}.bind(this))();
break;
case 32:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '=':
this._state = 61;
break;
default:
this._state = 33;
break;
}
}.bind(this))();
break;
case 33:
{
this._foundLexeme("GT");this._set_next();
return;
}
case 34:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'N':
case 'n':
this._state = 63;
break;
case 'd':
this._state = 64;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 35:
{
this._foundLexeme("ID");this._set_next();
return;
}
case 36:
this._yy_char = this._string[++this._yy_cursor];
case 37:
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 38:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'A':
case 'a':
this._state = 65;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 39:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'I':
case 'i':
this._state = 66;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 40:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'L':
case 'l':
this._state = 67;
break;
case 'O':
case 'o':
this._state = 68;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 41:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'R':
case 'r':
this._state = 69;
break;
case 'i':
this._state = 71;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 42:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'R':
case 'r':
this._state = 72;
break;
case 'i':
this._state = 73;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 43:
++this._yy_cursor; {
this._foundLexeme("LSB");
this._set_next();
return;
}
case 45:
++this._yy_cursor; {
this._foundLexeme("RSB");
this._set_next();
return;
}
case 47:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'N':
case 'n':
this._state = 63;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 48:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'R':
case 'r':
this._state = 69;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 49:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'R':
case 'r':
this._state = 72;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 50:
++this._yy_cursor; {
this._foundLexeme("NEQ");
this._set_next();
return;
}
case 52:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 54;
break;
default:
this._state = 53;
break;
}
}.bind(this))();
break;
case 53:
this._yy_cursor = this._yy_marker;
switch (this._yy_accept) {
case 0:
this._state = 5;
break;
case 1:
this._state = 26;
break;
default:
this._state = 56;
break;
}
case 54:
this._yy_accept = 2;
this._yy_char = this._string[(this._yy_marker = ++this._yy_cursor)];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 54;
break;
case 'e':
this._state = 74;
break;
default:
this._state = 56;
break;
}
}.bind(this))();
break;
case 56:
{
this._foundLexeme("FLOAT_LITERAL");this._set_next();
return;
}
case 57:
++this._yy_cursor; {
this._foundLexeme("LTE");
this._set_next();
return;
}
case 59:
++this._yy_cursor; {
this._foundLexeme("EQ");
this._set_next();
return;
}
case 61:
++this._yy_cursor; {
this._foundLexeme("GTE");
this._set_next();
return;
}
case 63:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'D':
case 'd':
this._state = 75;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 64:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'd':
this._state = 77;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 65:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'L':
case 'l':
this._state = 78;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 66:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'K':
case 'k':
this._state = 79;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 67:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'I':
case 'i':
this._state = 80;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 68:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'T':
case 't':
this._state = 81;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 69:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
default:
this._state = 70;
break;
}
}.bind(this))();
break;
case 70:
{
this._foundLexeme("OR");this._set_next();
return;
}
case 71:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'd':
this._state = 83;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 72:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'U':
case 'u':
this._state = 85;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 73:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'm':
this._state = 86;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 74:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '-':
this._state = 87;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 88;
break;
default:
this._state = 53;
break;
}
}.bind(this))();
break;
case 75:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
default:
this._state = 76;
break;
}
}.bind(this))();
break;
case 76:
{
this._foundLexeme("AND");this._set_next();
return;
}
case 77:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'r':
this._state = 90;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 78:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'S':
case 's':
this._state = 85;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 79:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'E':
case 'e':
this._state = 91;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 80:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'K':
case 'k':
this._state = 93;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 81:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
default:
this._state = 82;
break;
}
}.bind(this))();
break;
case 82:
{
this._foundLexeme("NOT");this._set_next();
return;
}
case 83:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
default:
this._state = 84;
break;
}
}.bind(this))();
break;
case 84:
{
this._foundLexeme("OID");this._set_next();
return;
}
case 85:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'E':
case 'e':
this._state = 94;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 86:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'e':
this._state = 96;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 87:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 88;
break;
default:
this._state = 53;
break;
}
}.bind(this))();
break;
case 88:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 88;
break;
default:
this._state = 56;
break;
}
}.bind(this))();
break;
case 90:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'e':
this._state = 98;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 91:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
default:
this._state = 92;
break;
}
}.bind(this))();
break;
case 92:
{
this._foundLexeme("LIKE");this._set_next();
return;
}
case 93:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'E':
case 'e':
this._state = 99;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 94:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
default:
this._state = 95;
break;
}
}.bind(this))();
break;
case 95:
{
this._foundLexeme("BOOL_LITERAL");this._set_next();
return;
}
case 96:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
case 'D':
this._state = 101;
break;
default:
this._state = 97;
break;
}
}.bind(this))();
break;
case 97:
{
this._foundLexeme("TIME");this._set_next();
return;
}
case 98:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 's':
this._state = 102;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 99:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
default:
this._state = 100;
break;
}
}.bind(this))();
break;
case 100:
{
this._foundLexeme("NLIKE");this._set_next();
return;
}
case 101:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'i':
this._state = 103;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 102:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 's':
this._state = 104;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 103:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'f':
this._state = 106;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 104:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
default:
this._state = 105;
break;
}
}.bind(this))();
break;
case 105:
{
this._foundLexeme("ADDRESS");this._set_next();
return;
}
case 106:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'f':
this._state = 107;
break;
default:
this._state = 37;
break;
}
}.bind(this))();
break;
case 107:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '_':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
this._state = 36;
break;
default:
this._state = 108;
break;
}
}.bind(this))();
break;
case 108:
{
this._foundLexeme("TIMEDIFF");this._set_next();
return;
}
case 100000000:
{
this._searchString();this._set_next();
return;
}
}
}
}
};
var print_f = function() {
var r_str = "";
var next = arguments[0];
var rx = /(%[a-zA-Z]{1})/;
var a = 1,
match;
while (match = rx.exec(next)) {
var prev = next.substring(0, match.index);
var macro = next.substring(match.index + 1, match.index + 2);
next = next.substring(match.index + 2, next.length);
r_str += prev;
var arg = arguments[a];
if (arg !== undefined) {
switch (macro) {
case "s":
r_str += arg.toString();
break;
case "i":
r_str += parseInt(arg);
break;
case "f":
r_str += parseFloat(arg);
break;
}
} else {
r_str += "%" + macro;
}
a++;
}
r_str += next;
return r_str;
};
module.exports = Lexer