@@ -126,8 +126,24 @@ rbs_ast_comment_t *rbs_parser_get_comment(rbs_parser_t *parser, int subject_line
126126
127127void rbs_parser_set_error (rbs_parser_t * parser , rbs_token_t tok , bool syntax_error , const char * fmt , ...) RBS_ATTRIBUTE_FORMAT (4 , 5 );
128128
129- bool rbs_parse_type (rbs_parser_t * parser , rbs_node_t * * type );
130- bool rbs_parse_method_type (rbs_parser_t * parser , rbs_method_type_t * * method_type );
129+ /**
130+ * TypeValidation represents the validation rules for type parsing.
131+ * It controls whether certain types are allowed in specific contexts.
132+ * */
133+ typedef struct {
134+ bool no_void ; /* If true, `void` type is not allowed.*/
135+ bool no_void_allowed_here ; /* If true, `void` type is not allowed, but it's allowed in one depth.*/
136+ bool no_self ; /* If true, `self` type is not allowed.*/
137+ bool no_classish ; /* If true, `class` or `instance` types are not allowed.*/
138+ } TypeValidation ;
139+
140+ /**
141+ * SkipValidation is a TypeValidation that allows all types.
142+ * */
143+ extern const TypeValidation SkipValidation ;
144+
145+ bool rbs_parse_type (rbs_parser_t * parser , rbs_node_t * * type , TypeValidation validation );
146+ bool rbs_parse_method_type (rbs_parser_t * parser , rbs_method_type_t * * method_type , TypeValidation validation );
131147bool rbs_parse_signature (rbs_parser_t * parser , rbs_signature_t * * signature );
132148
133149bool rbs_parse_type_params (rbs_parser_t * parser , bool module_type_params , rbs_node_list_t * * params );
0 commit comments