LemonJS/parsers/filters/lexer.js

1922 lines
70 KiB
JavaScript

/* Generated by re2c 1.0.3 on Fri Jan 25 16:37:52 2019 */
var types = [
"LSB",
"RSB",
"LCB",
"RCB",
"COLON",
"COMMA",
"DOT",
"REM",
"GT",
"GTE",
"LT",
"LTE",
"EQ",
"NEQ",
"LIKE",
"NLIKE",
"AND",
"OR",
"NOT",
"ADDRESS",
"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("LEXER: 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("LEXER: Found unknown symbol on position: %s", this._yy_cursor));
},
_foundLexeme: function(_lexeme) {
console.log(print_f("LEXER: 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,
start: this._yy_lex_start,
end: this._yy_cursor
};
},
_endOfString: function() {
console.log(print_f("LEXER: 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 '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 22;
break;
case ':':
this._state = 25;
break;
case '<':
this._state = 27;
break;
case '=':
this._state = 29;
break;
case '>':
this._state = 30;
break;
case 'A':
this._state = 32;
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 = 34;
break;
case 'F':
case 'f':
this._state = 36;
break;
case 'L':
case 'l':
this._state = 37;
break;
case 'N':
case 'n':
this._state = 38;
break;
case 'O':
case 'o':
this._state = 39;
break;
case 'T':
this._state = 40;
break;
case '[':
this._state = 41;
break;
case ']':
this._state = 43;
break;
case 'a':
this._state = 45;
break;
case 't':
this._state = 46;
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 = 47;
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 = 49;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 22;
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 = 51;
break;
default:
this._state = 21;
break;
}
}.bind(this))();
break;
case 21:
{
this._foundLexeme("DOT");this._set_next();
return;
}
case 22:
this._yy_accept = 1;
this._yy_char = this._string[(this._yy_marker = ++this._yy_cursor)];
(function() {
switch (this._yy_char) {
case '.':
this._state = 49;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 22;
break;
default:
this._state = 24;
break;
}
}.bind(this))();
break;
case 24:
{
this._foundLexeme("INTEGER_LITERAL");this._set_next();
return;
}
case 25:
++this._yy_cursor; {
this._foundLexeme("COLON");
this._set_next();
return;
}
case 27:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '=':
this._state = 54;
break;
default:
this._state = 28;
break;
}
}.bind(this))();
break;
case 28:
{
this._foundLexeme("LT");this._set_next();
return;
}
case 29:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '=':
this._state = 56;
break;
default:
this._state = 5;
break;
}
}.bind(this))();
break;
case 30:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '=':
this._state = 58;
break;
default:
this._state = 31;
break;
}
}.bind(this))();
break;
case 31:
{
this._foundLexeme("GT");this._set_next();
return;
}
case 32:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'N':
case 'n':
this._state = 60;
break;
case 'd':
this._state = 61;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 33:
{
this._foundLexeme("ID");this._set_next();
return;
}
case 34:
this._yy_char = this._string[++this._yy_cursor];
case 35:
(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 = 34;
break;
default:
this._state = 33;
break;
}
}.bind(this))();
break;
case 36:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'A':
case 'a':
this._state = 62;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 37:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'I':
case 'i':
this._state = 63;
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 'L':
case 'l':
this._state = 64;
break;
case 'O':
case 'o':
this._state = 65;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 39:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'R':
case 'r':
this._state = 66;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 40:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'R':
case 'r':
this._state = 68;
break;
case 'i':
this._state = 69;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 41:
++this._yy_cursor; {
this._foundLexeme("LSB");
this._set_next();
return;
}
case 43:
++this._yy_cursor; {
this._foundLexeme("RSB");
this._set_next();
return;
}
case 45:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'N':
case 'n':
this._state = 60;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 46:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'R':
case 'r':
this._state = 68;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 47:
++this._yy_cursor; {
this._foundLexeme("NEQ");
this._set_next();
return;
}
case 49:
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 = 51;
break;
default:
this._state = 50;
break;
}
}.bind(this))();
break;
case 50:
this._yy_cursor = this._yy_marker;
switch (this._yy_accept) {
case 0:
this._state = 5;
break;
case 1:
this._state = 24;
break;
default:
this._state = 53;
break;
}
case 51:
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 = 51;
break;
case 'e':
this._state = 70;
break;
default:
this._state = 53;
break;
}
}.bind(this))();
break;
case 53:
{
this._foundLexeme("FLOAT_LITERAL");this._set_next();
return;
}
case 54:
++this._yy_cursor; {
this._foundLexeme("LTE");
this._set_next();
return;
}
case 56:
++this._yy_cursor; {
this._foundLexeme("EQ");
this._set_next();
return;
}
case 58:
++this._yy_cursor; {
this._foundLexeme("GTE");
this._set_next();
return;
}
case 60:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'D':
case 'd':
this._state = 71;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 61:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'd':
this._state = 73;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 62:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'L':
case 'l':
this._state = 74;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 63:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'K':
case 'k':
this._state = 75;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 64:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'I':
case 'i':
this._state = 76;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 65:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'T':
case 't':
this._state = 77;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 66:
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 = 34;
break;
default:
this._state = 67;
break;
}
}.bind(this))();
break;
case 67:
{
this._foundLexeme("OR");this._set_next();
return;
}
case 68:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'U':
case 'u':
this._state = 79;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 69:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'm':
this._state = 80;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 70:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case '-':
this._state = 81;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
this._state = 82;
break;
default:
this._state = 50;
break;
}
}.bind(this))();
break;
case 71:
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 = 34;
break;
default:
this._state = 72;
break;
}
}.bind(this))();
break;
case 72:
{
this._foundLexeme("AND");this._set_next();
return;
}
case 73:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'r':
this._state = 84;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 74:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'S':
case 's':
this._state = 79;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 75:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'E':
case 'e':
this._state = 85;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 76:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'K':
case 'k':
this._state = 87;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 77:
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 = 34;
break;
default:
this._state = 78;
break;
}
}.bind(this))();
break;
case 78:
{
this._foundLexeme("NOT");this._set_next();
return;
}
case 79:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'E':
case 'e':
this._state = 88;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 80:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'e':
this._state = 90;
break;
default:
this._state = 35;
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':
this._state = 82;
break;
default:
this._state = 50;
break;
}
}.bind(this))();
break;
case 82:
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 = 82;
break;
default:
this._state = 53;
break;
}
}.bind(this))();
break;
case 84:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'e':
this._state = 92;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 85:
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 = 34;
break;
default:
this._state = 86;
break;
}
}.bind(this))();
break;
case 86:
{
this._foundLexeme("LIKE");this._set_next();
return;
}
case 87:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'E':
case 'e':
this._state = 93;
break;
default:
this._state = 35;
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':
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 = 34;
break;
default:
this._state = 89;
break;
}
}.bind(this))();
break;
case 89:
{
this._foundLexeme("BOOL_LITERAL");this._set_next();
return;
}
case 90:
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 = 34;
break;
case 'D':
this._state = 95;
break;
default:
this._state = 91;
break;
}
}.bind(this))();
break;
case 91:
{
this._foundLexeme("TIME");this._set_next();
return;
}
case 92:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 's':
this._state = 96;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 93:
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 = 34;
break;
default:
this._state = 94;
break;
}
}.bind(this))();
break;
case 94:
{
this._foundLexeme("NLIKE");this._set_next();
return;
}
case 95:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'i':
this._state = 97;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 96:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 's':
this._state = 98;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 97:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'f':
this._state = 100;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 98:
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 = 34;
break;
default:
this._state = 99;
break;
}
}.bind(this))();
break;
case 99:
{
this._foundLexeme("ADDRESS");this._set_next();
return;
}
case 100:
this._yy_char = this._string[++this._yy_cursor];
(function() {
switch (this._yy_char) {
case 'f':
this._state = 101;
break;
default:
this._state = 35;
break;
}
}.bind(this))();
break;
case 101:
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 = 34;
break;
default:
this._state = 102;
break;
}
}.bind(this))();
break;
case 102:
{
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