{-# LANGUAGE OverloadedStrings #-}

module Hydra.Impl.Haskell.Sources.Ext.Graphql.Syntax where

import Hydra.All
import Hydra.Impl.Haskell.Dsl.Grammars
import Hydra.Util.GrammarToModule
import qualified Hydra.Impl.Haskell.Dsl.Standard as Standard


and_ :: Pattern
and_ = String -> Pattern
terminal String
"&"
at_ :: Pattern
at_ = String -> Pattern
terminal String
"@"
bang_ :: Pattern
bang_ = String -> Pattern
terminal String
"!"
colon_ :: Pattern
colon_ = String -> Pattern
terminal String
":"
directive_ :: Pattern
directive_ = String -> Pattern
terminal String
"directive"
dollar_ :: Pattern
dollar_ = String -> Pattern
terminal String
"$"
ellipsis_ :: Pattern
ellipsis_ = String -> Pattern
terminal String
"..."
enum_ :: Pattern
enum_ = String -> Pattern
terminal String
"enum"
equal_ :: Pattern
equal_ = String -> Pattern
terminal String
"="
extend_ :: Pattern
extend_ = String -> Pattern
terminal String
"extend"
false_ :: Pattern
false_ = String -> Pattern
terminal String
"false"
implements_ :: Pattern
implements_ = String -> Pattern
terminal String
"implements"
input_ :: Pattern
input_ = String -> Pattern
terminal String
"input"
interface_ :: Pattern
interface_ = String -> Pattern
terminal String
"interface"
lbracket_ :: Pattern
lbracket_ = String -> Pattern
terminal String
"["
lcurly_ :: Pattern
lcurly_ = String -> Pattern
terminal String
"{"
lparen_ :: Pattern
lparen_ = String -> Pattern
terminal String
"("
null_ :: Pattern
null_ = String -> Pattern
terminal String
"null"
on_ :: Pattern
on_ = String -> Pattern
terminal String
"on"
or_ :: Pattern
or_ = String -> Pattern
terminal String
"or"
rbracket_ :: Pattern
rbracket_ = String -> Pattern
terminal String
"]"
rcurly_ :: Pattern
rcurly_ = String -> Pattern
terminal String
"}"
repeatable_ :: Pattern
repeatable_ = String -> Pattern
terminal String
"repeatable"
rparen_ :: Pattern
rparen_ = String -> Pattern
terminal String
")"
scalar_ :: Pattern
scalar_ = String -> Pattern
terminal String
"scalar"
schema_ :: Pattern
schema_ = String -> Pattern
terminal String
"schema"
true_ :: Pattern
true_ = String -> Pattern
terminal String
"true"
type_ :: Pattern
type_ = String -> Pattern
terminal String
"type"
union_ :: Pattern
union_ = String -> Pattern
terminal String
"union"

descriptionOpt :: Pattern
descriptionOpt = Pattern -> Pattern
optPattern
"Description"
directivesConst :: Pattern
directivesConst = Pattern
"Directives" -- Directives_[Const]
directivesConstOpt :: Pattern
directivesConstOpt = Pattern -> Pattern
optPattern
"Directives" -- Directives_[Const]opt

graphqlSyntaxModule :: Module Meta
graphqlSyntaxModule :: Module Meta
graphqlSyntaxModule = Namespace -> Grammar -> Maybe String -> Module Meta
grammarToModule Namespace
ns Grammar
graphqlGrammar forall a b. (a -> b) -> a -> b
$
    forall a. a -> Maybe a
Just (String
"A GraphQL model. Based on the (extended) BNF at:\n" forall a. [a] -> [a] -> [a]
++
      String
"  https://spec.graphql.org/draft/#sec-Appendix-Grammar-Summary")
  where
    ns :: Namespace
ns = String -> Namespace
Namespace String
"hydra/ext/graphql/syntax"

graphqlGrammar :: Grammar
graphqlGrammar :: Grammar
graphqlGrammar = [Production] -> Grammar
Grammar forall a b. (a -> b) -> a -> b
$ [Production]
tokenDefinitions forall a. [a] -> [a] -> [a]
++ [Production]
documentDefinitions

tokenDefinitions :: [Production]
tokenDefinitions :: [Production]
tokenDefinitions = [
  String -> [Pattern] -> Production
define String
"Name"        [String -> Pattern
regex String
"[A-Za-z][A-Za-z0-9]*"],
  String -> [Pattern] -> Production
define String
"IntValue"    [String -> Pattern
regex String
"-?(0|[1-9][0-9]*)"],
  String -> [Pattern] -> Production
define String
"FloatValue"  [String -> Pattern
regex String
"-?(0|[1-9][0-9]*)([.][0-9]+|[eE][+-]?[0-9]+)"],
  String -> [Pattern] -> Production
define String
"StringValue" [String -> Pattern
regex String
"[\"].*[\"]"]] -- TODO: the actual expression includes Unicode escape sequences

documentDefinitions :: [Production]
documentDefinitions :: [Production]
documentDefinitions = [
  String -> [Pattern] -> Production
define String
"Document" [
    Pattern -> Pattern
starPattern
"Definition"],

  String -> [Pattern] -> Production
define String
"Definition" [
    String
"executable"String -> Pattern -> Pattern
>: Pattern
"ExecutableDefinition",
    String
"typeSystem"String -> Pattern -> Pattern
>: Pattern
"TypeSystemDefinitionOrExtension"],

  String -> [Pattern] -> Production
define String
"ExecutableDocument" [
    Pattern -> Pattern
starPattern
"ExecutableDefinition"],

  String -> [Pattern] -> Production
define String
"ExecutableDefinition" [
    String
"operation"String -> Pattern -> Pattern
>: Pattern
"OperationDefinition",
    String
"fragment"String -> Pattern -> Pattern
>: Pattern
"FragmentDefinition"],

  String -> [Pattern] -> Production
define String
"OperationDefinition" [
    [Pattern] -> Pattern
list[Pattern
"OperationType", Pattern -> Pattern
optPattern
"Name", Pattern -> Pattern
optPattern
"VariablesDefinition", Pattern -> Pattern
optPattern
"Directives", Pattern
"SelectionSet"],
    Pattern
"SelectionSet"],

  String -> [Pattern] -> Production
define String
"OperationType" [
    String -> Pattern
terminal String
"query",
    String -> Pattern
terminal String
"mutation",
    String -> Pattern
terminal String
"subscription"],

  String -> [Pattern] -> Production
define String
"SelectionSet" [
    [Pattern] -> Pattern
list[Pattern
lcurly_, Pattern -> Pattern
starPattern
"Selection", Pattern
rcurly_]],

  String -> [Pattern] -> Production
define String
"Selection" [
    Pattern
"Field",
    Pattern
"FragmentSpread",
    Pattern
"InlineFragment"],

  String -> [Pattern] -> Production
define String
"Field" [
    [Pattern] -> Pattern
list[Pattern -> Pattern
optPattern
"Alias", Pattern
"Name", Pattern -> Pattern
optPattern
"Arguments", Pattern -> Pattern
optPattern
"Directives", Pattern -> Pattern
optPattern
"SelectionSet"]],

  String -> [Pattern] -> Production
define String
"Alias" [
    Pattern
"Name", Pattern
colon_],

  String -> [Pattern] -> Production
define String
"Arguments"{- [Const] -} [
    [Pattern] -> Pattern
list[Pattern
lparen_, Pattern -> Pattern
starPattern
"Argument"{- [?Const] -}, Pattern
rparen_]],

  String -> [Pattern] -> Production
define String
"Argument"{- [Const] -} [
    [Pattern] -> Pattern
list[Pattern
"Name", Pattern
colon_, Pattern
"Value"{- [?Const] -}]],

  String -> [Pattern] -> Production
define String
"FragmentSpread" [
    [Pattern] -> Pattern
list[Pattern
ellipsis_, Pattern
"FragmentName", Pattern -> Pattern
optPattern
"Directives"]],

  String -> [Pattern] -> Production
define String
"InlineFragment" [
    [Pattern] -> Pattern
list[Pattern
ellipsis_, Pattern -> Pattern
optPattern
"TypeCondition", Pattern -> Pattern
optPattern
"Directives", Pattern
"SelectionSet"]],

  String -> [Pattern] -> Production
define String
"FragmentDefinition" [
    [Pattern] -> Pattern
list[String -> Pattern
terminal String
"fragment", Pattern
"FragmentName", Pattern
"TypeCondition", Pattern -> Pattern
optPattern
"Directives", Pattern
"SelectionSet"]],

  String -> [Pattern] -> Production
define String
"FragmentName" [
    Pattern
"Name" {- but not on_ -}],

  String -> [Pattern] -> Production
define String
"TypeCondition" [
    Pattern
on_, Pattern
"NamedType"],

  String -> [Pattern] -> Production
define String
"Value"{- [Const] -} [
    {- [if not Const] -} Pattern
"Variable",
    String
"int"String -> Pattern -> Pattern
>: Pattern
"IntValue",
    String
"float"String -> Pattern -> Pattern
>: Pattern
"FloatValue",
    String
"string"String -> Pattern -> Pattern
>: Pattern
"StringValue",
    String
"boolean"String -> Pattern -> Pattern
>: Pattern
"BooleanValue",
    String
"null"String -> Pattern -> Pattern
>: Pattern
"NullValue",
    String
"enum"String -> Pattern -> Pattern
>: Pattern
"EnumValue",
    String
"list"String -> Pattern -> Pattern
>: Pattern
"ListValue"{- [?Const] -},
    String
"object"String -> Pattern -> Pattern
>: Pattern
"ObjectValue"{- [?Const] -}],

  String -> [Pattern] -> Production
define String
"BooleanValue" [
    Pattern
true_,
    Pattern
false_],

  String -> [Pattern] -> Production
define String
"NullValue" [
    Pattern
null_],

  String -> [Pattern] -> Production
define String
"EnumValue" [
    [Pattern] -> Pattern
list[Pattern
"Name" {- but not true_ or false_ or null_ -}]],

  String -> [Pattern] -> Production
define String
"ListValue"{- [Const] -} [
    [Pattern] -> Pattern
list[Pattern
lbracket_, Pattern
rbracket_],
    [Pattern] -> Pattern
list[Pattern
lbracket_, Pattern -> Pattern
starPattern
"Value"{- [?Const] -}]],

  String -> [Pattern] -> Production
define String
"ObjectValue"{- [Const] -} [
    [Pattern] -> Pattern
list[Pattern
lcurly_, Pattern
rcurly_],
    [Pattern] -> Pattern
list[Pattern -> Pattern
starPattern
"ObjectField"{- [?Const] -}]],

  String -> [Pattern] -> Production
define String
"ObjectField"{- [Const] -} [
    [Pattern] -> Pattern
list[Pattern
"Name", Pattern
colon_, Pattern
"Value"{- [?Const] -}]],

  String -> [Pattern] -> Production
define String
"VariablesDefinition" [
    [Pattern] -> Pattern
list[Pattern
"Variable", Pattern
colon_, Pattern
"Type", Pattern -> Pattern
optPattern
"DefaultValue", Pattern
directivesConstOpt]],

  String -> [Pattern] -> Production
define String
"Variable" [
    Pattern
"Name"],

  String -> [Pattern] -> Production
define String
"DefaultValue" [
    [Pattern] -> Pattern
list[Pattern
equal_, Pattern
"Value"{- [Const] -}]],

  String -> [Pattern] -> Production
define String
"Type" [
    String
"named"String -> Pattern -> Pattern
>: Pattern
"NamedType",
    String
"list"String -> Pattern -> Pattern
>: Pattern
"ListType",
    String
"nonNull"String -> Pattern -> Pattern
>: Pattern
"NonNullType"],

  String -> [Pattern] -> Production
define String
"NamedType" [
    Pattern
"Name"],

  String -> [Pattern] -> Production
define String
"ListType" [
    [Pattern] -> Pattern
list[Pattern
lbracket_, Pattern
"Type", Pattern
rbracket_]],

  String -> [Pattern] -> Production
define String
"NonNullType" [
    String
"named"String -> Pattern -> Pattern
>: [Pattern] -> Pattern
list[Pattern
"NamedType", Pattern
bang_],
    String
"list"String -> Pattern -> Pattern
>: [Pattern] -> Pattern
list[Pattern
"ListType", Pattern
bang_]],

  String -> [Pattern] -> Production
define String
"Directives"{- [Const] -} [
    Pattern -> Pattern
star(Pattern
"Directive"{- [?Const] -})],

  String -> [Pattern] -> Production
define String
"Directive"{- [Const] -} [
    [Pattern] -> Pattern
list[Pattern
at_, Pattern
"Name", Pattern -> Pattern
opt(Pattern
"Arguments"{- [?Const] -})]],

  String -> [Pattern] -> Production
define String
"TypeSystemDocment" [
    Pattern -> Pattern
starPattern
"TypeSystemDefinition"],

  String -> [Pattern] -> Production
define String
"TypeSystemDefinition" [
    String
"schema"String -> Pattern -> Pattern
>: Pattern
"SchemaDefinition",
    String
"type"String -> Pattern -> Pattern
>: Pattern
"TypeDefinition",
    String
"directive"String -> Pattern -> Pattern
>: Pattern
"DirectiveDefinition"],

  String -> [Pattern] -> Production
define String
"TypeSystemExtensionDocument" [
    Pattern -> Pattern
starPattern
"TypeSystemDefinitionOrExtension"],

  String -> [Pattern] -> Production
define String
"TypeSystemDefinitionOrExtension" [
    String
"definition"String -> Pattern -> Pattern
>: Pattern
"TypeSystemDefinition",
    String
"extension"String -> Pattern -> Pattern
>: Pattern
"TypeSystemExtension"],

  String -> [Pattern] -> Production
define String
"TypeSystemExtension" [
    String
"schema"String -> Pattern -> Pattern
>: Pattern
"SchemaExtension",
    String
"type"String -> Pattern -> Pattern
>: Pattern
"TypeExtension"],

  String -> [Pattern] -> Production
define String
"SchemaDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
schema_, Pattern
directivesConstOpt, Pattern
lcurly_, Pattern
"RootOperationTypeDefinition", Pattern
rcurly_]],

  String -> [Pattern] -> Production
