language-lua2 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+10/−10 lines, 2 filesdep ~Earley
Dependency ranges changed: Earley
Files
- language-lua2.cabal +2/−2
- src/Language/Lua/Parser.hs +8/−8
language-lua2.cabal view
@@ -1,5 +1,5 @@ name: language-lua2-version: 0.1.0.0+version: 0.1.0.1 synopsis: Lua parser and pretty printer description: Lua parser and pretty printer homepage: http://github.com/mitchellwrosen/language-lua2@@ -25,7 +25,7 @@ other-modules: Language.Lua.Internal build-depends: base >= 4.7 && < 5 , containers- , Earley+ , Earley >= 0.10.0 , lexer-applicative , microlens , regex-applicative
src/Language/Lua/Parser.hs view
@@ -100,7 +100,7 @@ instance HasNodeInfo a => HasNodeInfo (Maybe a) where nodeInfo = foldMap nodeInfo -type LuaGrammar f = forall r. Grammar r String (Prod r String (L Token) (f NodeInfo))+type LuaGrammar f = forall r. Grammar r (Prod r String (L Token) (f NodeInfo)) data LuaParseException = LuaLexException !Pos@@ -190,7 +190,7 @@ -> f NodeInfo parseLuaWith g filename contents = let tokens = streamToList' (runLexer luaLexer filename contents)- in case fullParses (parser g tokens) of+ in case fullParses (parser g) tokens of ([x], _) -> x ([], r) -> throw (LuaParseException filename r) (_, r) -> throw (LuaAmbiguousParseException filename r)@@ -221,10 +221,10 @@ luaExpression :: LuaGrammar Expression luaExpression = (\(_,_,c) -> c) <$> grammar -grammar :: Grammar r String ( Prod r String (L Token) (Block NodeInfo)- , Prod r String (L Token) (Statement NodeInfo)- , Prod r String (L Token) (Expression NodeInfo)- )+grammar :: Grammar r ( Prod r String (L Token) (Block NodeInfo)+ , Prod r String (L Token) (Statement NodeInfo)+ , Prod r String (L Token) (Expression NodeInfo)+ ) grammar = mdo block :: Prod r String (L Token) (Block NodeInfo) <- rule $ mkBlock@@ -752,7 +752,7 @@ sepBy :: (HasNodeInfo a, HasNodeInfo sep) => Prod r e t a -> Prod r e t sep- -> Grammar r e (Prod r e t (NodeInfo, [a]))+ -> Grammar r (Prod r e t (NodeInfo, [a])) sepBy f sep = do fs <- sepBy1 f sep rule $ (_2 %~ NE.toList) <$> fs@@ -761,7 +761,7 @@ sepBy1 :: forall r e t a sep. (HasNodeInfo a, HasNodeInfo sep) => Prod r e t a -> Prod r e t sep- -> Grammar r e (Prod r e t (NodeInfo, NonEmpty a))+ -> Grammar r (Prod r e t (NodeInfo, NonEmpty a)) sepBy1 f sep = mdo fs :: Prod r e t (NodeInfo, [a]) <- rule $ liftA3 (\a b (c,d) -> (nodeInfo a <> nodeInfo b <> c, b:d)) sep f fs