X-Git-Url: http://nitlanguage.org diff --git a/src/parser/lexer.nit b/src/parser/lexer.nit index 257b305..1805e58 100644 --- a/src/parser/lexer.nit +++ b/src/parser/lexer.nit @@ -1,18 +1,10 @@ # Lexer and its tokens. # This file was generated by SableCC (http://www.sablecc.org/). -package lexer +module lexer is no_warning("missing-doc") intrude import parser_nodes - -redef class Token - readable writable var _text: String - - fun parser_index: Int is abstract - - redef fun to_s: String do - return "'{_text}'" - end -end +intrude import lexer_work +private import tables redef class TEol redef fun parser_index: Int @@ -20,9 +12,8 @@ redef class TEol return 0 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end @@ -33,9 +24,8 @@ redef class TComment return 1 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end @@ -48,12 +38,11 @@ redef class TKwpackage init init_tk(loc: Location) do - _text = once "package" _location = loc end end -redef class TKwimport +redef class TKwmodule redef fun parser_index: Int do return 3 @@ -61,12 +50,11 @@ redef class TKwimport init init_tk(loc: Location) do - _text = once "import" _location = loc end end -redef class TKwclass +redef class TKwimport redef fun parser_index: Int do return 4 @@ -74,12 +62,11 @@ redef class TKwclass init init_tk(loc: Location) do - _text = once "class" _location = loc end end -redef class TKwabstract +redef class TKwclass redef fun parser_index: Int do return 5 @@ -87,12 +74,11 @@ redef class TKwabstract init init_tk(loc: Location) do - _text = once "abstract" _location = loc end end -redef class TKwinterface +redef class TKwabstract redef fun parser_index: Int do return 6 @@ -100,12 +86,11 @@ redef class TKwinterface init init_tk(loc: Location) do - _text = once "interface" _location = loc end end -redef class TKwuniversal +redef class TKwinterface redef fun parser_index: Int do return 7 @@ -113,12 +98,11 @@ redef class TKwuniversal init init_tk(loc: Location) do - _text = once "universal" _location = loc end end -redef class TKwspecial +redef class TKwenum redef fun parser_index: Int do return 8 @@ -126,7 +110,6 @@ redef class TKwspecial init init_tk(loc: Location) do - _text = once "special" _location = loc end end @@ -139,7 +122,6 @@ redef class TKwend init init_tk(loc: Location) do - _text = once "end" _location = loc end end @@ -150,9 +132,8 @@ redef class TKwmeth return 10 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end @@ -165,12 +146,11 @@ redef class TKwtype init init_tk(loc: Location) do - _text = once "type" _location = loc end end -redef class TKwattr +redef class TKwinit redef fun parser_index: Int do return 12 @@ -178,12 +158,11 @@ redef class TKwattr init init_tk(loc: Location) do - _text = once "attr" _location = loc end end -redef class TKwinit +redef class TKwredef redef fun parser_index: Int do return 13 @@ -191,12 +170,11 @@ redef class TKwinit init init_tk(loc: Location) do - _text = once "init" _location = loc end end -redef class TKwredef +redef class TKwis redef fun parser_index: Int do return 14 @@ -204,12 +182,11 @@ redef class TKwredef init init_tk(loc: Location) do - _text = once "redef" _location = loc end end -redef class TKwis +redef class TKwdo redef fun parser_index: Int do return 15 @@ -217,12 +194,11 @@ redef class TKwis init init_tk(loc: Location) do - _text = once "is" _location = loc end end -redef class TKwdo +redef class TKwvar redef fun parser_index: Int do return 16 @@ -230,12 +206,11 @@ redef class TKwdo init init_tk(loc: Location) do - _text = once "do" _location = loc end end -redef class TKwreadable +redef class TKwextern redef fun parser_index: Int do return 17 @@ -243,12 +218,11 @@ redef class TKwreadable init init_tk(loc: Location) do - _text = once "readable" _location = loc end end -redef class TKwwritable +redef class TKwpublic redef fun parser_index: Int do return 18 @@ -256,12 +230,11 @@ redef class TKwwritable init init_tk(loc: Location) do - _text = once "writable" _location = loc end end -redef class TKwvar +redef class TKwprotected redef fun parser_index: Int do return 19 @@ -269,12 +242,11 @@ redef class TKwvar init init_tk(loc: Location) do - _text = once "var" _location = loc end end -redef class TKwintern +redef class TKwprivate redef fun parser_index: Int do return 20 @@ -282,12 +254,11 @@ redef class TKwintern init init_tk(loc: Location) do - _text = once "intern" _location = loc end end -redef class TKwextern +redef class TKwintrude redef fun parser_index: Int do return 21 @@ -295,12 +266,11 @@ redef class TKwextern init init_tk(loc: Location) do - _text = once "extern" _location = loc end end -redef class TKwprotected +redef class TKwif redef fun parser_index: Int do return 22 @@ -308,12 +278,11 @@ redef class TKwprotected init init_tk(loc: Location) do - _text = once "protected" _location = loc end end -redef class TKwprivate +redef class TKwthen redef fun parser_index: Int do return 23 @@ -321,12 +290,11 @@ redef class TKwprivate init init_tk(loc: Location) do - _text = once "private" _location = loc end end -redef class TKwintrude +redef class TKwelse redef fun parser_index: Int do return 24 @@ -334,12 +302,11 @@ redef class TKwintrude init init_tk(loc: Location) do - _text = once "intrude" _location = loc end end -redef class TKwif +redef class TKwwhile redef fun parser_index: Int do return 25 @@ -347,12 +314,11 @@ redef class TKwif init init_tk(loc: Location) do - _text = once "if" _location = loc end end -redef class TKwthen +redef class TKwloop redef fun parser_index: Int do return 26 @@ -360,12 +326,11 @@ redef class TKwthen init init_tk(loc: Location) do - _text = once "then" _location = loc end end -redef class TKwelse +redef class TKwfor redef fun parser_index: Int do return 27 @@ -373,12 +338,11 @@ redef class TKwelse init init_tk(loc: Location) do - _text = once "else" _location = loc end end -redef class TKwwhile +redef class TKwin redef fun parser_index: Int do return 28 @@ -386,12 +350,11 @@ redef class TKwwhile init init_tk(loc: Location) do - _text = once "while" _location = loc end end -redef class TKwfor +redef class TKwand redef fun parser_index: Int do return 29 @@ -399,12 +362,11 @@ redef class TKwfor init init_tk(loc: Location) do - _text = once "for" _location = loc end end -redef class TKwin +redef class TKwor redef fun parser_index: Int do return 30 @@ -412,12 +374,11 @@ redef class TKwin init init_tk(loc: Location) do - _text = once "in" _location = loc end end -redef class TKwand +redef class TKwnot redef fun parser_index: Int do return 31 @@ -425,12 +386,11 @@ redef class TKwand init init_tk(loc: Location) do - _text = once "and" _location = loc end end -redef class TKwor +redef class TKwimplies redef fun parser_index: Int do return 32 @@ -438,12 +398,11 @@ redef class TKwor init init_tk(loc: Location) do - _text = once "or" _location = loc end end -redef class TKwnot +redef class TKwreturn redef fun parser_index: Int do return 33 @@ -451,12 +410,11 @@ redef class TKwnot init init_tk(loc: Location) do - _text = once "not" _location = loc end end -redef class TKwreturn +redef class TKwcontinue redef fun parser_index: Int do return 34 @@ -464,12 +422,11 @@ redef class TKwreturn init init_tk(loc: Location) do - _text = once "return" _location = loc end end -redef class TKwcontinue +redef class TKwbreak redef fun parser_index: Int do return 35 @@ -477,12 +434,11 @@ redef class TKwcontinue init init_tk(loc: Location) do - _text = once "continue" _location = loc end end -redef class TKwbreak +redef class TKwabort redef fun parser_index: Int do return 36 @@ -490,12 +446,11 @@ redef class TKwbreak init init_tk(loc: Location) do - _text = once "break" _location = loc end end -redef class TKwabort +redef class TKwassert redef fun parser_index: Int do return 37 @@ -503,12 +458,11 @@ redef class TKwabort init init_tk(loc: Location) do - _text = once "abort" _location = loc end end -redef class TKwassert +redef class TKwnew redef fun parser_index: Int do return 38 @@ -516,12 +470,11 @@ redef class TKwassert init init_tk(loc: Location) do - _text = once "assert" _location = loc end end -redef class TKwnew +redef class TKwisa redef fun parser_index: Int do return 39 @@ -529,12 +482,11 @@ redef class TKwnew init init_tk(loc: Location) do - _text = once "new" _location = loc end end -redef class TKwisa +redef class TKwonce redef fun parser_index: Int do return 40 @@ -542,12 +494,11 @@ redef class TKwisa init init_tk(loc: Location) do - _text = once "isa" _location = loc end end -redef class TKwonce +redef class TKwsuper redef fun parser_index: Int do return 41 @@ -555,12 +506,11 @@ redef class TKwonce init init_tk(loc: Location) do - _text = once "once" _location = loc end end -redef class TKwsuper +redef class TKwself redef fun parser_index: Int do return 42 @@ -568,12 +518,11 @@ redef class TKwsuper init init_tk(loc: Location) do - _text = once "super" _location = loc end end -redef class TKwself +redef class TKwtrue redef fun parser_index: Int do return 43 @@ -581,12 +530,11 @@ redef class TKwself init init_tk(loc: Location) do - _text = once "self" _location = loc end end -redef class TKwtrue +redef class TKwfalse redef fun parser_index: Int do return 44 @@ -594,12 +542,11 @@ redef class TKwtrue init init_tk(loc: Location) do - _text = once "true" _location = loc end end -redef class TKwfalse +redef class TKwnull redef fun parser_index: Int do return 45 @@ -607,12 +554,11 @@ redef class TKwfalse init init_tk(loc: Location) do - _text = once "false" _location = loc end end -redef class TKwnull +redef class TKwas redef fun parser_index: Int do return 46 @@ -620,12 +566,11 @@ redef class TKwnull init init_tk(loc: Location) do - _text = once "null" _location = loc end end -redef class TKwas +redef class TKwnullable redef fun parser_index: Int do return 47 @@ -633,12 +578,11 @@ redef class TKwas init init_tk(loc: Location) do - _text = once "as" _location = loc end end -redef class TKwwith +redef class TKwisset redef fun parser_index: Int do return 48 @@ -646,12 +590,11 @@ redef class TKwwith init init_tk(loc: Location) do - _text = once "with" _location = loc end end -redef class TKwnullable +redef class TKwlabel redef fun parser_index: Int do return 49 @@ -659,12 +602,11 @@ redef class TKwnullable init init_tk(loc: Location) do - _text = once "nullable" _location = loc end end -redef class TKwisset +redef class TKwwith redef fun parser_index: Int do return 50 @@ -672,12 +614,11 @@ redef class TKwisset init init_tk(loc: Location) do - _text = once "isset" _location = loc end end -redef class TKwlabel +redef class TKwdebug redef fun parser_index: Int do return 51 @@ -685,7 +626,6 @@ redef class TKwlabel init init_tk(loc: Location) do - _text = once "label" _location = loc end end @@ -698,7 +638,6 @@ redef class TOpar init init_tk(loc: Location) do - _text = once "(" _location = loc end end @@ -711,7 +650,6 @@ redef class TCpar init init_tk(loc: Location) do - _text = once ")" _location = loc end end @@ -724,7 +662,6 @@ redef class TObra init init_tk(loc: Location) do - _text = once "[" _location = loc end end @@ -737,7 +674,6 @@ redef class TCbra init init_tk(loc: Location) do - _text = once "]" _location = loc end end @@ -750,7 +686,6 @@ redef class TComma init init_tk(loc: Location) do - _text = once "," _location = loc end end @@ -763,7 +698,6 @@ redef class TColumn init init_tk(loc: Location) do - _text = once ":" _location = loc end end @@ -776,7 +710,6 @@ redef class TQuad init init_tk(loc: Location) do - _text = once "::" _location = loc end end @@ -789,7 +722,6 @@ redef class TAssign init init_tk(loc: Location) do - _text = once "=" _location = loc end end @@ -802,7 +734,6 @@ redef class TPluseq init init_tk(loc: Location) do - _text = once "+=" _location = loc end end @@ -815,7 +746,6 @@ redef class TMinuseq init init_tk(loc: Location) do - _text = once "-=" _location = loc end end @@ -828,7 +758,6 @@ redef class TDotdotdot init init_tk(loc: Location) do - _text = once "..." _location = loc end end @@ -841,7 +770,6 @@ redef class TDotdot init init_tk(loc: Location) do - _text = once ".." _location = loc end end @@ -854,7 +782,6 @@ redef class TDot init init_tk(loc: Location) do - _text = once "." _location = loc end end @@ -867,7 +794,6 @@ redef class TPlus init init_tk(loc: Location) do - _text = once "+" _location = loc end end @@ -880,7 +806,6 @@ redef class TMinus init init_tk(loc: Location) do - _text = once "-" _location = loc end end @@ -893,12 +818,11 @@ redef class TStar init init_tk(loc: Location) do - _text = once "*" _location = loc end end -redef class TSlash +redef class TStarstar redef fun parser_index: Int do return 68 @@ -906,12 +830,11 @@ redef class TSlash init init_tk(loc: Location) do - _text = once "/" _location = loc end end -redef class TPercent +redef class TSlash redef fun parser_index: Int do return 69 @@ -919,12 +842,11 @@ redef class TPercent init init_tk(loc: Location) do - _text = once "%" _location = loc end end -redef class TEq +redef class TPercent redef fun parser_index: Int do return 70 @@ -932,12 +854,11 @@ redef class TEq init init_tk(loc: Location) do - _text = once "==" _location = loc end end -redef class TNe +redef class TEq redef fun parser_index: Int do return 71 @@ -945,12 +866,11 @@ redef class TNe init init_tk(loc: Location) do - _text = once "!=" _location = loc end end -redef class TLt +redef class TNe redef fun parser_index: Int do return 72 @@ -958,12 +878,11 @@ redef class TLt init init_tk(loc: Location) do - _text = once "<" _location = loc end end -redef class TLe +redef class TLt redef fun parser_index: Int do return 73 @@ -971,12 +890,11 @@ redef class TLe init init_tk(loc: Location) do - _text = once "<=" _location = loc end end -redef class TGt +redef class TLe redef fun parser_index: Int do return 74 @@ -984,12 +902,11 @@ redef class TGt init init_tk(loc: Location) do - _text = once ">" _location = loc end end -redef class TGe +redef class TLl redef fun parser_index: Int do return 75 @@ -997,12 +914,11 @@ redef class TGe init init_tk(loc: Location) do - _text = once ">=" _location = loc end end -redef class TStarship +redef class TGt redef fun parser_index: Int do return 76 @@ -1010,2349 +926,538 @@ redef class TStarship init init_tk(loc: Location) do - _text = once "<=>" _location = loc end end -redef class TClassid +redef class TGe redef fun parser_index: Int do return 77 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end -redef class TId +redef class TGg redef fun parser_index: Int do return 78 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end -redef class TAttrid +redef class TStarship redef fun parser_index: Int do return 79 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end -redef class TNumber +redef class TBang redef fun parser_index: Int do return 80 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end -redef class TFloat +redef class TAt redef fun parser_index: Int do return 81 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end -redef class TChar +redef class TClassid redef fun parser_index: Int do return 82 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end -redef class TString +redef class TId redef fun parser_index: Int do return 83 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end -redef class TStartString +redef class TAttrid redef fun parser_index: Int do return 84 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end -redef class TMidString +redef class TNumber redef fun parser_index: Int do return 85 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end -redef class TEndString +redef class THexNumber redef fun parser_index: Int do return 86 end - init init_tk(text: String, loc: Location) + init init_tk(loc: Location) do - _text = text _location = loc end end - -redef class EOF +redef class TFloat redef fun parser_index: Int do return 87 end - init(loc: Location) + init init_tk(loc: Location) do - _text = "" _location = loc end end -redef class AError - readable writable var _message: String +redef class TString + redef fun parser_index: Int + do + return 88 + end - init init_error(message: String, loc: Location) + init init_tk(loc: Location) do - init(loc) - _message = message + _location = loc end end +redef class TStartString + redef fun parser_index: Int + do + return 89 + end -# The lexer extract NIT tokens from an input stream. -# It is better user with the Parser -class Lexer - # Last peeked token - var _token: nullable Token - - # Lexer current state - var _state: Int = 0 + init init_tk(loc: Location) + do + _location = loc + end +end - # Name of the stream (as given to tokens) - readable var _filename: String +redef class TMidString + redef fun parser_index: Int + do + return 90 + end - # Input stream where character are read - var _stream: IStream + init init_tk(loc: Location) + do + _location = loc + end +end - # Pushback buffer to store unread character - var _stream_buf: Buffer +redef class TEndString + redef fun parser_index: Int + do + return 91 + end - # Number of character stored in the pushback buffer - var _stream_pos: Int + init init_tk(loc: Location) + do + _location = loc + end +end - # Current line number in the input stream - var _line: Int = 0 +redef class TChar + redef fun parser_index: Int + do + return 92 + end - # Current column in the input stream - var _pos: Int = 0 + init init_tk(loc: Location) + do + _location = loc + end +end - # Was the last character a cariage-return? - var _cr: Bool = false +redef class TBadString + redef fun parser_index: Int + do + return 93 + end - # If the end of stream? - var _eof: Bool = false + init init_tk(loc: Location) + do + _location = loc + end +end - # Current working text read from the input stream - var _text: Buffer +redef class TBadChar + redef fun parser_index: Int + do + return 94 + end - # Constante state values - private fun state_initial: Int do return 0 end + init init_tk(loc: Location) + do + _location = loc + end +end - # Create a new lexer for a stream (and a name) - init(stream: IStream, fname: String) - do - _filename = fname - _text = new Buffer - _stream = stream - _stream_pos = -1 - _stream_buf = new Buffer - build_goto_table - build_accept_table - end +redef class TExternCodeSegment + redef fun parser_index: Int + do + return 95 + end - # Give the next token (but do not consume it) - fun peek: Token - do - while _token == null do - _token = get_token - end - return _token.as(not null) - end + init init_tk(loc: Location) + do + _location = loc + end +end - # Give and consume the next token - fun next: Token - do - var result = _token - while result == null do - result = get_token - end - _token = null - return result.as(not null) - end - # Get a token, or null if it is discarded - private fun get_token: nullable Token - do - var dfa_state = 0 - - var start_pos = _pos - var start_line = _line - - var accept_state = -1 - var accept_token = -1 - var accept_length = -1 - var accept_pos = -1 - var accept_line = -1 - - var goto_table = _goto_table[_state] - var accept = _accept_table[_state] - var text = _text - text.clear - - while true do - var c = get_char - - if c != -1 then - var cr = _cr - var line = _line - var pos = _pos - if c == 10 then - if cr then - cr = false - else - line = line + 1 - pos = 0 - end - else if c == 13 then - line = line + 1 - pos = 0 - cr = true - else - pos = pos + 1 - cr = false - end - - text.add(c.ascii) - - var first_loop = true # aka until - while dfa_state < -1 or first_loop do - var old_state = dfa_state - if dfa_state < -1 then - old_state = -2 - dfa_state - end - - dfa_state = -1 - - var tmp0 = goto_table[old_state] - var low = 0 - var high = tmp0.length - 1 - - if high >= 0 then - var tmp1 = tmp0.intern_items - while low <= high do - var middle = (low + high) / 2 - var tmp2 = tmp1[middle].intern_items - - if c < tmp2[0] then - high = middle - 1 - else if c > tmp2[1] then - low = middle + 1 - else - dfa_state = tmp2[2] - low = high + 1 # aka break - end - end - end - first_loop = false # aka until - end - - _cr = cr - _line = line - _pos = pos - else - dfa_state = -1 - end - - if dfa_state >= 0 then - if accept[dfa_state] != -1 then - accept_state = dfa_state - accept_token = accept[dfa_state] - accept_length = text.length - accept_pos = _pos - accept_line = _line - end - else - if accept_state != -1 then - if accept_token == 0 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return null - end - if accept_token == 1 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TEol.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 2 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TComment.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 3 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwpackage.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 4 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwimport.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 5 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwclass.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 6 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwabstract.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 7 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwinterface.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 8 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwuniversal.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 9 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwspecial.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 10 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwend.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 11 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TKwmeth.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 12 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwtype.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 13 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwattr.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 14 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwinit.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 15 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwredef.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 16 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwis.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 17 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwdo.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 18 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwreadable.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 19 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwwritable.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 20 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwvar.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 21 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwintern.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 22 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwextern.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 23 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwprotected.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 24 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwprivate.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 25 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwintrude.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 26 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwif.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 27 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwthen.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 28 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwelse.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 29 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwwhile.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 30 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwfor.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 31 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwin.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 32 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwand.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 33 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwor.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 34 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwnot.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 35 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwreturn.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 36 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwcontinue.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 37 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwbreak.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 38 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwabort.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 39 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwassert.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 40 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwnew.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 41 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwisa.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 42 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwonce.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 43 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwsuper.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 44 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwself.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 45 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwtrue.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 46 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwfalse.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 47 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwnull.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 48 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwas.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 49 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwwith.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 50 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwnullable.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 51 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwisset.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 52 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TKwlabel.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 53 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TOpar.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 54 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TCpar.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 55 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TObra.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 56 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TCbra.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 57 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TComma.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 58 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TColumn.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 59 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TQuad.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 60 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TAssign.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 61 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TPluseq.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 62 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TMinuseq.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 63 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TDotdotdot.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 64 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TDotdot.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 65 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TDot.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 66 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TPlus.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 67 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TMinus.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 68 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TStar.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 69 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TSlash.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 70 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TPercent.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 71 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TEq.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 72 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TNe.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 73 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TLt.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 74 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TLe.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 75 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TGt.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 76 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TGe.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 77 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token = new TStarship.init_tk(location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 78 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TClassid.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 79 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TId.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 80 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TAttrid.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 81 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TNumber.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 82 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TFloat.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 83 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TChar.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 84 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TString.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 85 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TStartString.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 86 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TMidString.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - if accept_token == 87 then - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - var token_text = text.substring(0, accept_length) - var token = new TEndString.init_tk(token_text, location) - push_back(accept_length) - _pos = accept_pos - _line = accept_line - return token - end - else - var location = new Location(_filename, start_line + 1, accept_line + 1, start_pos + 1, accept_pos) - if text.length > 0 then - var token = new AError.init_error("Unknown token: {text}", location) - return token - else - var token = new EOF(location) - return token - end - end - end - end - return null - end +redef class EOF + redef fun parser_index: Int + do + return 96 + end +end - # Read the next character. - # The character is read from the stream of from the pushback buffer. - private fun get_char: Int +redef class Lexer + redef fun make_token(accept_token, location) do - if _eof then - return -1 + if accept_token == 1 then + return new TEol.init_tk(location) end - - var result: Int - - var sp = _stream_pos - if sp >= 0 then - var res = _stream_buf[_stream_pos] - _stream_pos = sp - 1 - result = res.ascii - else - result = _stream.read_char + if accept_token == 2 then + return new TComment.init_tk(location) end - - if result == -1 then - _eof = true + if accept_token == 3 then + return new TKwpackage.init_tk(location) end - - return result - end - - # Unread some characters. - # Unread characters are stored in the pushback buffer. - private fun push_back(accept_length: Int) - do - var length = _text.length - var i = length - 1 - while i >= accept_length do - _eof = false - _stream_pos = _stream_pos + 1 - _stream_buf[_stream_pos] = _text[i] - i = i - 1 + if accept_token == 4 then + return new TKwmodule.init_tk(location) end - end - - var _goto_table: Array[Array[Array[Array[Int]]]] - private fun build_goto_table - do - _goto_table = once [ - [ - [ - [9, 9, 1], - [10, 10, 2], - [13, 13, 3], - [32, 32, 4], - [33, 33, 5], - [34, 34, 6], - [35, 35, 7], - [37, 37, 8], - [39, 39, 9], - [40, 40, 10], - [41, 41, 11], - [42, 42, 12], - [43, 43, 13], - [44, 44, 14], - [45, 45, 15], - [46, 46, 16], - [47, 47, 17], - [48, 57, 18], - [58, 58, 19], - [60, 60, 20], - [61, 61, 21], - [62, 62, 22], - [65, 90, 23], - [91, 91, 24], - [93, 93, 25], - [95, 95, 26], - [97, 97, 27], - [98, 98, 28], - [99, 99, 29], - [100, 100, 30], - [101, 101, 31], - [102, 102, 32], - [103, 104, 33], - [105, 105, 34], - [106, 107, 33], - [108, 108, 35], - [109, 109, 36], - [110, 110, 37], - [111, 111, 38], - [112, 112, 39], - [113, 113, 33], - [114, 114, 40], - [115, 115, 41], - [116, 116, 42], - [117, 117, 43], - [118, 118, 44], - [119, 119, 45], - [120, 122, 33], - [125, 125, 46] - ], - [ - [9, 9, 1], - [32, 32, 4] - ], - nil_array, - [ - [10, 10, 47] - ], - [ - [9, 32, -3] - ], - [ - [61, 61, 48] - ], - [ - [0, 9, 49], - [11, 12, 49], - [14, 33, 49], - [34, 34, 50], - [35, 91, 49], - [92, 92, 51], - [93, 122, 49], - [123, 123, 52], - [124, 255, 49] - ], - [ - [0, 9, 53], - [10, 10, 54], - [11, 12, 53], - [13, 13, 55], - [14, 255, 53] - ], - nil_array, - [ - [0, 9, 56], - [11, 12, 56], - [14, 38, 56], - [39, 39, 57], - [40, 255, 56] - ], - nil_array, - nil_array, - nil_array, - [ - [61, 61, 58] - ], - nil_array, - [ - [61, 61, 59] - ], - [ - [46, 46, 60], - [48, 57, 61] - ], - nil_array, - [ - [46, 46, 62], - [48, 57, 18] - ], - [ - [58, 58, 63] - ], - [ - [61, 61, 64] - ], - [ - [61, 61, 65] - ], - [ - [61, 61, 66] - ], - [ - [48, 57, 67], - [65, 90, 68], - [95, 95, 69], - [97, 122, 70] - ], - nil_array, - nil_array, - [ - [97, 122, 71] - ], - [ - [48, 57, 72], - [65, 90, 73], - [95, 95, 74], - [97, 97, 75], - [98, 98, 76], - [99, 109, 75], - [110, 110, 77], - [111, 114, 75], - [115, 115, 78], - [116, 116, 79], - [117, 122, 75] - ], - [ - [48, 95, -29], - [97, 113, 75], - [114, 114, 80], - [115, 122, 75] - ], - [ - [48, 95, -29], - [97, 107, 75], - [108, 108, 81], - [109, 110, 75], - [111, 111, 82], - [112, 122, 75] - ], - [ - [48, 95, -29], - [97, 110, 75], - [111, 111, 83], - [112, 122, 75] - ], - [ - [48, 107, -31], - [108, 108, 84], - [109, 109, 75], - [110, 110, 85], - [111, 119, 75], - [120, 120, 86], - [121, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 87], - [98, 110, 75], - [111, 111, 88], - [112, 116, 75], - [117, 117, 89], - [118, 122, 75] - ], - [ - [48, 95, -29], - [97, 122, 75] - ], - [ - [48, 95, -29], - [97, 101, 75], - [102, 102, 90], - [103, 108, 75], - [109, 109, 91], - [110, 110, 92], - [111, 114, 75], - [115, 115, 93], - [116, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 94], - [98, 122, 75] - ], - [ - [48, 95, -29], - [97, 100, 75], - [101, 101, 95], - [102, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 96], - [102, 110, 75], - [111, 111, 97], - [112, 116, 75], - [117, 117, 98], - [118, 122, 75] - ], - [ - [48, 95, -29], - [97, 109, 75], - [110, 110, 99], - [111, 113, 75], - [114, 114, 100], - [115, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 101], - [98, 113, 75], - [114, 114, 102], - [115, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 103], - [102, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 104], - [102, 111, 75], - [112, 112, 105], - [113, 116, 75], - [117, 117, 106], - [118, 122, 75] - ], - [ - [48, 95, -29], - [97, 103, 75], - [104, 104, 107], - [105, 113, 75], - [114, 114, 108], - [115, 120, 75], - [121, 121, 109], - [122, 122, 75] - ], - [ - [48, 109, -40], - [110, 110, 110], - [111, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 111], - [98, 122, 75] - ], - [ - [48, 103, -44], - [104, 104, 112], - [105, 105, 113], - [106, 113, 75], - [114, 114, 114], - [115, 122, 75] - ], - [ - [0, 9, 115], - [11, 12, 115], - [14, 33, 115], - [34, 34, 116], - [35, 91, 115], - [92, 92, 117], - [93, 122, 115], - [123, 123, 118], - [124, 255, 115] - ], - nil_array, - nil_array, - [ - [0, 255, -8] - ], - nil_array, - [ - [0, 9, 119], - [11, 12, 119], - [14, 255, 119] - ], - nil_array, - [ - [0, 255, -9] - ], - nil_array, - [ - [10, 10, 120] - ], - [ - [0, 255, -11] - ], - nil_array, - nil_array, - nil_array, - [ - [46, 46, 121] - ], - [ - [48, 57, 61] - ], - [ - [48, 57, 61] - ], - nil_array, - [ - [62, 62, 122] - ], - nil_array, - nil_array, - [ - [48, 122, -25] - ], - [ - [48, 122, -25] - ], - [ - [48, 122, -25] - ], - [ - [48, 122, -25] - ], - [ - [48, 57, 123], - [65, 90, 124], - [95, 95, 125], - [97, 122, 126] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 110, -32], - [111, 111, 127], - [112, 114, 75], - [115, 115, 128], - [116, 122, 75] - ], - [ - [48, 95, -29], - [97, 99, 75], - [100, 100, 129], - [101, 122, 75] - ], - [ - [48, 95, -29], - [97, 114, 75], - [115, 115, 130], - [116, 122, 75] - ], - [ - [48, 95, -29], - [97, 115, 75], - [116, 116, 131], - [117, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 132], - [102, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 133], - [98, 122, 75] - ], - [ - [48, 109, -40], - [110, 110, 134], - [111, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 114, -80], - [115, 115, 135], - [116, 122, 75] - ], - [ - [48, 99, -79], - [100, 100, 136], - [101, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 137], - [117, 122, 75] - ], - [ - [48, 107, -31], - [108, 108, 138], - [109, 122, 75] - ], - [ - [48, 113, -30], - [114, 114, 139], - [115, 122, 75] - ], - [ - [48, 109, -40], - [110, 110, 140], - [111, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 95, -29], - [97, 111, 75], - [112, 112, 141], - [113, 122, 75] - ], - [ - [48, 95, -29], - [97, 104, 75], - [105, 105, 142], - [106, 115, 75], - [116, 116, 143], - [117, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 144], - [98, 114, 75], - [115, 115, 145], - [116, 122, 75] - ], - [ - [48, 97, -29], - [98, 98, 146], - [99, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 147], - [117, 122, 75] - ], - [ - [48, 95, -29], - [97, 118, 75], - [119, 119, 148], - [120, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 149], - [117, 122, 75] - ], - [ - [48, 107, -31], - [108, 108, 150], - [109, 122, 75] - ], - [ - [48, 95, -29], - [97, 98, 75], - [99, 99, 151], - [100, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 98, -101], - [99, 99, 152], - [100, 122, 75] - ], - [ - [48, 104, -94], - [105, 105, 153], - [106, 110, 75], - [111, 111, 154], - [112, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 155], - [98, 99, 75], - [100, 100, 156], - [101, 115, 75], - [116, 116, 157], - [117, 122, 75] - ], - [ - [48, 107, -31], - [108, 108, 158], - [109, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 159], - [102, 122, 75] - ], - [ - [48, 111, -93], - [112, 112, 160], - [113, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 161], - [102, 122, 75] - ], - [ - [48, 95, -29], - [97, 116, 75], - [117, 117, 162], - [118, 122, 75] - ], - [ - [48, 111, -93], - [112, 112, 163], - [113, 122, 75] - ], - [ - [48, 104, -94], - [105, 105, 164], - [106, 122, 75] - ], - [ - [48, 113, -30], - [114, 114, 165], - [115, 122, 75] - ], - [ - [48, 104, -94], - [105, 105, 166], - [106, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 167], - [117, 122, 75] - ], - [ - [48, 104, -94], - [105, 105, 168], - [106, 122, 75] - ], - [ - [0, 255, -48] - ], - nil_array, - [ - [0, 9, 169], - [11, 12, 169], - [14, 255, 169] - ], - nil_array, - [ - [0, 255, -8] - ], - nil_array, - nil_array, - nil_array, - [ - [48, 122, -73] - ], - [ - [48, 122, -73] - ], - [ - [48, 122, -73] - ], - [ - [48, 122, -73] - ], - [ - [48, 113, -30], - [114, 114, 170], - [115, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 171], - [117, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 100, -38], - [101, 101, 172], - [102, 122, 75] - ], - [ - [48, 113, -30], - [114, 114, 173], - [115, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 174], - [98, 122, 75] - ], - [ - [48, 114, -80], - [115, 115, 175], - [116, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 176], - [117, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 177], - [102, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 100, -38], - [101, 101, 178], - [102, 122, 75] - ], - [ - [48, 114, -80], - [115, 115, 179], - [116, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 110, -32], - [111, 111, 180], - [112, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 181], - [117, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 182], - [102, 113, 75], - [114, 114, 183], - [115, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 100, -38], - [101, 101, 184], - [102, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 185], - [102, 122, 75] - ], - [ - [48, 103, -44], - [104, 104, 186], - [105, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 107, -31], - [108, 108, 187], - [109, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 188], - [102, 122, 75] - ], - [ - [48, 95, -29], - [97, 106, 75], - [107, 107, 189], - [108, 122, 75] - ], - [ - [48, 95, -29], - [97, 117, 75], - [118, 118, 190], - [119, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 191], - [117, 122, 75] - ], - [ - [48, 99, -79], - [100, 100, 192], - [101, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 193], - [102, 122, 75] - ], - [ - [48, 116, -110], - [117, 117, 194], - [118, 122, 75] - ], - [ - [48, 101, -36], - [102, 102, 195], - [103, 122, 75] - ], - [ - [48, 98, -101], - [99, 99, 196], - [100, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 197], - [102, 122, 75] - ], - [ - [48, 109, -40], - [110, 110, 198], - [111, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 199], - [102, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 200], - [102, 122, 75] - ], - [ - [48, 117, -155], - [118, 118, 201], - [119, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 107, -31], - [108, 108, 202], - [109, 122, 75] - ], - [ - [48, 103, -44], - [104, 104, 203], - [105, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 204], - [117, 122, 75] - ], - [ - [0, 255, -48] - ], - [ - [48, 115, -81], - [116, 116, 205], - [117, 122, 75] - ], - [ - [48, 113, -30], - [114, 114, 206], - [115, 122, 75] - ], - [ - [48, 113, -30], - [114, 114, 207], - [115, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 106, -154], - [107, 107, 208], - [108, 122, 75] - ], - [ - [48, 114, -80], - [115, 115, 209], - [116, 122, 75] - ], - [ - [48, 104, -94], - [105, 105, 210], - [106, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 113, -30], - [114, 114, 211], - [115, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 212], - [102, 122, 75] - ], - [ - [48, 113, -30], - [114, 114, 213], - [115, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 113, -30], - [114, 114, 214], - [115, 122, 75] - ], - [ - [48, 116, -110], - [117, 117, 215], - [118, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 216], - [117, 122, 75] - ], - [ - [48, 107, -31], - [108, 108, 217], - [109, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 95, -29], - [97, 97, 218], - [98, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 95, -29], - [97, 97, 219], - [98, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 220], - [98, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 221], - [102, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 222], - [98, 122, 75] - ], - [ - [48, 101, -36], - [102, 102, 223], - [103, 122, 75] - ], - [ - [48, 113, -30], - [114, 114, 224], - [115, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 104, -94], - [105, 105, 225], - [106, 122, 75] - ], - [ - [48, 113, -30], - [114, 114, 226], - [115, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 100, -38], - [101, 101, 227], - [102, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 228], - [102, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 95, -29], - [97, 97, 229], - [98, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 95, -29], - [97, 97, 230], - [98, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 231], - [117, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 109, -40], - [110, 110, 232], - [111, 122, 75] - ], - [ - [48, 109, -40], - [110, 110, 233], - [111, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 115, -81], - [116, 116, 234], - [117, 122, 75] - ], - [ - [48, 101, -36], - [102, 102, 235], - [103, 109, 75], - [110, 110, 236], - [111, 122, 75] - ], - [ - [48, 99, -79], - [100, 100, 237], - [101, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 97, -29], - [98, 98, 238], - [99, 122, 75] - ], - [ - [48, 95, -29], - [97, 102, 75], - [103, 103, 239], - [104, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 240], - [117, 122, 75] - ], - [ - [48, 98, -101], - [99, 99, 241], - [100, 122, 75] - ], - [ - [48, 97, -29], - [98, 98, 242], - [99, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 109, -40], - [110, 110, 243], - [111, 122, 75] - ], - [ - [48, 95, -29], - [97, 97, 244], - [98, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 113, -30], - [114, 114, 245], - [115, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 97, -29], - [98, 98, 246], - [99, 122, 75] - ], - [ - [48, 98, -101], - [99, 99, 247], - [100, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 116, -110], - [117, 117, 248], - [118, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 95, -29], - [97, 97, 249], - [98, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 100, -38], - [101, 101, 250], - [102, 122, 75] - ], - [ - [48, 107, -31], - [108, 108, 251], - [109, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 252], - [102, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 253], - [102, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 254], - [117, 122, 75] - ], - [ - [48, 107, -31], - [108, 108, 255], - [109, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 107, -31], - [108, 108, 256], - [109, 122, 75] - ], - [ - [48, 114, -80], - [115, 115, 257], - [116, 122, 75] - ], - [ - [48, 107, -31], - [108, 108, 258], - [109, 122, 75] - ], - [ - [48, 115, -81], - [116, 116, 259], - [117, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 260], - [102, 122, 75] - ], - [ - [48, 98, -101], - [99, 99, 261], - [100, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 100, -38], - [101, 101, 262], - [102, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 100, -38], - [101, 101, 263], - [102, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 264], - [102, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 95, -29], - [97, 97, 265], - [98, 122, 75] - ], - [ - [48, 100, -38], - [101, 101, 266], - [102, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 100, -38], - [101, 101, 267], - [102, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 99, -79], - [100, 100, 268], - [101, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 107, -31], - [108, 108, 269], - [109, 122, 75] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ], - [ - [48, 122, -35] - ] - ] - ] - end - - private fun nil_array: Array[Array[Int]] - do - return once new Array[Array[Int]] - end - - var _accept_table: Array[Array[Int]] - private fun build_accept_table do - _accept_table = once [ - [ - -1,0,1,1,0,-1,-1,-1,70,-1,53,54,68,66,57,67,65,69,81,58,73,60,75,78,55,56,-1,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,-1,1,72,-1,84,-1,85,-1,2,2,-1,83,61,62,64,82,-1,59,74,71,76,78,78,78,78,80,79,79,79,79,79,79,48,79,79,79,79,17,79,79,79,79,79,79,26,79,31,16,79,79,79,79,79,79,33,79,79,79,79,79,79,79,79,79,79,79,79,79,79,-1,87,-1,86,-1,2,63,77,80,80,80,80,79,79,32,79,79,79,79,79,79,10,79,79,30,11,79,79,79,41,79,79,79,40,34,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,20,79,79,79,-1,79,79,79,13,79,79,79,28,79,79,79,14,79,79,79,79,11,47,42,79,79,79,79,79,79,44,79,79,27,45,12,79,79,49,79,38,79,79,37,5,79,79,46,79,79,79,51,52,79,79,79,79,79,15,79,79,43,79,29,79,79,39,79,22,4,79,21,79,79,79,79,79,79,35,79,79,79,79,79,79,25,79,3,24,79,79,9,79,79,6,36,79,50,79,18,79,19,7,23,8 - - ] - ] + if accept_token == 5 then + return new TKwimport.init_tk(location) + end + if accept_token == 6 then + return new TKwclass.init_tk(location) + end + if accept_token == 7 then + return new TKwabstract.init_tk(location) + end + if accept_token == 8 then + return new TKwinterface.init_tk(location) + end + if accept_token == 9 then + return new TKwenum.init_tk(location) + end + if accept_token == 10 then + return new TKwend.init_tk(location) + end + if accept_token == 11 then + return new TKwmeth.init_tk(location) + end + if accept_token == 12 then + return new TKwtype.init_tk(location) + end + if accept_token == 13 then + return new TKwinit.init_tk(location) + end + if accept_token == 14 then + return new TKwredef.init_tk(location) + end + if accept_token == 15 then + return new TKwis.init_tk(location) + end + if accept_token == 16 then + return new TKwdo.init_tk(location) + end + if accept_token == 17 then + return new TKwvar.init_tk(location) + end + if accept_token == 18 then + return new TKwextern.init_tk(location) + end + if accept_token == 19 then + return new TKwpublic.init_tk(location) + end + if accept_token == 20 then + return new TKwprotected.init_tk(location) + end + if accept_token == 21 then + return new TKwprivate.init_tk(location) + end + if accept_token == 22 then + return new TKwintrude.init_tk(location) + end + if accept_token == 23 then + return new TKwif.init_tk(location) + end + if accept_token == 24 then + return new TKwthen.init_tk(location) + end + if accept_token == 25 then + return new TKwelse.init_tk(location) + end + if accept_token == 26 then + return new TKwwhile.init_tk(location) + end + if accept_token == 27 then + return new TKwloop.init_tk(location) + end + if accept_token == 28 then + return new TKwfor.init_tk(location) + end + if accept_token == 29 then + return new TKwin.init_tk(location) + end + if accept_token == 30 then + return new TKwand.init_tk(location) + end + if accept_token == 31 then + return new TKwor.init_tk(location) + end + if accept_token == 32 then + return new TKwnot.init_tk(location) + end + if accept_token == 33 then + return new TKwimplies.init_tk(location) + end + if accept_token == 34 then + return new TKwreturn.init_tk(location) + end + if accept_token == 35 then + return new TKwcontinue.init_tk(location) + end + if accept_token == 36 then + return new TKwbreak.init_tk(location) + end + if accept_token == 37 then + return new TKwabort.init_tk(location) + end + if accept_token == 38 then + return new TKwassert.init_tk(location) + end + if accept_token == 39 then + return new TKwnew.init_tk(location) + end + if accept_token == 40 then + return new TKwisa.init_tk(location) + end + if accept_token == 41 then + return new TKwonce.init_tk(location) + end + if accept_token == 42 then + return new TKwsuper.init_tk(location) + end + if accept_token == 43 then + return new TKwself.init_tk(location) + end + if accept_token == 44 then + return new TKwtrue.init_tk(location) + end + if accept_token == 45 then + return new TKwfalse.init_tk(location) + end + if accept_token == 46 then + return new TKwnull.init_tk(location) + end + if accept_token == 47 then + return new TKwas.init_tk(location) + end + if accept_token == 48 then + return new TKwnullable.init_tk(location) + end + if accept_token == 49 then + return new TKwisset.init_tk(location) + end + if accept_token == 50 then + return new TKwlabel.init_tk(location) + end + if accept_token == 51 then + return new TKwwith.init_tk(location) + end + if accept_token == 52 then + return new TKwdebug.init_tk(location) + end + if accept_token == 53 then + return new TOpar.init_tk(location) + end + if accept_token == 54 then + return new TCpar.init_tk(location) + end + if accept_token == 55 then + return new TObra.init_tk(location) + end + if accept_token == 56 then + return new TCbra.init_tk(location) + end + if accept_token == 57 then + return new TComma.init_tk(location) + end + if accept_token == 58 then + return new TColumn.init_tk(location) + end + if accept_token == 59 then + return new TQuad.init_tk(location) + end + if accept_token == 60 then + return new TAssign.init_tk(location) + end + if accept_token == 61 then + return new TPluseq.init_tk(location) + end + if accept_token == 62 then + return new TMinuseq.init_tk(location) + end + if accept_token == 63 then + return new TDotdotdot.init_tk(location) + end + if accept_token == 64 then + return new TDotdot.init_tk(location) + end + if accept_token == 65 then + return new TDot.init_tk(location) + end + if accept_token == 66 then + return new TPlus.init_tk(location) + end + if accept_token == 67 then + return new TMinus.init_tk(location) + end + if accept_token == 68 then + return new TStar.init_tk(location) + end + if accept_token == 69 then + return new TStarstar.init_tk(location) + end + if accept_token == 70 then + return new TSlash.init_tk(location) + end + if accept_token == 71 then + return new TPercent.init_tk(location) + end + if accept_token == 72 then + return new TEq.init_tk(location) + end + if accept_token == 73 then + return new TNe.init_tk(location) + end + if accept_token == 74 then + return new TLt.init_tk(location) + end + if accept_token == 75 then + return new TLe.init_tk(location) + end + if accept_token == 76 then + return new TLl.init_tk(location) + end + if accept_token == 77 then + return new TGt.init_tk(location) + end + if accept_token == 78 then + return new TGe.init_tk(location) + end + if accept_token == 79 then + return new TGg.init_tk(location) + end + if accept_token == 80 then + return new TStarship.init_tk(location) + end + if accept_token == 81 then + return new TBang.init_tk(location) + end + if accept_token == 82 then + return new TAt.init_tk(location) + end + if accept_token == 83 then + return new TClassid.init_tk(location) + end + if accept_token == 84 then + return new TId.init_tk(location) + end + if accept_token == 85 then + return new TAttrid.init_tk(location) + end + if accept_token == 86 then + return new TNumber.init_tk(location) + end + if accept_token == 87 then + return new THexNumber.init_tk(location) + end + if accept_token == 88 then + return new TFloat.init_tk(location) + end + if accept_token == 89 then + return new TString.init_tk(location) + end + if accept_token == 90 then + return new TStartString.init_tk(location) + end + if accept_token == 91 then + return new TMidString.init_tk(location) + end + if accept_token == 92 then + return new TEndString.init_tk(location) + end + if accept_token == 93 then + return new TChar.init_tk(location) + end + if accept_token == 94 then + return new TBadString.init_tk(location) + end + if accept_token == 95 then + return new TBadChar.init_tk(location) + end + if accept_token == 96 then + return new TExternCodeSegment.init_tk(location) + end + abort # unknown token index `accept_token` end end