]> git.lizzy.rs Git - metalua.git/commitdiff
CRLF issue with gg.
authorFabien Fleutot <fabien@MacFabien.home>
Sat, 27 Dec 2008 07:44:44 +0000 (08:44 +0100)
committerFabien Fleutot <fabien@MacFabien.home>
Sat, 27 Dec 2008 07:44:44 +0000 (08:44 +0100)
src/compiler/gg.lua

index 33c258bda99345b0265bc9113b6afc8a48abc0ec..486752d537e8f8db33a24db11c6b717844d59c8b 100644 (file)
@@ -75,7 +75,7 @@ end
 
 -------------------------------------------------------------------------------
 -- Return true iff [x] is a parser.
--- If it's a gg-generated parser, reutrn the name of its kind.
+-- If it's a gg-generated parser, return the name of its kind.
 -------------------------------------------------------------------------------
 function is_parser (x)
    return type(x)=="function" or getmetatable(x)==parser_metatable and x.kind
@@ -259,8 +259,12 @@ function multisequence (p)
    function p:add (s)
       -- compile if necessary:
       if not is_parser(s) then sequence(s) end
-      if type(s[1]) ~= "string" then 
-         error "Invalid sequence for multiseq"
+      if is_parser(s) ~= 'sequence' or type(s[1]) ~= "string" then 
+         if self.default then
+            error "Invalid sequence for multiseq, there is already a default"
+         else
+            self.default = s
+         end
       elseif self.sequences[s[1]] then 
          eprintf (" *** Warning: keyword %q overloaded in multisequence ***", s[1])
       end