PHP 클래스 GraphQL\Language\Parser

파일 보기 프로젝트 열기: webonyx/graphql-php 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( Source $source, array $options = [] ) Parser constructor.
any ( integer $openKind, callable $parseFn, integer $closeKind ) : array Returns a possibly empty list of parse nodes, determined by the parseFn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token.
expect ( string $kind ) : Token If the next token is of the given kind, return that token after advancing the parser. Otherwise, do not change the parser state and return false.
expectKeyword ( string $value ) : Token If the next token is a keyword with the given value, return that token after advancing the parser. Otherwise, do not change the parser state and return false.
loc ( Token $startToken ) : Location | null Returns a location object, used to identify the place in the source that created a given parsed object.
many ( $openKind, $parseFn, $closeKind ) : array Returns a non-empty list of parse nodes, determined by the parseFn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token.
parse ( Source | string $source, array $options = [] ) : DocumentNode Available options:
parseArgument ( ) : ArgumentNode
parseArgumentDefs ( ) : InputValueDefinitionNode[]
parseArguments ( ) : ArgumentNode[]
parseArray ( boolean $isConst ) : ListValueNode
parseConstValue ( ) : BooleanValueNode | EnumValueNode | FloatValueNode | IntValueNode | StringValueNode | VariableNode
parseDefinition ( ) : OperationDefinitionNode | FragmentDefinitionNode | GraphQL\Language\AST\TypeSystemDefinitionNode
parseDirective ( ) : DirectiveNode
parseDirectiveDefinition ( ) : DirectiveDefinitionNode DirectiveDefinition : - directive @ Name ArgumentsDefinition? on DirectiveLocations
parseDirectiveLocations ( ) : NameNode[]
parseDirectives ( ) : DirectiveNode[]
parseDocument ( ) : DocumentNode Implements the parsing rules in the Document section.
parseEnumTypeDefinition ( ) : EnumTypeDefinitionNode
parseEnumValueDefinition ( ) : EnumValueDefinitionNode
parseField ( ) : FieldNode
parseFieldDefinition ( ) : FieldDefinitionNode
parseFragment ( ) : FragmentSpreadNode | InlineFragmentNode
parseFragmentDefinition ( ) : FragmentDefinitionNode
parseFragmentName ( ) : NameNode
parseImplementsInterfaces ( ) : NamedTypeNode[]
parseInputObjectTypeDefinition ( ) : InputObjectTypeDefinitionNode
parseInputValueDef ( ) : InputValueDefinitionNode
parseInterfaceTypeDefinition ( ) : InterfaceTypeDefinitionNode
parseName ( ) : NameNode Converts a name lex token into a name parse node.
parseNamedType ( )
parseObject ( $isConst ) : ObjectValueNode
parseObjectField ( $isConst ) : ObjectFieldNode
parseObjectTypeDefinition ( ) : ObjectTypeDefinitionNode
parseOperationDefinition ( ) : OperationDefinitionNode
parseOperationType ( ) : string
parseOperationTypeDefinition ( ) : OperationTypeDefinitionNode
parseScalarTypeDefinition ( ) : ScalarTypeDefinitionNode
parseSchemaDefinition ( ) : SchemaDefinitionNode
parseSelection ( ) : mixed Selection : - Field - FragmentSpread - InlineFragment
parseSelectionSet ( ) : SelectionSetNode
parseType ( Source | string $source, array $options = [] ) : ListTypeNode | NameNode | NonNullTypeNode Given a string containing a GraphQL Type (ex. [Int!]), parse the AST for that type.
parseTypeExtensionDefinition ( ) : TypeExtensionDefinitionNode
parseTypeReference ( ) : ListTypeNode | NameNode | NonNullTypeNode Handles the Type: TypeName, ListType, and NonNullType parsing rules.
parseTypeSystemDefinition ( ) : GraphQL\Language\AST\TypeSystemDefinitionNode TypeSystemDefinition : - SchemaDefinition - TypeDefinition - TypeExtensionDefinition - DirectiveDefinition
parseUnionMembers ( ) : NamedTypeNode[] UnionMembers : - NamedType - UnionMembers | NamedType
parseUnionTypeDefinition ( ) : UnionTypeDefinitionNode
parseValue ( Source | string $source, array $options = [] ) : BooleanValueNode | EnumValueNode | FloatValueNode | IntValueNode | ListValueNode | ObjectValueNode | StringValueNode | VariableNode Given a string containing a GraphQL value (ex. [42]), parse the AST for that value.
parseValueLiteral ( $isConst ) : BooleanValueNode | EnumValueNode | FloatValueNode | IntValueNode | StringValueNode | VariableNode | ListValueNode | ObjectValueNode | NullValueNode Value[Const] : - [~Const] Variable - IntValue - FloatValue - StringValue - BooleanValue - NullValue - EnumValue - ListValue[?Const] - ObjectValue[?Const]
parseVariable ( ) : VariableNode
parseVariableDefinition ( ) : VariableDefinitionNode
parseVariableDefinitions ( ) : VariableDefinitionNode[]
parseVariableValue ( ) : BooleanValueNode | EnumValueNode | FloatValueNode | IntValueNode | ListValueNode | ObjectValueNode | StringValueNode | VariableNode
peek ( $kind ) : boolean Determines if the next token is of a given kind
skip ( $kind ) : boolean If the next token is of the given kind, return true after advancing the parser. Otherwise, do not change the parser state and return false.
unexpected ( Token $atToken = null ) : SyntaxError

