nullable: convert lib, tools and tests
[nit.git] / src / parser / xss / lexer.xss
index d962dce..fccb57c 100644 (file)
@@ -22,7 +22,7 @@ $ template make_lexer()
 # It is better user with the Parser
 class Lexer
        # Last peeked token
-       attr _token: Token
+       attr _token: nullable Token
 
        # Lexer current state
        attr _state: Int = 0
@@ -77,7 +77,7 @@ $ end foreach
                while _token == null do
                        _token = get_token
                end
-               return _token
+               return _token.as(not null)
        end
 
        # Give and consume the next token
@@ -88,11 +88,11 @@ $ end foreach
                        result = get_token
                end
                _token = null
-               return result
+               return result.as(not null)
        end
 
        # Get a token, or null if it is discarded
-       private meth get_token: Token
+       private meth get_token: nullable Token
        do
                var dfa_state = 0