define String
"SchemaExtension" [
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
schema_, Pattern
directivesConstOpt, Pattern
lcurly_, Pattern
"RootOperationTypeDefinition", Pattern
rcurly_],
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
schema_, Pattern
directivesConst {- [lookahead != lcurly_] -}]],

  String -> [Pattern] -> Production
define String
"RootOperationTypeDefinition" [
    [Pattern] -> Pattern
list[Pattern
"OperationType", Pattern
colon_, Pattern
"NamedType"]],

  String -> [Pattern] -> Production
define String
"Description" [
    Pattern
"StringValue"],

  String -> [Pattern] -> Production
define String
"TypeDefinition" [
    String
"scalar"String -> Pattern -> Pattern
>: Pattern
"ScalarTypeDefinition",
    String
"object"String -> Pattern -> Pattern
>: Pattern
"ObjectTypeDefinition",
    String
"interface"String -> Pattern -> Pattern
>: Pattern
"InterfaceTypeDefinition",
    String
"union"String -> Pattern -> Pattern
>: Pattern
"UnionTypeDefinition",
    String
"enum"String -> Pattern -> Pattern
>: Pattern
"EnumTypeDefinition",
    String
"inputObject"String -> Pattern -> Pattern
>: Pattern
"InputObjectTypeDefinition"],

  String -> [Pattern] -> Production
