Merge: doc: fixed some typos and other misc. corrections
[nit.git] / src / parser_util.nit
index 17aa012..cd4f205 100644 (file)
@@ -30,7 +30,7 @@ redef class ToolContext
 
                var eof = tree.n_eof
                if eof isa AError then
-                       self.fatal_error(null, "Fatal Error: {eof.message}")
+                       self.fatal_error(null, "Fatal Error: {eof.message}.")
                        abort
                end
                return tree.n_base.as(not null)
@@ -43,7 +43,7 @@ redef class ToolContext
                var nmodule = parse_module(string)
                var nclassdefs = nmodule.n_classdefs
                if nclassdefs.length != 1 then
-                       self.fatal_error(null, "Fatal Error: not a classdef")
+                       self.fatal_error(null, "Fatal Error: not a classdef.")
                        abort
                end
                return nclassdefs.first
@@ -57,7 +57,7 @@ redef class ToolContext
                var nclassdef = parse_classdef(mod_string)
                var npropdefs = nclassdef.n_propdefs
                if npropdefs.length != 1 then
-                       self.fatal_error(null, "Fatal Error: not a propdef")
+                       self.fatal_error(null, "Fatal Error: not a propdef.")
                        abort
                end
                return npropdefs.first
@@ -85,13 +85,13 @@ redef class ToolContext
 
        # Parse a super class declaration
        # Fatal error if the `string` is not a syntactically correct super class declaration
-       fun parse_superclass(string: String): ASuperclass
+       fun parse_superclass(string: String): APropdef
        do
                var mod_string = "class Dummy\nsuper {string}\nend"
                var nclassdef = parse_classdef(mod_string).as(AStdClassdef)
-               var nsuperclasses = nclassdef.n_superclasses
+               var nsuperclasses = nclassdef.n_propdefs
                if nsuperclasses.length != 1 then
-                       self.fatal_error(null, "Fatal Error: not a super class declaration")
+                       self.fatal_error(null, "Fatal Error: not a super class declaration.")
                        abort
                end
                return nsuperclasses.first
@@ -222,10 +222,15 @@ redef class ToolContext
        end
 end
 
+# A modified lexer that feed tokens before and after the real tokens.
 class InjectedLexer
        super Lexer
 
+       # The tokens to use before the real tokens (in order).
        var injected_before = new List[Token]
+
+       # The tokens to use after the real tokens (in order).
+       # The real EOF token is produced after these tokens.
        var injected_after = new List[Token]
        private var is_finished = false