Add definition module

This commit is contained in:
2019-12-26 13:00:47 +01:00
parent e3a495a778
commit 56d88310df
8 changed files with 164 additions and 30 deletions

View File

@ -9,14 +9,15 @@ module Language.GraphQL.AST.Parser
import Control.Applicative (Alternative(..), optional)
import Data.List.NonEmpty (NonEmpty(..))
import Language.GraphQL.AST
import qualified Language.GraphQL.AST.Document as Document
import Language.GraphQL.AST.Lexer
import Text.Megaparsec (lookAhead, option, try, (<?>))
-- | Parser for the GraphQL documents.
document :: Parser Document
document :: Parser Document.Document
document = unicodeBOM
>> spaceConsumer
>> lexeme (manyNE $ ExecutableDefinition <$> definition)
>> lexeme (manyNE $ Document.ExecutableDefinition <$> definition)
definition :: Parser ExecutableDefinition
definition = DefinitionOperation <$> operationDefinition