@@ -106,7 +106,7 @@ typedef struct id_table {
106106 struct id_table * next ;
107107} id_table ;
108108
109- const rbs_type_validation_t SkipValidation = {
109+ const rbs_type_parsing_option_t SkipValidation = {
110110 .no_void = false,
111111 .no_void_allowed_here = false,
112112 .no_self = false,
@@ -127,8 +127,8 @@ static rbs_location_t *rbs_location_current_token(rbs_parser_t *parser) {
127127 return rbs_location_new (ALLOCATOR (), parser -> current_token .range );
128128}
129129
130- static bool parse_optional (rbs_parser_t * parser , rbs_node_t * * optional , rbs_type_validation_t validation );
131- static bool parse_simple (rbs_parser_t * parser , rbs_node_t * * type , rbs_type_validation_t validation );
130+ static bool parse_optional (rbs_parser_t * parser , rbs_node_t * * optional , rbs_type_parsing_option_t validation );
131+ static bool parse_simple (rbs_parser_t * parser , rbs_node_t * * type , rbs_type_parsing_option_t validation );
132132
133133/**
134134 * @returns A borrowed copy of the current token, which does *not* need to be freed.
@@ -251,7 +251,7 @@ error_handling: {
251251 | {} type `,` ... `,` <type> eol
252252*/
253253NODISCARD
254- static bool parse_type_list (rbs_parser_t * parser , enum RBSTokenType eol , rbs_node_list_t * types , rbs_type_validation_t validation ) {
254+ static bool parse_type_list (rbs_parser_t * parser , enum RBSTokenType eol , rbs_node_list_t * types , rbs_type_parsing_option_t validation ) {
255255 while (true) {
256256 rbs_node_t * type ;
257257 CHECK_PARSE (rbs_parse_type (parser , & type , validation ));
@@ -296,7 +296,7 @@ static bool is_keyword_token(enum RBSTokenType type) {
296296 | {} type <param>
297297*/
298298NODISCARD
299- static bool parse_function_param (rbs_parser_t * parser , rbs_types_function_param_t * * function_param , rbs_type_validation_t validation ) {
299+ static bool parse_function_param (rbs_parser_t * parser , rbs_types_function_param_t * * function_param , rbs_type_parsing_option_t validation ) {
300300 rbs_range_t type_range ;
301301 type_range .start = parser -> next_token .range .start ;
302302 rbs_node_t * type ;
@@ -464,7 +464,7 @@ static bool parser_advance_if(rbs_parser_t *parser, enum RBSTokenType type) {
464464 | {} `**` <function_param>
465465*/
466466NODISCARD
467- static bool parse_params (rbs_parser_t * parser , method_params * params , rbs_type_validation_t validation ) {
467+ static bool parse_params (rbs_parser_t * parser , method_params * params , rbs_type_parsing_option_t validation ) {
468468 if (parser -> next_token .type == pQUESTION && parser -> next_token2 .type == pRPAREN ) {
469469 params -> required_positionals = NULL ;
470470 rbs_parser_advance (parser );
@@ -630,7 +630,7 @@ static bool parse_params(rbs_parser_t *parser, method_params *params, rbs_type_v
630630 | {} simple_type <`?`>
631631*/
632632NODISCARD
633- static bool parse_optional (rbs_parser_t * parser , rbs_node_t * * optional , rbs_type_validation_t validation ) {
633+ static bool parse_optional (rbs_parser_t * parser , rbs_node_t * * optional , rbs_type_parsing_option_t validation ) {
634634 rbs_range_t rg ;
635635 rg .start = parser -> next_token .range .start ;
636636
@@ -666,7 +666,7 @@ static void initialize_method_params(method_params *params, rbs_allocator_t *all
666666 | {} `[` `self` `:` type <`]`>
667667*/
668668NODISCARD
669- static bool parse_self_type_binding (rbs_parser_t * parser , rbs_node_t * * self_type , rbs_type_validation_t validation ) {
669+ static bool parse_self_type_binding (rbs_parser_t * parser , rbs_node_t * * self_type , rbs_type_parsing_option_t validation ) {
670670 if (parser -> next_token .type == pLBRACKET ) {
671671 rbs_parser_advance (parser );
672672 ADVANCE_ASSERT (parser , kSELF );
@@ -694,13 +694,13 @@ typedef struct {
694694 | {} self_type_binding? `->` <optional>
695695*/
696696NODISCARD
697- static bool parse_function (rbs_parser_t * parser , bool accept_type_binding , parse_function_result * * result , rbs_type_validation_t validation ) {
697+ static bool parse_function (rbs_parser_t * parser , bool accept_type_binding , parse_function_result * * result , rbs_type_parsing_option_t validation ) {
698698 rbs_node_t * function = NULL ;
699699 rbs_types_block_t * block = NULL ;
700700 rbs_node_t * function_self_type = NULL ;
701701 rbs_range_t function_range ;
702702 function_range .start = parser -> current_token .range .start ;
703- rbs_type_validation_t no_void_allowed_here = validation ;
703+ rbs_type_parsing_option_t no_void_allowed_here = validation ;
704704 no_void_allowed_here .no_void_allowed_here = true;
705705
706706 method_params params ;
@@ -814,7 +814,7 @@ static bool parse_function(rbs_parser_t *parser, bool accept_type_binding, parse
814814 proc_type ::= {`^`} <function>
815815*/
816816NODISCARD
817- static bool parse_proc_type (rbs_parser_t * parser , rbs_types_proc_t * * proc , rbs_type_validation_t validation ) {
817+ static bool parse_proc_type (rbs_parser_t * parser , rbs_types_proc_t * * proc , rbs_type_parsing_option_t validation ) {
818818 rbs_position_t start = parser -> current_token .range .start ;
819819 parse_function_result * result = rbs_allocator_alloc (ALLOCATOR (), parse_function_result );
820820 CHECK_PARSE (parse_function (parser , true, & result , validation ));
@@ -842,7 +842,7 @@ static void check_key_duplication(rbs_parser_t *parser, rbs_hash_t *fields, rbs_
842842 | {} literal_type `=>` <type>
843843*/
844844NODISCARD
845- static bool parse_record_attributes (rbs_parser_t * parser , rbs_hash_t * * fields , rbs_type_validation_t validation ) {
845+ static bool parse_record_attributes (rbs_parser_t * parser , rbs_hash_t * * fields , rbs_type_parsing_option_t validation ) {
846846 * fields = rbs_hash_new (ALLOCATOR ());
847847
848848 if (parser -> next_token .type == pRBRACE ) return true;
@@ -999,7 +999,7 @@ static bool parse_instance_type(rbs_parser_t *parser, bool parse_alias, rbs_node
999999 if (parser -> next_token .type == pLBRACKET ) {
10001000 rbs_parser_advance (parser );
10011001 args_range .start = parser -> current_token .range .start ;
1002- rbs_type_validation_t no_void_allowed_here = {
1002+ rbs_type_parsing_option_t no_void_allowed_here = {
10031003 .no_void = false,
10041004 .no_void_allowed_here = true,
10051005 .no_self = false,
@@ -1092,7 +1092,7 @@ static bool parser_typevar_member(rbs_parser_t *parser, rbs_constant_id_t id) {
10921092 | {} `^` <function>
10931093*/
10941094NODISCARD
1095- static bool parse_simple (rbs_parser_t * parser , rbs_node_t * * type , rbs_type_validation_t validation ) {
1095+ static bool parse_simple (rbs_parser_t * parser , rbs_node_t * * type , rbs_type_parsing_option_t validation ) {
10961096 rbs_parser_advance (parser );
10971097
10981098 if (parser -> current_token .type != kVOID ) {
@@ -1289,7 +1289,7 @@ static bool parse_simple(rbs_parser_t *parser, rbs_node_t **type, rbs_type_valid
12891289 | {} <optional>
12901290*/
12911291NODISCARD
1292- static bool parse_intersection (rbs_parser_t * parser , rbs_node_t * * type , rbs_type_validation_t validation ) {
1292+ static bool parse_intersection (rbs_parser_t * parser , rbs_node_t * * type , rbs_type_parsing_option_t validation ) {
12931293 rbs_range_t rg ;
12941294 rg .start = parser -> next_token .range .start ;
12951295
@@ -1321,7 +1321,7 @@ static bool parse_intersection(rbs_parser_t *parser, rbs_node_t **type, rbs_type
13211321 union ::= {} intersection '|' ... '|' <intersection>
13221322 | {} <intersection>
13231323*/
1324- bool rbs_parse_type (rbs_parser_t * parser , rbs_node_t * * type , rbs_type_validation_t validation ) {
1324+ bool rbs_parse_type (rbs_parser_t * parser , rbs_node_t * * type , rbs_type_parsing_option_t validation ) {
13251325 rbs_range_t rg ;
13261326 rg .start = parser -> next_token .range .start ;
13271327 rbs_node_list_t * union_types = rbs_node_list_new (ALLOCATOR ());
@@ -1426,7 +1426,7 @@ static bool parse_type_params(rbs_parser_t *parser, rbs_range_t *rg, bool module
14261426
14271427 rbs_parser_advance (parser );
14281428 upper_bound_range .start = parser -> current_token .range .start ;
1429- CHECK_PARSE (rbs_parse_type (parser , & upper_bound , (rbs_type_validation_t ) { .no_void = true, .no_self = true, .no_classish = true }));
1429+ CHECK_PARSE (rbs_parse_type (parser , & upper_bound , (rbs_type_parsing_option_t ) { .no_void = true, .no_self = true, .no_classish = true }));
14301430 upper_bound_range .end = parser -> current_token .range .end ;
14311431 break ;
14321432
@@ -1438,7 +1438,7 @@ static bool parse_type_params(rbs_parser_t *parser, rbs_range_t *rg, bool module
14381438
14391439 rbs_parser_advance (parser );
14401440 lower_bound_range .start = parser -> current_token .range .start ;
1441- CHECK_PARSE (rbs_parse_type (parser , & lower_bound , (rbs_type_validation_t ) { .no_void = true, .no_self = true, .no_classish = true }));
1441+ CHECK_PARSE (rbs_parse_type (parser , & lower_bound , (rbs_type_parsing_option_t ) { .no_void = true, .no_self = true, .no_classish = true }));
14421442 lower_bound_range .end = parser -> current_token .range .end ;
14431443 break ;
14441444
@@ -1453,7 +1453,7 @@ static bool parse_type_params(rbs_parser_t *parser, rbs_range_t *rg, bool module
14531453 rbs_parser_advance (parser );
14541454
14551455 default_type_range .start = parser -> current_token .range .start ;
1456- CHECK_PARSE (rbs_parse_type (parser , & default_type , (rbs_type_validation_t ) { .no_void = true, .no_void_allowed_here = true, .no_self = true, .no_classish = true }));
1456+ CHECK_PARSE (rbs_parse_type (parser , & default_type , (rbs_type_parsing_option_t ) { .no_void = true, .no_void_allowed_here = true, .no_self = true, .no_classish = true }));
14571457 default_type_range .end = parser -> current_token .range .end ;
14581458
14591459 required_param_allowed = false;
@@ -1523,7 +1523,7 @@ static bool parser_pop_typevar_table(rbs_parser_t *parser) {
15231523 method_type ::= {} type_params <function>
15241524 */
15251525// TODO: Should this be NODISCARD?
1526- bool rbs_parse_method_type (rbs_parser_t * parser , rbs_method_type_t * * method_type , rbs_type_validation_t validation ) {
1526+ bool rbs_parse_method_type (rbs_parser_t * parser , rbs_method_type_t * * method_type , rbs_type_parsing_option_t validation ) {
15271527 rbs_parser_push_typevar_table (parser , false);
15281528
15291529 rbs_range_t rg ;
@@ -1572,7 +1572,7 @@ static bool parse_global_decl(rbs_parser_t *parser, rbs_node_list_t *annotations
15721572 rbs_range_t colon_range = parser -> current_token .range ;
15731573
15741574 rbs_node_t * type ;
1575- CHECK_PARSE (rbs_parse_type (parser , & type , (rbs_type_validation_t ) { .no_void = true, .no_self = true, .no_classish = true }));
1575+ CHECK_PARSE (rbs_parse_type (parser , & type , (rbs_type_parsing_option_t ) { .no_void = true, .no_self = true, .no_classish = true }));
15761576 decl_range .end = parser -> current_token .range .end ;
15771577
15781578 rbs_location_t * loc = rbs_location_new (ALLOCATOR (), decl_range );
@@ -1602,7 +1602,7 @@ static bool parse_const_decl(rbs_parser_t *parser, rbs_node_list_t *annotations,
16021602 rbs_range_t colon_range = parser -> current_token .range ;
16031603
16041604 rbs_node_t * type ;
1605- CHECK_PARSE (rbs_parse_type (parser , & type , (rbs_type_validation_t ) { .no_void = true, .no_self = true, .no_classish = true }));
1605+ CHECK_PARSE (rbs_parse_type (parser , & type , (rbs_type_parsing_option_t ) { .no_void = true, .no_self = true, .no_classish = true }));
16061606
16071607 decl_range .end = parser -> current_token .range .end ;
16081608
@@ -1642,7 +1642,7 @@ static bool parse_type_decl(rbs_parser_t *parser, rbs_position_t comment_pos, rb
16421642 rbs_range_t eq_range = parser -> current_token .range ;
16431643
16441644 rbs_node_t * type ;
1645- CHECK_PARSE (rbs_parse_type (parser , & type , (rbs_type_validation_t ) { .no_void = true, .no_self = true, .no_classish = true }));
1645+ CHECK_PARSE (rbs_parse_type (parser , & type , (rbs_type_parsing_option_t ) { .no_void = true, .no_self = true, .no_classish = true }));
16461646
16471647 decl_range .end = parser -> current_token .range .end ;
16481648
@@ -1951,7 +1951,7 @@ static bool parse_member_def(rbs_parser_t *parser, bool instance_only, bool acce
19511951 case pLBRACKET :
19521952 case pQUESTION : {
19531953 rbs_method_type_t * method_type = NULL ;
1954- CHECK_PARSE (rbs_parse_method_type (parser , & method_type , instance_only ? (rbs_type_validation_t ) { .no_void = true, .no_classish = true } : (rbs_type_validation_t ) { .no_void = true }));
1954+ CHECK_PARSE (rbs_parse_method_type (parser , & method_type , instance_only ? (rbs_type_parsing_option_t ) { .no_void = true, .no_classish = true } : (rbs_type_parsing_option_t ) { .no_void = true }));
19551955
19561956 overload_range .end = parser -> current_token .range .end ;
19571957 rbs_location_t * loc = rbs_location_new (ALLOCATOR (), overload_range );
@@ -2026,7 +2026,7 @@ static bool parse_member_def(rbs_parser_t *parser, bool instance_only, bool acce
20262026 * @param kind
20272027 * */
20282028NODISCARD
2029- static bool class_instance_name (rbs_parser_t * parser , TypeNameKind kind , rbs_node_list_t * args , rbs_range_t * name_range , rbs_range_t * args_range , rbs_type_name_t * * name , rbs_type_validation_t validation ) {
2029+ static bool class_instance_name (rbs_parser_t * parser , TypeNameKind kind , rbs_node_list_t * args , rbs_range_t * name_range , rbs_range_t * args_range , rbs_type_name_t * * name , rbs_type_parsing_option_t validation ) {
20302030 rbs_parser_advance (parser );
20312031
20322032 rbs_type_name_t * type_name = NULL ;
@@ -2098,7 +2098,7 @@ static bool parse_mixin_member(rbs_parser_t *parser, bool from_interface, rbs_po
20982098 & name_range ,
20992099 & args_range ,
21002100 & name ,
2101- (rbs_type_validation_t ) { .no_void = true, .no_void_allowed_here = true, .no_self = true }
2101+ (rbs_type_parsing_option_t ) { .no_void = true, .no_void_allowed_here = true, .no_self = true }
21022102 ));
21032103
21042104 CHECK_PARSE (parser_pop_typevar_table (parser ));
@@ -2190,7 +2190,7 @@ static bool parse_alias_member(rbs_parser_t *parser, bool instance_only, rbs_pos
21902190 | {tA2IDENT} `:` <type>
21912191*/
21922192NODISCARD
2193- static bool parse_variable_member (rbs_parser_t * parser , rbs_position_t comment_pos , rbs_node_list_t * annotations , rbs_node_t * * variable_member , rbs_type_validation_t validation ) {
2193+ static bool parse_variable_member (rbs_parser_t * parser , rbs_position_t comment_pos , rbs_node_list_t * annotations , rbs_node_t * * variable_member , rbs_type_parsing_option_t validation ) {
21942194 if (annotations -> length > 0 ) {
21952195 rbs_parser_set_error (parser , parser -> current_token , true, "annotation cannot be given to variable members" );
21962196 return false;
@@ -2415,7 +2415,7 @@ static bool parse_attribute_member(rbs_parser_t *parser, rbs_position_t comment_
24152415 rbs_parser_push_typevar_table (parser , is_kind == SINGLETON_KIND );
24162416
24172417 rbs_node_t * type ;
2418- CHECK_PARSE (rbs_parse_type (parser , & type , (rbs_type_validation_t ) { .no_void = true }));
2418+ CHECK_PARSE (rbs_parse_type (parser , & type , (rbs_type_parsing_option_t ) { .no_void = true }));
24192419
24202420 CHECK_PARSE (parser_pop_typevar_table (parser ));
24212421
@@ -2568,7 +2568,7 @@ static bool parse_module_self_types(rbs_parser_t *parser, rbs_node_list_t *array
25682568 if (parser -> next_token .type == pLBRACKET ) {
25692569 rbs_parser_advance (parser );
25702570 args_range .start = parser -> current_token .range .start ;
2571- CHECK_PARSE (parse_type_list (parser , pRBRACKET , args , (rbs_type_validation_t ) { .no_void = true, .no_void_allowed_here = true, .no_self = true, .no_classish = true }));
2571+ CHECK_PARSE (parse_type_list (parser , pRBRACKET , args , (rbs_type_parsing_option_t ) { .no_void = true, .no_void_allowed_here = true, .no_self = true, .no_classish = true }));
25722572 rbs_parser_advance (parser );
25732573 self_range .end = args_range .end = parser -> current_token .range .end ;
25742574 }
@@ -2641,7 +2641,7 @@ static bool parse_module_members(rbs_parser_t *parser, rbs_node_list_t **members
26412641 case tA2IDENT :
26422642 case kATRBS :
26432643 case kSELF : {
2644- rbs_type_validation_t validation = { .no_void = true };
2644+ rbs_type_parsing_option_t validation = { .no_void = true };
26452645 if (parser -> current_token .type == tA2IDENT ) {
26462646 validation .no_self = true;
26472647 }
@@ -2814,7 +2814,7 @@ static bool parse_class_decl_super(rbs_parser_t *parser, rbs_range_t *lt_range,
28142814 & name_range ,
28152815 & args_range ,
28162816 & name ,
2817- (rbs_type_validation_t ) { .no_void = true, .no_void_allowed_here = true, .no_self = true, .no_classish = true }
2817+ (rbs_type_parsing_option_t ) { .no_void = true, .no_void_allowed_here = true, .no_self = true, .no_classish = true }
28182818 ));
28192819
28202820 super_range .end = parser -> current_token .range .end ;
0 commit comments