Documentation ¶
Overview ¶
Package astparser is used to turn raw GraphQL documents into an AST.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseGraphqlDocumentBytes ¶
func ParseGraphqlDocumentBytes(input []byte) (ast.Document, operationreport.Report)
ParseGraphqlDocumentBytes takes a raw GraphQL document in byte slice format and parses it into an AST. This function creates a new parser as well as a new AST for every call. Therefore you shouldn't use this function in a hot path. Instead create a parser as well as AST objects and re-use them.
func ParseGraphqlDocumentString ¶
func ParseGraphqlDocumentString(input string) (ast.Document, operationreport.Report)
ParseGraphqlDocumentString takes a raw GraphQL document in string format and parses it into an AST. This function creates a new parser as well as a new AST for every call. Therefore you shouldn't use this function in a hot path. Instead create a parser as well as AST objects and re-use them.
Types ¶
type ErrUnexpectedIdentKey ¶
type ErrUnexpectedIdentKey struct {
// contains filtered or unexported fields
}
ErrUnexpectedIdentKey is a custom error object to properly render an unexpected ident key error
func (ErrUnexpectedIdentKey) Error ¶
func (e ErrUnexpectedIdentKey) Error() string
type ErrUnexpectedToken ¶
type ErrUnexpectedToken struct {
// contains filtered or unexported fields
}
ErrUnexpectedToken is a custom error object containing all necessary information to properly render an unexpected token error
func (ErrUnexpectedToken) Error ¶
func (e ErrUnexpectedToken) Error() string
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser takes a raw input and turns it into an AST use NewParser() to create a parser Don't create new parsers in the hot path, re-use them.
func NewParser ¶
func NewParser() *Parser
NewParser returns a new parser with all values properly initialized
func (*Parser) Parse ¶
func (p *Parser) Parse(document *ast.Document, report *operationreport.Report)
Parse parses all input in a Document.Input into the Document
func (*Parser) ParseValue ¶
func (*Parser) PrepareImport ¶
func (p *Parser) PrepareImport(document *ast.Document, report *operationreport.Report)
PrepareImport prepares the Parser for importing new Nodes into an AST without directly parsing the content
type Tokenizer ¶
type Tokenizer struct {
// contains filtered or unexported fields
}
Tokenizer takes a raw input and turns it into set of tokens
func (*Tokenizer) Peek ¶
Peek - returns token next to currentToken if hasNextToken otherwise returns keyword.EOF