define String
"TypeExtension" [
    String
"scalar"String -> Pattern -> Pattern
>: Pattern
"ScalarTypeExtension",
    String
"object"String -> Pattern -> Pattern
>: Pattern
"ObjectTypeExtension",
    String
"interface"String -> Pattern -> Pattern
>: Pattern
"InterfaceTypeExtension",
    String
"union"String -> Pattern -> Pattern
>: Pattern
"UnionTypeExtension",
    String
"enum"String -> Pattern -> Pattern
>: Pattern
"EnumTypeExtension",
    String
"inputObject"String -> Pattern -> Pattern
>: Pattern
"InputObjectTypeExtension"],

  String -> [Pattern] -> Production
define String
"ScalarTypeDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
scalar_, Pattern
"Name", Pattern
directivesConstOpt ]],

  String -> [Pattern] -> Production
define String
"ScalarTypeExtension" [
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
scalar_, Pattern
"Name", Pattern
directivesConst]],

  String -> [Pattern] -> Production
define String
"ObjectTypeDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
type_, Pattern
"Name", Pattern -> Pattern
optPattern
"ImplementsInterfaces", Pattern
directivesConstOpt, Pattern
"FieldsDefinition"],
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
type_, Pattern
"Name", Pattern -> Pattern
optPattern
"ImplementsInterfaces", Pattern
directivesConstOpt {- [lookahead != lcurly_] -}]],

  String -> [Pattern] -> Production