메소드 상세

__construct() 공개 메소드

Parser constructor.
public __construct ( Source $source, array $options = [] )
$source Source
$options array

any() 공개 메소드

Returns a possibly empty list of parse nodes, determined by the parseFn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token.
public any ( integer $openKind, callable $parseFn, integer $closeKind ) : array
$openKind integer
$parseFn callable
$closeKind integer
리턴 array

expect() 공개 메소드

If the next token is of the given kind, return that token after advancing the parser. Otherwise, do not change the parser state and return false.
public expect ( string $kind ) : Token
$kind string
리턴 Token

expectKeyword() 공개 메소드

If the next token is a keyword with the given value, return that token after advancing the parser. Otherwise, do not change the parser state and return false.
public expectKeyword ( string $value ) : Token
$value string
리턴 Token

loc() 공개 메소드

Returns a location object, used to identify the place in the source that created a given parsed object.
public loc ( Token $startToken ) : Location | null
$startToken Token
리턴 GraphQL\Language\AST\Location | null

many() 공개 메소드

Returns a non-empty list of parse nodes, determined by the parseFn. This list begins with a lex token of openKind and ends with a lex token of closeKind. Advances the parser to the next lex token after the closing token.
public many ( $openKind, $parseFn, $closeKind ) : array
$openKind
$parseFn
$closeKind
리턴 array

parse() 공개 정적인 메소드

noLocation: boolean, (By default, the parser creates AST nodes that know the location in the source that they correspond to. This configuration flag disables that behavior for performance or testing.)
public static parse ( Source | string $source, array $options = [] ) : DocumentNode
$source Source | string
$options array
리턴 GraphQL\Language\AST\DocumentNode

parseArgument() 공개 메소드

public parseArgument ( ) : ArgumentNode
리턴 GraphQL\Language\AST\ArgumentNode

parseArgumentDefs() 공개 메소드

public parseArgumentDefs ( ) : InputValueDefinitionNode[]
리턴 GraphQL\Language\AST\InputValueDefinitionNode[]

parseArguments() 공개 메소드

public parseArguments ( ) : ArgumentNode[]
리턴 GraphQL\Language\AST\ArgumentNode[]

parseArray() 공개 메소드

public parseArray ( boolean $isConst ) : ListValueNode
$isConst boolean
리턴 GraphQL\Language\AST\ListValueNode

parseConstValue() 공개 메소드

public parseConstValue ( ) : BooleanValueNode | EnumValueNode | FloatValueNode | IntValueNode | StringValueNode | VariableNode
리턴 GraphQL\Language\AST\BooleanValueNode | GraphQL\Language\AST\EnumValueNode | GraphQL\Language\AST\FloatValueNode | GraphQL\Language\AST\IntValueNode | GraphQL\Language\AST\StringValueNode | GraphQL\Language\AST\VariableNode

parseDefinition() 공개 메소드

public parseDefinition ( ) : OperationDefinitionNode | FragmentDefinitionNode | GraphQL\Language\AST\TypeSystemDefinitionNode
리턴 GraphQL\Language\AST\OperationDefinitionNode | GraphQL\Language\AST\FragmentDefinitionNode | GraphQL\Language\AST\TypeSystemDefinitionNode

parseDirective() 공개 메소드

public parseDirective ( ) : DirectiveNode
리턴 GraphQL\Language\AST\DirectiveNode

parseDirectiveDefinition() 공개 메소드

DirectiveDefinition : - directive @ Name ArgumentsDefinition? on DirectiveLocations
public parseDirectiveDefinition ( ) : DirectiveDefinitionNode
리턴 GraphQL\Language\AST\DirectiveDefinitionNode

parseDirectiveLocations() 공개 메소드

public parseDirectiveLocations ( ) : NameNode[]
리턴 GraphQL\Language\AST\NameNode[]

parseDirectives() 공개 메소드

public parseDirectives ( ) : DirectiveNode[]
리턴 GraphQL\Language\AST\DirectiveNode[]

parseDocument() 공개 메소드

