Add default values for some primitive type attributes.
[nit.git] / src / parser / xss / lexer.xss
index 843a52b..f3b3247 100644 (file)
@@ -25,7 +25,7 @@ class Lexer
        attr _token: Token
 
        # Lexer current state
-       attr _state: Int
+       attr _state: Int = 0
 
        # Name of the stream (as given to tokens)
        readable attr _filename: String 
@@ -40,16 +40,16 @@ class Lexer
        attr _stream_pos: Int
 
        # Current line number in the input stream
-       attr _line: Int
+       attr _line: Int = 0
 
        # Current column in the input stream
-       attr _pos: Int
+       attr _pos: Int = 0
 
        # Was the last character a cariage-return?
-       attr _cr: Bool
+       attr _cr: Bool = false
 
        # If the end of stream?
-       attr _eof: Bool
+       attr _eof: Bool = false
 
        # Current working text read from the input stream
        attr _text: String
@@ -178,10 +178,10 @@ $ foreach {//token}
 $    if {not(@text)}
 $        if {@parser_index}
                                                var token_text = _text.substring(0, accept_length)
-                                               var token = new @ename(token_text, _filename, start_line + 1, start_pos + 1)
+                                               var token = new @ename.init_tk(token_text, _filename, start_line + 1, start_pos + 1)
 $        end
 $    else
-                                               var token = new @ename(_filename, start_line + 1, start_pos + 1)
+                                               var token = new @ename.init_tk(_filename, start_line + 1, start_pos + 1)
 $    end
                                                push_back(accept_length)
                                                _pos = accept_pos