compile: Check the validity of module filename before parsing.
[nit.git] / src / parser / xss / parser.xss
index 38b3603..4123fd1 100644 (file)
@@ -112,11 +112,8 @@ special ParserTable
                push(0, null)
 
                var lexer = _lexer
-               while true do
+               loop
                        var token = lexer.peek
-                       var last_pos = token.location.column_start
-                       var last_line = token.location.line_start
-
                        if token isa PError then
                                return new Start(null, token)
                        end
@@ -157,13 +154,13 @@ special ParserTable
                                (new ComputeProdLocationVisitor).enter_visit(node)
                                return node
                        else if action_type == 3 then # ERROR
-                               var location = new Location(lexer.filename, last_line, last_line, last_pos, last_pos)
-                               var node2 = new PError.init_error(error_messages[errors[action_value]],location)
+                               var node2 = new PError.init_error("Syntax error: unexpected token.", token.location)
                                var node = new Start(null, node2)
                                return node
                        end
+                       if false then break # FIXME remove once unreach loop exits are in c_src
                end
-               abort
+               abort # FIXME remove once unreach loop exits are in c_src
        end
 
        var _reduce_table: Array[ReduceAction]
@@ -383,22 +380,6 @@ $ end foreach
                ]
        end
 
-       private fun error_messages: Array[String]
-       do
-               return once [
-$ foreach {parser_data/error_messages/msg}
-                       "${sablecc:string2escaped_unicode(.)}"[-sep ','-]
-$ end
-               ]
-       end
-
-       private fun errors: Array[Int]
-       do
-               return once [
-                       [-foreach {parser_data/errors/i}-]${.}[-sep ','-][-end-]
-               ]
-       end
-
        init do end
 end
 $ end template