define String
"ObjectTypeExtension" [
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
type_, Pattern
"Name", Pattern -> Pattern
optPattern
"ImplementsInterfaces", Pattern
directivesConstOpt, Pattern
"FieldsDefinition"],
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
type_, Pattern
"Name", Pattern -> Pattern
optPattern
"ImplementsInterfaces", Pattern
directivesConstOpt {- [lookahead != lcurly_] -}],
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
type_, Pattern
"Name", Pattern
"ImplementsInterfaces" {- [lookahead != lcurly_] -}]],

  String -> [Pattern] -> Production
define String
"ImplementsInterfaces" [
    [Pattern] -> Pattern
list[Pattern
"ImplementsInterfaces", Pattern
and_, Pattern
"NamedType"],
    [Pattern] -> Pattern
list[Pattern
implements_, Pattern -> Pattern
opt(Pattern
and_), Pattern
"NamedType"]],

  String -> [Pattern] -> Production
define String
"FieldsDefinition" [
    [Pattern] -> Pattern
list[Pattern
lcurly_, Pattern -> Pattern
starPattern
"FieldDefinition", Pattern
rcurly_]],

  String -> [Pattern] -> Production
define String
"FieldDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
"Name", Pattern -> Pattern
optPattern
"ArgumentsDefinition", Pattern
colon_, Pattern
"Type", Pattern
directivesConstOpt]],

  String -> [Pattern] -> Production
