예제 #1
0
파일: parser.go 프로젝트: theplant/graphql
func init() {
	name = parsec.Maybe(identFn, parsec.Ident())

	// missing `fragment spread`, `inline fragment`
	selection := parsec.OrdChoice(extract(0), field())
	selectionSet = parsec.And(extract(1), parsec.Token(`{`, ""), parsec.Many(fieldArrayify, selection), parsec.Token(`}`, ""))

	// missing `fragment definition`, `type definition`
	definition := operationDefinition()
	document := parsec.OrdChoice(extract(0), parsec.Maybe(shorthandQueryify, selectionSet), parsec.Many(fieldArrayify, definition))

	y = document
}
예제 #2
0
파일: parser.go 프로젝트: theplant/graphql
func value() parsec.Parser {
	//   Variable (not implemented)
	//   IntValue
	//   FloatValue (not implemented)
	//   StringValue
	//   BooleanValue (not implemented)
	//   EnumValue (not implemented)
	//   ListValueConst (not implemented)
	//   ObjectValueConst (not implemented)
	return parsec.OrdChoice(valueify, parsec.Int(), parsec.String())
}
예제 #3
0
파일: parser.go 프로젝트: theplant/graphql
func operationDefinition() parsec.Parser {
	operationType := parsec.OrdChoice(extract(0), parsec.Token(`query`, "OP_TYPE_QUERY"), parsec.Token(`mutation`, "OP_TYPE_MUTATION"))

	// missing `variable definitions`, `directives`
	return sequence(operationDefinitionify, &operationType, &name, &selectionSet)
}