Implements the parsing rules in the Document section.
public parseDocument ( ) : DocumentNode
리턴 GraphQL\Language\AST\DocumentNode

parseEnumTypeDefinition() 공개 메소드

public parseEnumTypeDefinition ( ) : EnumTypeDefinitionNode
리턴 GraphQL\Language\AST\EnumTypeDefinitionNode

parseEnumValueDefinition() 공개 메소드

public parseEnumValueDefinition ( ) : EnumValueDefinitionNode
리턴 GraphQL\Language\AST\EnumValueDefinitionNode

parseField() 공개 메소드

public parseField ( ) : FieldNode
리턴 GraphQL\Language\AST\FieldNode

parseFieldDefinition() 공개 메소드

public parseFieldDefinition ( ) : FieldDefinitionNode
리턴 GraphQL\Language\AST\FieldDefinitionNode

parseFragment() 공개 메소드

public parseFragment ( ) : FragmentSpreadNode | InlineFragmentNode
리턴 GraphQL\Language\AST\FragmentSpreadNode | GraphQL\Language\AST\InlineFragmentNode

parseFragmentDefinition() 공개 메소드

public parseFragmentDefinition ( ) : FragmentDefinitionNode
리턴 GraphQL\Language\AST\FragmentDefinitionNode

parseFragmentName() 공개 메소드

public parseFragmentName ( ) : NameNode
리턴 GraphQL\Language\AST\NameNode

parseImplementsInterfaces() 공개 메소드

public parseImplementsInterfaces ( ) : NamedTypeNode[]
리턴 GraphQL\Language\AST\NamedTypeNode[]

parseInputObjectTypeDefinition() 공개 메소드

public parseInputObjectTypeDefinition ( ) : InputObjectTypeDefinitionNode
리턴 GraphQL\Language\AST\InputObjectTypeDefinitionNode

parseInputValueDef() 공개 메소드

public parseInputValueDef ( ) : InputValueDefinitionNode
리턴 GraphQL\Language\AST\InputValueDefinitionNode

parseInterfaceTypeDefinition() 공개 메소드

public parseInterfaceTypeDefinition ( ) : InterfaceTypeDefinitionNode
리턴 GraphQL\Language\AST\InterfaceTypeDefinitionNode

parseName() 공개 메소드

Converts a name lex token into a name parse node.
public parseName ( ) : NameNode
리턴 GraphQL\Language\AST\NameNode

parseNamedType() 공개 메소드

public parseNamedType ( )

parseObject() 공개 메소드

public parseObject ( $isConst ) : ObjectValueNode
$isConst
리턴 GraphQL\Language\AST\ObjectValueNode

parseObjectField() 공개 메소드

public parseObjectField ( $isConst ) : ObjectFieldNode
$isConst
리턴 GraphQL\Language\AST\ObjectFieldNode

parseObjectTypeDefinition() 공개 메소드

public parseObjectTypeDefinition ( ) : ObjectTypeDefinitionNode
리턴 GraphQL\Language\AST\ObjectTypeDefinitionNode

parseOperationDefinition() 공개 메소드

public parseOperationDefinition ( ) : OperationDefinitionNode
리턴 GraphQL\Language\AST\OperationDefinitionNode

parseOperationType() 공개 메소드

public parseOperationType ( ) : string
리턴 string

parseOperationTypeDefinition() 공개 메소드

public parseOperationTypeDefinition ( ) : OperationTypeDefinitionNode
리턴 GraphQL\Language\AST\OperationTypeDefinitionNode

parseScalarTypeDefinition() 공개 메소드

public parseScalarTypeDefinition ( ) : ScalarTypeDefinitionNode
리턴 GraphQL\Language\AST\ScalarTypeDefinitionNode

parseSchemaDefinition() 공개 메소드

public parseSchemaDefinition ( ) : SchemaDefinitionNode
리턴 GraphQL\Language\AST\SchemaDefinitionNode

parseSelection() 공개 메소드

Selection : - Field - FragmentSpread - InlineFragment
public parseSelection ( ) : mixed
리턴 mixed

parseSelectionSet() 공개 메소드

public parseSelectionSet ( ) : SelectionSetNode
리턴 GraphQL\Language\AST\SelectionSetNode

parseType() 공개 정적인 메소드

Throws GraphQLError if a syntax error is encountered. This is useful within tools that operate upon GraphQL Types directly and in isolation of complete GraphQL documents. Consider providing the results to the utility function: typeFromAST().
public static parseType ( Source | string $source, array $options = [] ) : ListTypeNode | NameNode | NonNullTypeNode
$source Source | string
$options array
리턴 GraphQL\Language\AST\ListTypeNode | GraphQL\Language\AST\NameNode | GraphQL\Language\AST\NonNullTypeNode

