@@ -561,6 +561,134 @@ struct ast_selector<input_object_type_extension>
561
561
{
562
562
};
563
563
564
+ template <typename _Rule>
565
+ struct ast_control
566
+ : normal<_Rule>
567
+ {
568
+ static const std::string error_message;
569
+
570
+ template <typename _Input, typename ... _States>
571
+ static void raise (const _Input& in, _States&&...)
572
+ {
573
+ throw parse_error (error_message, in);
574
+ }
575
+ };
576
+
577
+ template <> const std::string ast_control<bof>::error_message = " Expected beginning of file" ;
578
+ template <> const std::string ast_control<opt<utf8::bom>>::error_message = " Expected optional UTF8 byte-order-mark" ;
579
+ template <> const std::string ast_control<star<ignored>>::error_message = " Expected optional ignored characters" ;
580
+ template <> const std::string ast_control<plus<ignored>>::error_message = " Expected ignored characters" ;
581
+ template <> const std::string ast_control<until<ascii::eolf>>::error_message = " Expected Comment" ;
582
+ template <> const std::string ast_control<eof>::error_message = " Expected end of file" ;
583
+ template <> const std::string ast_control<list<definition, plus<ignored>>>::error_message = " Expected list of Definitions" ;
584
+ template <> const std::string ast_control<selection_set>::error_message = " Expected SelectionSet" ;
585
+ template <> const std::string ast_control<fragment_name>::error_message = " Expected FragmentName" ;
586
+ template <> const std::string ast_control<type_condition>::error_message = " Expected TypeCondition" ;
587
+ template <> const std::string ast_control<opt<seq<star<ignored>, directives>>>::error_message = " Expected optional Directives" ;
588
+ template <> const std::string ast_control<one<' {' >>::error_message = " Expected {" ;
589
+ template <> const std::string ast_control<list<root_operation_definition, plus<ignored>>>::error_message = " Expected RootOperationTypeDefinition" ;
590
+ template <> const std::string ast_control<one<' }' >>::error_message = " Expected }" ;
591
+ template <> const std::string ast_control<one<' @' >>::error_message = " Expected @" ;
592
+ template <> const std::string ast_control<directive_name>::error_message = " Expected Directive Name" ;
593
+ template <> const std::string ast_control<arguments_definition>::error_message = " Expected ArgumentsDefinition" ;
594
+ template <> const std::string ast_control<on_keyword>::error_message = " Expected \" on\" keyword" ;
595
+ template <> const std::string ast_control<directive_locations>::error_message = " Expected DirectiveLocations" ;
596
+ template <> const std::string ast_control<schema_extension>::error_message = " Expected SchemaExtension" ;
597
+ template <> const std::string ast_control<
598
+ seq<opt<seq<plus<ignored>, operation_name>>, opt<seq<star<ignored>, variable_definitions>>, opt<seq<star<ignored>, directives>>, star<ignored>, selection_set>>::error_message = " Expected OperationDefinition" ;
599
+ template <> const std::string ast_control<list<selection, plus<ignored>>>::error_message = " Expected Selections" ;
600
+ template <> const std::string ast_control<scalar_name>::error_message = " Expected ScalarType Name" ;
601
+ template <> const std::string ast_control<object_name>::error_message = " Expected ObjectType Name" ;
602
+ template <> const std::string ast_control<
603
+ sor<seq<opt<seq<plus<ignored>, implements_interfaces>>, opt<seq<star<ignored>, directives>>, seq<star<ignored>, fields_definition>>
604
+ , seq<opt<seq<plus<ignored>, implements_interfaces>>, seq<star<ignored>, directives>>
605
+ , opt<seq<plus<ignored>, implements_interfaces>>>>::error_message = " Expected ObjectTypeDefinition" ;
606
+ template <> const std::string ast_control<interface_name>::error_message = " Expected InterfaceType Name" ;
607
+ template <> const std::string ast_control<
608
+ sor<seq<opt<seq<star<ignored>, directives>>, seq<star<ignored>, fields_definition>>
609
+ , opt<seq<star<ignored>, directives>>>>::error_message = " Expected InterfaceTypeDefinition" ;
610
+ template <> const std::string ast_control<
611
+ sor<seq<opt<directives>, one<' {' >, star<ignored>, list<operation_type_definition, plus<ignored>>, star<ignored>, one<' }' >>
612
+ , directives>>::error_message = " Expected SchemaExtension" ;
613
+ template <> const std::string ast_control<union_name>::error_message = " Expected UnionType Name" ;
614
+ template <> const std::string ast_control<
615
+ sor<seq<opt<seq<star<ignored>, directives>>, seq<star<ignored>, union_member_types>>
616
+ , opt<seq<star<ignored>, directives>>>>::error_message = " Expected UnionTypeDefinition" ;
617
+ template <> const std::string ast_control<enum_name>::error_message = " Expected EnumType Name" ;
618
+ template <> const std::string ast_control<
619
+ sor<seq<opt<seq<star<ignored>, directives>>, seq<star<ignored>, enum_values_definition>>
620
+ , opt<seq<star<ignored>, directives>>>>::error_message = " Expected EnumTypeDefinition" ;
621
+ template <> const std::string ast_control<
622
+ sor<seq<opt<seq<star<ignored>, directives>>, seq<star<ignored>, input_fields_definition>>
623
+ , opt<seq<star<ignored>, directives>>>>::error_message = " Expected InputObjectTypeDefinition" ;
624
+ template <> const std::string ast_control<directives>::error_message = " Expected list of Directives" ;
625
+ template <> const std::string ast_control<
626
+ sor<seq<opt<seq<plus<ignored>, implements_interfaces>>, opt<seq<star<ignored>, directives>>, star<ignored>, fields_definition>
627
+ , seq<opt<seq<plus<ignored>, implements_interfaces>>, star<ignored>, directives>
628
+ , seq<plus<ignored>, implements_interfaces>>>::error_message = " Expected ObjectTypeExtension" ;
629
+ template <> const std::string ast_control<
630
+ sor<seq<opt<seq<directives, star<ignored>>>, fields_definition>
631
+ , directives>>::error_message = " Expected InterfaceTypeExtension" ;
632
+ template <> const std::string ast_control<
633
+ sor<seq<opt<seq<directives, star<ignored>>>, union_member_types>
634
+ , directives>>::error_message = " Expected UnionTypeExtension" ;
635
+ template <> const std::string ast_control<
636
+ sor<seq<opt<seq<directives, star<ignored>>>, enum_values_definition>
637
+ , directives>>::error_message = " Expected EnumTypeExtension" ;
638
+ template <> const std::string ast_control<
639
+ sor<seq<opt<seq<directives, star<ignored>>>, input_fields_definition>
640
+ , directives>>::error_message = " Expected InputObjectTypeExtension" ;
641
+ template <> const std::string ast_control<name>::error_message = " Expected Name" ;
642
+ template <> const std::string ast_control<named_type>::error_message = " Expected NamedType" ;
643
+ template <> const std::string ast_control<list<input_field_definition, plus<ignored>>>::error_message = " Expected InputValueDefinitions" ;
644
+ template <> const std::string ast_control<one<' )' >>::error_message = " Expected )" ;
645
+ template <> const std::string ast_control<one<' :' >>::error_message = " Expected :" ;
646
+ template <> const std::string ast_control<
647
+ sor<executable_directive_location
648
+ , type_system_directive_location>>::error_message = " Expected DirectiveLocation" ;
649
+ template <> const std::string ast_control<opt<seq<star<ignored>, arguments>>>::error_message = " Expected optional Arguments" ;
650
+ template <> const std::string ast_control<block_quote_token>::error_message = " Expected \"\"\" " ;
651
+ template <> const std::string ast_control<quote_token>::error_message = " Expected \" " ;
652
+ template <> const std::string ast_control<
653
+ sor<seq<opt<seq<star<ignored>, arguments>>, opt<seq<star<ignored>, directives>>, seq<star<ignored>, selection_set>>
654
+ , seq<opt<seq<star<ignored>, arguments>>, seq<star<ignored>, directives>>
655
+ , opt<seq<star<ignored>, arguments>>>>::error_message = " Expected Field" ;
656
+ template <> const std::string ast_control<type_name>::error_message = " Expected Type" ;
657
+ template <> const std::string ast_control<
658
+ sor<seq<opt<seq<star<ignored>, default_value>>, seq<star<ignored>, directives>>
659
+ , opt<seq<star<ignored>, default_value>>>>::error_message = " Expected InputValueDefinition" ;
660
+ template <> const std::string ast_control<list<field_definition, plus<ignored>>>::error_message = " Expected FieldsDefinitions" ;
661
+ template <> const std::string ast_control<opt<seq<star<ignored>, one<' &' >>>>::error_message = " Expected optional '&'" ;
662
+ template <> const std::string ast_control<list<interface_type, seq<star<ignored>, one<' &' >, star<ignored>>>>::error_message = " Expected ImplementsInterfaces" ;
663
+ template <> const std::string ast_control<opt<seq<star<ignored>, one<' |' >>>>::error_message = " Expected optional '|'" ;
664
+ template <> const std::string ast_control<list<union_type, seq<star<ignored>, one<' |' >, star<ignored>>>>::error_message = " Expected UnionMemberTypes" ;
665
+ template <> const std::string ast_control<list<enum_value_definition, plus<ignored>>>::error_message = " Expected EnumValuesDefinition" ;
666
+ template <> const std::string ast_control<star<sor<block_escape_sequence, block_quote_character>>>::error_message = " Expected optional BlockStringCharacters" ;
667
+ template <> const std::string ast_control<star<sor<string_escape_sequence, string_quote_character>>>::error_message = " Expected optional StringCharacters" ;
668
+ template <> const std::string ast_control<sor<nonnull_type, list_type, named_type>>::error_message = " Expected Type" ;
669
+ template <> const std::string ast_control<opt<seq<star<ignored>, default_value>>>::error_message = " Expected optional DefaultValue" ;
670
+ template <> const std::string ast_control<list<variable, plus<ignored>>>::error_message = " Expected VariableDefinitions" ;
671
+ template <> const std::string ast_control<opt<seq<star<ignored>, arguments_definition>>>::error_message = " Expected optional ArgumentsDefinition" ;
672
+ template <> const std::string ast_control<list<argument, plus<ignored>>>::error_message = " Expected Arguments" ;
673
+ template <> const std::string ast_control<one<' ]' >>::error_message = " Expected ]" ;
674
+ template <> const std::string ast_control<sor<escaped_unicode, escaped_char>>::error_message = " Expected EscapeSequence" ;
675
+ template <> const std::string ast_control<input_value>::error_message = " Expected Value" ;
676
+ template <> const std::string ast_control<
677
+ sor<list_value
678
+ , object_value
679
+ , variable_value
680
+ , integer_value
681
+ , float_value
682
+ , string_value
683
+ , bool_value
684
+ , null_keyword
685
+ , enum_value>>::error_message = " Expected Value" ;
686
+ template <> const std::string ast_control<rep<4 , xdigit>>::error_message = " Expected EscapedUnicode" ;
687
+ template <> const std::string ast_control<opt<list<list_entry, plus<ignored>>>>::error_message = " Expected optional ListValues" ;
688
+ template <> const std::string ast_control<opt<list<object_field, plus<ignored>>>>::error_message = " Expected optional ObjectValues" ;
689
+ template <> const std::string ast_control<plus<digit>>::error_message = " Expected Digits" ;
690
+ template <> const std::string ast_control<opt<sign>>::error_message = " Expected optional Sign" ;
691
+
564
692
std::unique_ptr<ast<std::string>> parseString (std::string&& input)
565
693
{
566
694
std::unique_ptr<ast<std::string>> result (new ast<std::string> { std::move (input), nullptr });
0 commit comments