private import tables
redef class Token
- readable var _text: String
+ var _text: nullable String
- fun parser_index: Int is abstract
-
- redef fun to_s: String do
- return "'{_text}'"
+ redef fun text
+ do
+ var res = _text
+ if res != null then return res
+ res = location.text
+ _text = res
+ return res
end
+
+ fun parser_index: Int is abstract
end
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
return 1
end
- init init_tk(text: String, loc: Location)
+ init init_tk(loc: Location)
do
- _text = text
_location = loc
end
end
return 2
end
- init init_tk(text: String, loc: Location)
+ init init_tk(loc: Location)
do
- _text = text
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "import"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "class"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "abstract"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "interface"
_location = loc
end
end
return 7
end
- init init_tk(text: String, loc: Location)
+ init init_tk(loc: Location)
do
- _text = text
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "special"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "end"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "fun"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "type"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "init"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "redef"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "is"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "do"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "readable"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "writable"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "var"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "intern"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "extern"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "protected"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "private"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "intrude"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "if"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "then"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "else"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "while"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "loop"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "for"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "in"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "and"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "or"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "not"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "return"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "continue"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "break"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "abort"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "assert"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "new"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "isa"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "once"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "super"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "self"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "true"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "false"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "null"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "as"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "nullable"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "isset"
_location = loc
end
end
init init_tk(loc: Location)
do
- _text = once "label"
_location = loc
end
end
-redef class TOpar
+redef class TKwdebug
redef fun parser_index: Int
do
return 51
init init_tk(loc: Location)
do
- _text = once "("
_location = loc
end
end
-redef class TCpar
+redef class TOpar
redef fun parser_index: Int
do
return 52
init init_tk(loc: Location)
do
- _text = once ")"
_location = loc
end
end
-redef class TObra
+redef class TCpar
redef fun parser_index: Int
do
return 53
init init_tk(loc: Location)
do
- _text = once "["
_location = loc
end
end
-redef class TCbra
+redef class TObra
redef fun parser_index: Int
do
return 54
init init_tk(loc: Location)
do
- _text = once "]"
_location = loc
end
end
-redef class TComma
+redef class TCbra
redef fun parser_index: Int
do
return 55
init init_tk(loc: Location)
do
- _text = once ","
_location = loc
end
end
-redef class TColumn
+redef class TComma
redef fun parser_index: Int
do
return 56
init init_tk(loc: Location)
do
- _text = once ":"
_location = loc
end
end
-redef class TQuad
+redef class TColumn
redef fun parser_index: Int
do
return 57
init init_tk(loc: Location)
do
- _text = once "::"
_location = loc
end
end
-redef class TAssign
+redef class TQuad
redef fun parser_index: Int
do
return 58
init init_tk(loc: Location)
do
- _text = once "="
_location = loc
end
end
-redef class TPluseq
+redef class TAssign
redef fun parser_index: Int
do
return 59
init init_tk(loc: Location)
do
- _text = once "+="
_location = loc
end
end
-redef class TMinuseq
+redef class TPluseq
redef fun parser_index: Int
do
return 60
init init_tk(loc: Location)
do
- _text = once "-="
_location = loc
end
end
-redef class TDotdotdot
+redef class TMinuseq
redef fun parser_index: Int
do
return 61
init init_tk(loc: Location)
do
- _text = once "..."
_location = loc
end
end
-redef class TDotdot
+redef class TDotdotdot
redef fun parser_index: Int
do
return 62
init init_tk(loc: Location)
do
- _text = once ".."
_location = loc
end
end
-redef class TDot
+redef class TDotdot
redef fun parser_index: Int
do
return 63
init init_tk(loc: Location)
do
- _text = once "."
_location = loc
end
end
-redef class TPlus
+redef class TDot
redef fun parser_index: Int
do
return 64
init init_tk(loc: Location)
do
- _text = once "+"
_location = loc
end
end
-redef class TMinus
+redef class TPlus
redef fun parser_index: Int
do
return 65
init init_tk(loc: Location)
do
- _text = once "-"
_location = loc
end
end
-redef class TStar
+redef class TMinus
redef fun parser_index: Int
do
return 66
init init_tk(loc: Location)
do
- _text = once "*"
_location = loc
end
end
-redef class TSlash
+redef class TStar
redef fun parser_index: Int
do
return 67
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 68
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 69
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 70
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 71
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 72
init init_tk(loc: Location)
do
- _text = once "<="
_location = loc
end
end
-redef class TLl
+redef class TLe
redef fun parser_index: Int
do
return 73
init init_tk(loc: Location)
do
- _text = once "<<"
_location = loc
end
end
-redef class TGt
+redef class TLl
redef fun parser_index: Int
do
return 74
init init_tk(loc: Location)
do
- _text = once ">"
_location = loc
end
end
-redef class TGe
+redef class TGt
redef fun parser_index: Int
do
return 75
init init_tk(loc: Location)
do
- _text = once ">="
_location = loc
end
end
-redef class TGg
+redef class TGe
redef fun parser_index: Int
do
return 76
init init_tk(loc: Location)
do
- _text = once ">>"
_location = loc
end
end
-redef class TStarship
+redef class TGg
redef fun parser_index: Int
do
return 77
init init_tk(loc: Location)
do
- _text = once "<=>"
_location = loc
end
end
-redef class TBang
+redef class TStarship
redef fun parser_index: Int
do
return 78
init init_tk(loc: Location)
do
- _text = once "!"
_location = loc
end
end
-redef class TClassid
+redef class TBang
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 TId
+redef class TClassid
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 TAttrid
+redef class TId
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 TNumber
+redef class TAttrid
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 TFloat
+redef class TNumber
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 TChar
+redef class TFloat
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 TString
+redef class TChar
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 TStartString
+redef class TString
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 TMidString
+redef class TStartString
redef fun parser_index: Int
do
return 87
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 TMidString
redef fun parser_index: Int
do
return 88
end
- init init_tk(text: String, loc: Location)
+ init init_tk(loc: Location)
+ do
+ _location = loc
+ end
+end
+
+redef class TEndString
+ redef fun parser_index: Int
+ do
+ return 89
+ end
+
+ init init_tk(loc: Location)
+ do
+ _location = loc
+ end
+end
+
+redef class TBadChar
+ redef fun parser_index: Int
+ do
+ return 90
+ end
+
+ init init_tk(loc: Location)
+ do
+ _location = loc
+ end
+end
+
+redef class TBadString
+ redef fun parser_index: Int
+ do
+ return 91
+ end
+
+ init init_tk(loc: Location)
do
- _text = text
_location = loc
end
end
redef class EOF
redef fun parser_index: Int
do
- return 89
+ return 92
end
init(loc: Location)
if c == 10 then
if cr then
cr = false
+ _file.line_starts[line] = sp
else
line = line + 1
pos = 0
+ _file.line_starts[line] = sp
end
else if c == 13 then
line = line + 1
pos = 0
cr = true
+ _file.line_starts[line] = sp
else
pos = pos + 1
cr = false
return null
end
if accept_token == 1 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TEol.init_tk(token_text, location)
+ return new TEol.init_tk(location)
end
if accept_token == 2 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TComment.init_tk(token_text, location)
+ return new TComment.init_tk(location)
end
if accept_token == 3 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TKwmodule.init_tk(token_text, location)
+ return new TKwmodule.init_tk(location)
end
if accept_token == 4 then
return new TKwimport.init_tk(location)
return new TKwinterface.init_tk(location)
end
if accept_token == 8 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TKwenum.init_tk(token_text, location)
+ return new TKwenum.init_tk(location)
end
if accept_token == 9 then
return new TKwspecial.init_tk(location)
return new TKwlabel.init_tk(location)
end
if accept_token == 52 then
- return new TOpar.init_tk(location)
+ return new TKwdebug.init_tk(location)
end
if accept_token == 53 then
- return new TCpar.init_tk(location)
+ return new TOpar.init_tk(location)
end
if accept_token == 54 then
- return new TObra.init_tk(location)
+ return new TCpar.init_tk(location)
end
if accept_token == 55 then
- return new TCbra.init_tk(location)
+ return new TObra.init_tk(location)
end
if accept_token == 56 then
- return new TComma.init_tk(location)
+ return new TCbra.init_tk(location)
end
if accept_token == 57 then
- return new TColumn.init_tk(location)
+ return new TComma.init_tk(location)
end
if accept_token == 58 then
- return new TQuad.init_tk(location)
+ return new TColumn.init_tk(location)
end
if accept_token == 59 then
- return new TAssign.init_tk(location)
+ return new TQuad.init_tk(location)
end
if accept_token == 60 then
- return new TPluseq.init_tk(location)
+ return new TAssign.init_tk(location)
end
if accept_token == 61 then
- return new TMinuseq.init_tk(location)
+ return new TPluseq.init_tk(location)
end
if accept_token == 62 then
- return new TDotdotdot.init_tk(location)
+ return new TMinuseq.init_tk(location)
end
if accept_token == 63 then
- return new TDotdot.init_tk(location)
+ return new TDotdotdot.init_tk(location)
end
if accept_token == 64 then
- return new TDot.init_tk(location)
+ return new TDotdot.init_tk(location)
end
if accept_token == 65 then
- return new TPlus.init_tk(location)
+ return new TDot.init_tk(location)
end
if accept_token == 66 then
- return new TMinus.init_tk(location)
+ return new TPlus.init_tk(location)
end
if accept_token == 67 then
- return new TStar.init_tk(location)
+ return new TMinus.init_tk(location)
end
if accept_token == 68 then
- return new TSlash.init_tk(location)
+ return new TStar.init_tk(location)
end
if accept_token == 69 then
- return new TPercent.init_tk(location)
+ return new TSlash.init_tk(location)
end
if accept_token == 70 then
- return new TEq.init_tk(location)
+ return new TPercent.init_tk(location)
end
if accept_token == 71 then
- return new TNe.init_tk(location)
+ return new TEq.init_tk(location)
end
if accept_token == 72 then
- return new TLt.init_tk(location)
+ return new TNe.init_tk(location)
end
if accept_token == 73 then
- return new TLe.init_tk(location)
+ return new TLt.init_tk(location)
end
if accept_token == 74 then
- return new TLl.init_tk(location)
+ return new TLe.init_tk(location)
end
if accept_token == 75 then
- return new TGt.init_tk(location)
+ return new TLl.init_tk(location)
end
if accept_token == 76 then
- return new TGe.init_tk(location)
+ return new TGt.init_tk(location)
end
if accept_token == 77 then
- return new TGg.init_tk(location)
+ return new TGe.init_tk(location)
end
if accept_token == 78 then
- return new TStarship.init_tk(location)
+ return new TGg.init_tk(location)
end
if accept_token == 79 then
- return new TBang.init_tk(location)
+ return new TStarship.init_tk(location)
end
if accept_token == 80 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TClassid.init_tk(token_text, location)
+ return new TBang.init_tk(location)
end
if accept_token == 81 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TId.init_tk(token_text, location)
+ return new TClassid.init_tk(location)
end
if accept_token == 82 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TAttrid.init_tk(token_text, location)
+ return new TId.init_tk(location)
end
if accept_token == 83 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TNumber.init_tk(token_text, location)
+ return new TAttrid.init_tk(location)
end
if accept_token == 84 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TFloat.init_tk(token_text, location)
+ return new TNumber.init_tk(location)
end
if accept_token == 85 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TChar.init_tk(token_text, location)
+ return new TFloat.init_tk(location)
end
if accept_token == 86 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TString.init_tk(token_text, location)
+ return new TChar.init_tk(location)
end
if accept_token == 87 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TStartString.init_tk(token_text, location)
+ return new TString.init_tk(location)
end
if accept_token == 88 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TMidString.init_tk(token_text, location)
+ return new TStartString.init_tk(location)
end
if accept_token == 89 then
- var token_text = string.substring(start_stream_pos, accept_length)
- return new TEndString.init_tk(token_text, location)
+ return new TMidString.init_tk(location)
+ end
+ if accept_token == 90 then
+ return new TEndString.init_tk(location)
+ end
+ if accept_token == 91 then
+ return new TBadChar.init_tk(location)
+ end
+ if accept_token == 92 then
+ return new TBadString.init_tk(location)
end
else
_stream_pos = sp