Merge: more feature for the AST
[nit.git] / src / parser / xss / tokens.xss
index 03247a7..a5536fd 100644 (file)
@@ -19,32 +19,25 @@ $ template make_abs_tokens()
 $ foreach {//token}
 $ if {@parser_index}    
 class @ename
-special Token
+       super Token
 end
 $ end
 $ end
 class EOF
-special Token
-private init noinit do end
+       super Token
 end
 class PError
-special EOF
-private init noinit do end
+       super EOF
+end
+class PLexerError
+       super PError
+end
+class PParserError
+       super PError
 end
 $ end template
 
 $ template make_tokens()
-
-redef class Token
-    readable var _text: String
-
-    fun parser_index: Int is abstract
-
-    redef fun to_s: String do
-        return "'{_text}'"
-    end
-end
-
 $ foreach {//token}
 $ if {@parser_index}
 redef class @ename
@@ -53,43 +46,12 @@ redef class @ename
        return @parser_index
     end
 
-$ if {not(@text)}
-    init init_tk(text: String, loc: Location)
-    do
-        _text = text
-$ else
     init init_tk(loc: Location)
     do
-        _text = once "${sablecc:string2escaped_unicode(@text)}"
-$ end
                _location = loc
     end
 end
 
 $ end if
 $ end foreach
-
-redef class EOF
-    redef fun parser_index: Int
-    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