define String
"ArgumentsDefinition" [
    [Pattern] -> Pattern
list[Pattern
lparen_, Pattern -> Pattern
starPattern
"InputValueDefinition", Pattern
rparen_]],

  String -> [Pattern] -> Production
define String
"InputValueDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
"Name", Pattern
colon_, Pattern
"Type", Pattern -> Pattern
optPattern
"DefaultValue", Pattern
directivesConstOpt]],

  String -> [Pattern] -> Production
define String
"InterfaceTypeDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
interface_, Pattern
"Name", Pattern -> Pattern
optPattern
"ImplementsInterfaces", Pattern
directivesConstOpt, Pattern
"FieldsDefinition"],
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
interface_, Pattern
"Name", Pattern
"ImplementsInterfaces", Pattern
directivesConstOpt {- [lookahead != lcurly_] -}]],

  String -> [Pattern] -> Production
define String
"InterfaceTypeExtension" [
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
interface_, Pattern
"Name", Pattern -> Pattern
optPattern
"ImplementsInterfaces", Pattern
directivesConstOpt, Pattern
"FieldsDefinition"],
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
interface_, Pattern
"Name", Pattern -> Pattern
optPattern
"ImplementsInterfaces", Pattern
directivesConst {- [lookahead != lcurly_] -}],
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
interface_, Pattern
"Name", Pattern
"ImplementsInterfaces" {- [lookahead != lcurly_] -}]],

  String -> [Pattern] -> Production
define String
"UnionTypeDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
union_, Pattern
"Name", Pattern
directivesConstOpt, Pattern -> Pattern
optPattern
"UnionMemberTypes"]],

  String -> [Pattern] -> Production
define String
"UnionMemberTypes" [
    [Pattern] -> Pattern
list[Pattern
"UnionMemberTypes", Pattern
or_, Pattern
"NamedType"],
    [Pattern] -> Pattern
list[Pattern -> Pattern
opt(Pattern
or_), Pattern
"NamedType"]],

  String -> [Pattern] -> Production
