$ end
class EOF
super Token
-private init noinit do end
end
class PError
super EOF
-private init noinit do end
+end
+class PLexerError
+ super PError
+end
+class PParserError
+ super PError
end
$ end template
$ template make_tokens()
-
-redef class Token
- var _text: nullable String
-
- 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
-
$ foreach {//token}
$ if {@parser_index}
redef class @ename
do
return ${tokens/eof/@parser_index}
end
-
- init(loc: Location)
- do
- _text = ""
- _location = loc
- end
-end
-
-redef class PError
- readable var _message: String
-
- init init_error(message: String, loc: Location)
- do
- init(loc)
- _message = message
- end
end
$ end template