Merge: SharedPreferences: Nit API wrapping android SharedPreferences class
[nit.git] / src / parser / parser_nodes.nit
index d8f1046..070a8f8 100644 (file)
@@ -32,7 +32,7 @@ abstract class ANode
        # Display a message for the colored location of the node
        fun debug(message: String)
        do
-               print "{hot_location} {self.class_name}: {message}\n{hot_location.colored_line("0;32")}"
+               sys.stderr.write "{hot_location} {self.class_name}: {message}\n{hot_location.colored_line("0;32")}\n"
        end
 
        # Parent of the node in the AST
@@ -237,6 +237,15 @@ abstract class Token
        # May have disapeared in the AST
        var next_token: nullable Token = null
 
+       # The verbatim blank text between `prev_token` and `self`
+       fun blank_before: String
+       do
+               if prev_token == null then return ""
+               var from = prev_token.location.pend+1
+               var to = location.pstart
+               return location.file.string.substring(from,to-from)
+       end
+
        redef fun to_s: String do
                return "'{text}'"
        end
@@ -515,13 +524,13 @@ class TMinuseq
        super TokenOperator
 end
 class TDotdotdot
-       super TokenOperator
+       super Token
 end
 class TDotdot
-       super TokenOperator
+       super Token
 end
 class TDot
-       super TokenOperator
+       super Token
 end
 class TPlus
        super TokenOperator