define String
"UnionTypeExtension" [
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
union_, Pattern
"Name", Pattern
directivesConstOpt, Pattern
"UnionMemberTypes"],
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
union_, Pattern
"Name", Pattern
directivesConst]],

  String -> [Pattern] -> Production
define String
"EnumTypeDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
enum_, Pattern
"Name", Pattern
directivesConstOpt, Pattern
"EnumValuesDefinition"],
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
enum_, Pattern
directivesConstOpt {- [lookahead != lcurly_] -}]],

  String -> [Pattern] -> Production
define String
"EnumValuesDefinition" [
    [Pattern] -> Pattern
list[Pattern
lcurly_, Pattern -> Pattern
starPattern
"EnumValueDefinition", Pattern
rcurly_]],

  String -> [Pattern] -> Production
define String
"EnumValueDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
"EnumValue", Pattern
directivesConstOpt]],

  String -> [Pattern] -> Production
define String
"EnumTypeExtension" [
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
enum_, Pattern
"Name", Pattern
directivesConstOpt, Pattern
"EnumValuesDefinition"],
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
enum_, Pattern
"Name", Pattern
directivesConst {- [lookahead != lcurly_] -}]],

  String -> [Pattern] -> Production
define String
"InputObjectTypeDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
input_, Pattern
"Name", Pattern
directivesConstOpt, Pattern
"InputFieldsDefinition"],
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
input_, Pattern
"Name", Pattern
directivesConstOpt {- [lookahead != lcurly_] -}]],

  String -> [Pattern] -> Production
define String
"InputFieldsDefinition" [
    [Pattern] -> Pattern
list[Pattern
lcurly_, Pattern -> Pattern
starPattern
"InputValueDefinition", Pattern
rcurly_]],

  String -> [Pattern] -> Production
define String
"InputObjectTypeExtension" [
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
input_, Pattern
"Name", Pattern
directivesConstOpt, Pattern
"InputFieldsDefinition"],
    [Pattern] -> Pattern
list[Pattern
extend_, Pattern
input_, Pattern
"Name", Pattern
directivesConst {- [lookahead != lcurly_] -}]],

  String -> [Pattern] -> Production
define String
"DirectiveDefinition" [
    [Pattern] -> Pattern
list[Pattern
descriptionOpt, Pattern
directive_, Pattern
at_, Pattern
"Name", Pattern -> Pattern
optPattern
"ArgumentsDefinition", Pattern -> Pattern
opt(Pattern
repeatable_), Pattern
on_, Pattern
"DirectiveLocations"]],

  String -> [Pattern] -> Production
define String
"DirectiveLocations" [
    [Pattern] -> Pattern
list[Pattern
"DirectiveLocations", Pattern
or_, Pattern
"DirectiveLocation"],
    [Pattern] -> Pattern
list[Pattern -> Pattern
opt(Pattern
or_), Pattern
"DirectiveLocation"]],

  String -> [Pattern] -> Production
define String
"DirectiveLocation" [
    String
"executable"String -> Pattern -> Pattern
>: Pattern
"ExecutableDirectiveLocation",
    String
"typeSystem"String -> Pattern -> Pattern
>: Pattern
"TypeSystemDirectiveLocation"],

  String -> [Pattern] -> Production
define String
"ExecutableDirectiveLocation" forall a b. (a -> b) -> a -> b
$ String -> Pattern
terminal forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [
    String
"QUERY",
    String
"MUTATION",
    String
"SUBSCRIPTION",
    String
"FIELD",
    String
"FRAGMENT_DEFINITION",
    String
"FRAGMENT_SPREAD",
    String
"INLINE_FRAGMENT",
    String
"VARIABLE_DEFINITION"],

  String -> [Pattern] -> Production
define String
"TypeSystemDirectiveLocation" forall a b. (a -> b) -> a -> b
$ String -> Pattern
terminal forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [
    String
"SCHEMA",
    String
"SCALAR",
    String
"OBJECT",
    String
"FIELD_DEFINITION",
    String
"ARGUMENT_DEFINITION",
    String
"INTERFACE",
    String
"UNION",
    String
"ENUM",
    String
"ENUM_VALUE",
    String
"INPUT_OBJECT",
    String
"INPUT_FIELD_DEFINITION"]]