Add "extend symbol" lexer to parse extensions
This commit is contained in:
@ -8,7 +8,7 @@ module Language.GraphQL.AST.Document
|
||||
( Alias
|
||||
, Argument(..)
|
||||
, ArgumentsDefinition(..)
|
||||
, Definition(ExecutableDefinition, TypeSystemDefinition)
|
||||
, Definition(..)
|
||||
, Description(..)
|
||||
, Directive(..)
|
||||
, Document
|
||||
@ -26,6 +26,7 @@ module Language.GraphQL.AST.Document
|
||||
, OperationType(..)
|
||||
, OperationTypeDefinition(..)
|
||||
, OperationTypeDefinitions
|
||||
, SchemaExtension(..)
|
||||
, Selection(..)
|
||||
, SelectionSet
|
||||
, SelectionSetOpt
|
||||
@ -34,6 +35,7 @@ module Language.GraphQL.AST.Document
|
||||
, TypeDefinition(..)
|
||||
, TypeExtension(..)
|
||||
, TypeSystemDefinition(..)
|
||||
, TypeSystemExtension(..)
|
||||
, UnionMemberTypes(..)
|
||||
, Value(..)
|
||||
, VariableDefinition(..)
|
||||
|
@ -15,6 +15,7 @@ module Language.GraphQL.AST.Lexer
|
||||
, dollar
|
||||
, comment
|
||||
, equals
|
||||
, extend
|
||||
, integer
|
||||
, float
|
||||
, lexeme
|
||||
@ -31,6 +32,7 @@ module Language.GraphQL.AST.Lexer
|
||||
import Control.Applicative (Alternative(..), liftA2)
|
||||
import Data.Char (chr, digitToInt, isAsciiLower, isAsciiUpper, ord)
|
||||
import Data.Foldable (foldl')
|
||||
import Data.Functor (($>))
|
||||
import Data.List (dropWhileEnd)
|
||||
import Data.Proxy (Proxy(..))
|
||||
import Data.Void (Void)
|
||||
@ -217,3 +219,7 @@ escapeSequence = do
|
||||
-- | Parser for the "Byte Order Mark".
|
||||
unicodeBOM :: Parser ()
|
||||
unicodeBOM = optional (char '\xfeff') >> pure ()
|
||||
|
||||
-- | Parses "extend" followed by a 'symbol'. It is used by schema extensions.
|
||||
extend :: Text -> Parser ()
|
||||
extend token = symbol "extend" $> extend token >> pure ()
|
||||
|
@ -215,7 +215,7 @@ schemaDefinition = SchemaDefinition
|
||||
<*> operationTypeDefinitions
|
||||
<?> "SchemaDefinition"
|
||||
where
|
||||
operationTypeDefinitions = braces $ NonEmpty.some operationTypeDefinition
|
||||
operationTypeDefinitions = braces $ NonEmpty.some operationTypeDefinition
|
||||
|
||||
operationTypeDefinition :: Parser OperationTypeDefinition
|
||||
operationTypeDefinition = OperationTypeDefinition
|
||||
|
Reference in New Issue
Block a user