parseTypeExtensionDefinition() 공개 메소드

public parseTypeExtensionDefinition ( ) : TypeExtensionDefinitionNode
리턴 GraphQL\Language\AST\TypeExtensionDefinitionNode

parseTypeReference() 공개 메소드

Handles the Type: TypeName, ListType, and NonNullType parsing rules.
public parseTypeReference ( ) : ListTypeNode | NameNode | NonNullTypeNode
리턴 GraphQL\Language\AST\ListTypeNode | GraphQL\Language\AST\NameNode | GraphQL\Language\AST\NonNullTypeNode

parseTypeSystemDefinition() 공개 메소드

TypeDefinition : - ScalarTypeDefinition - ObjectTypeDefinition - InterfaceTypeDefinition - UnionTypeDefinition - EnumTypeDefinition - InputObjectTypeDefinition
public parseTypeSystemDefinition ( ) : GraphQL\Language\AST\TypeSystemDefinitionNode
리턴 GraphQL\Language\AST\TypeSystemDefinitionNode

parseUnionMembers() 공개 메소드

UnionMembers : - NamedType - UnionMembers | NamedType
public parseUnionMembers ( ) : NamedTypeNode[]
리턴 GraphQL\Language\AST\NamedTypeNode[]

parseUnionTypeDefinition() 공개 메소드

public parseUnionTypeDefinition ( ) : UnionTypeDefinitionNode
리턴 GraphQL\Language\AST\UnionTypeDefinitionNode

parseValue() 공개 정적인 메소드

Throws GraphQLError if a syntax error is encountered. This is useful within tools that operate upon GraphQL Values directly and in isolation of complete GraphQL documents. Consider providing the results to the utility function: valueFromAST().
public static parseValue ( Source | string $source, array $options = [] ) : BooleanValueNode | EnumValueNode | FloatValueNode | IntValueNode | ListValueNode | ObjectValueNode | StringValueNode | VariableNode
$source Source | string
$options array
리턴 GraphQL\Language\AST\BooleanValueNode | GraphQL\Language\AST\EnumValueNode | GraphQL\Language\AST\FloatValueNode | GraphQL\Language\AST\IntValueNode | GraphQL\Language\AST\ListValueNode | GraphQL\Language\AST\ObjectValueNode | GraphQL\Language\AST\StringValueNode | GraphQL\Language\AST\VariableNode

parseValueLiteral() 공개 메소드

BooleanValue : one of true false NullValue : null EnumValue : Name but not true, false or null
public parseValueLiteral ( $isConst ) : BooleanValueNode | EnumValueNode | FloatValueNode | IntValueNode | StringValueNode | VariableNode | ListValueNode | ObjectValueNode | NullValueNode
$isConst
리턴 GraphQL\Language\AST\BooleanValueNode | GraphQL\Language\AST\EnumValueNode | GraphQL\Language\AST\FloatValueNode | GraphQL\Language\AST\IntValueNode | GraphQL\Language\AST\StringValueNode | GraphQL\Language\AST\VariableNode | GraphQL\Language\AST\ListValueNode | GraphQL\Language\AST\ObjectValueNode | GraphQL\Language\AST\NullValueNode

parseVariable() 공개 메소드

public parseVariable ( ) : VariableNode
리턴 GraphQL\Language\AST\VariableNode

parseVariableDefinition() 공개 메소드

public parseVariableDefinition ( ) : VariableDefinitionNode
리턴 GraphQL\Language\AST\VariableDefinitionNode

parseVariableDefinitions() 공개 메소드

public parseVariableDefinitions ( ) : VariableDefinitionNode[]
리턴 GraphQL\Language\AST\VariableDefinitionNode[]

parseVariableValue() 공개 메소드

public parseVariableValue ( ) : BooleanValueNode | EnumValueNode | FloatValueNode | IntValueNode | ListValueNode | ObjectValueNode | StringValueNode | VariableNode
리턴 GraphQL\Language\AST\BooleanValueNode | GraphQL\Language\AST\EnumValueNode | GraphQL\Language\AST\FloatValueNode | GraphQL\Language\AST\IntValueNode | GraphQL\Language\AST\ListValueNode | GraphQL\Language\AST\ObjectValueNode | GraphQL\Language\AST\StringValueNode | GraphQL\Language\AST\VariableNode

peek() 공개 메소드

Determines if the next token is of a given kind
public peek ( $kind ) : boolean
$kind
리턴 boolean

skip() 공개 메소드

If the next token is of the given kind, return true after advancing the parser. Otherwise, do not change the parser state and return false.
public skip ( $kind ) : boolean
$kind
리턴 boolean

unexpected() 공개 메소드

public unexpected ( Token $atToken = null ) : SyntaxError
$atToken Token
리턴 GraphQL\Error\SyntaxError