rbs 3.8.0 → 3.9.0.dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/ruby.yml +7 -7
- data/.github/workflows/typecheck.yml +2 -0
- data/.github/workflows/windows.yml +15 -0
- data/.rubocop.yml +20 -1
- data/CHANGELOG.md +14 -0
- data/Rakefile +5 -2
- data/config.yml +6 -0
- data/core/data.rbs +1 -1
- data/core/enumerator.rbs +14 -2
- data/core/exception.rbs +148 -39
- data/core/gc.rbs +2 -2
- data/core/io.rbs +7 -3
- data/core/kernel.rbs +58 -16
- data/core/method.rbs +2 -2
- data/core/module.rbs +3 -3
- data/core/proc.rbs +2 -2
- data/core/ractor.rbs +4 -1
- data/core/rbs/unnamed/argf.rbs +3 -3
- data/core/regexp.rbs +4 -2
- data/core/ruby_vm.rbs +8 -8
- data/core/rubygems/version.rbs +2 -2
- data/core/string.rbs +1 -1
- data/core/time.rbs +1 -1
- data/core/unbound_method.rbs +1 -1
- data/docs/syntax.md +10 -5
- data/ext/rbs_extension/extconf.rb +2 -1
- data/ext/rbs_extension/location.c +32 -10
- data/ext/rbs_extension/location.h +4 -3
- data/ext/rbs_extension/main.c +22 -1
- data/ext/rbs_extension/parser.c +144 -136
- data/ext/rbs_extension/parserstate.c +40 -9
- data/ext/rbs_extension/parserstate.h +6 -4
- data/include/rbs/ruby_objs.h +6 -6
- data/include/rbs/util/rbs_constant_pool.h +219 -0
- data/lib/rbs/ast/declarations.rb +9 -4
- data/lib/rbs/ast/directives.rb +10 -0
- data/lib/rbs/ast/members.rb +2 -0
- data/lib/rbs/ast/type_param.rb +2 -2
- data/lib/rbs/cli/validate.rb +1 -0
- data/lib/rbs/cli.rb +3 -3
- data/lib/rbs/collection/config/lockfile_generator.rb +28 -7
- data/lib/rbs/collection/sources/rubygems.rb +1 -1
- data/lib/rbs/definition.rb +46 -31
- data/lib/rbs/definition_builder/ancestor_builder.rb +2 -0
- data/lib/rbs/definition_builder.rb +86 -30
- data/lib/rbs/environment.rb +33 -18
- data/lib/rbs/errors.rb +23 -0
- data/lib/rbs/locator.rb +2 -0
- data/lib/rbs/method_type.rb +2 -0
- data/lib/rbs/parser_aux.rb +38 -1
- data/lib/rbs/subtractor.rb +3 -3
- data/lib/rbs/test/hook.rb +2 -2
- data/lib/rbs/test/type_check.rb +7 -5
- data/lib/rbs/types.rb +44 -5
- data/lib/rbs/unit_test/spy.rb +4 -2
- data/lib/rbs/unit_test/type_assertions.rb +17 -11
- data/lib/rbs/validator.rb +4 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +10 -5
- data/lib/rbs.rb +1 -0
- data/rbs.gemspec +1 -1
- data/sig/collection/config/lockfile_generator.rbs +1 -1
- data/sig/declarations.rbs +10 -3
- data/sig/definition.rbs +67 -14
- data/sig/definition_builder.rbs +17 -3
- data/sig/directives.rbs +17 -1
- data/sig/environment.rbs +2 -0
- data/sig/errors.rbs +16 -0
- data/sig/parser.rbs +5 -1
- data/sig/subtractor.rbs +1 -1
- data/sig/test/type_check.rbs +2 -2
- data/sig/type_param.rbs +1 -1
- data/sig/types.rbs +3 -0
- data/sig/unit_test/spy.rbs +2 -0
- data/sig/unit_test/type_assertions.rbs +2 -0
- data/sig/validator.rbs +4 -0
- data/sig/writer.rbs +1 -1
- data/src/ruby_objs.c +12 -6
- data/src/util/rbs_constant_pool.c +342 -0
- data/stdlib/cgi/0/core.rbs +10 -0
- data/stdlib/json/0/json.rbs +52 -50
- data/stdlib/monitor/0/monitor.rbs +13 -4
- data/stdlib/net-http/0/net-http.rbs +2 -2
- data/stdlib/openssl/0/openssl.rbs +73 -73
- data/stdlib/resolv/0/resolv.rbs +8 -8
- data/stdlib/socket/0/addrinfo.rbs +1 -1
- data/stdlib/socket/0/unix_socket.rbs +4 -2
- data/stdlib/stringio/0/stringio.rbs +1 -1
- data/stdlib/uri/0/common.rbs +17 -0
- metadata +4 -7
- data/templates/include/rbs/constants.h.erb +0 -20
- data/templates/include/rbs/ruby_objs.h.erb +0 -10
- data/templates/src/constants.c.erb +0 -36
- data/templates/src/ruby_objs.c.erb +0 -27
- data/templates/template.rb +0 -122
    
        data/ext/rbs_extension/parser.c
    CHANGED
    
    | @@ -1,4 +1,12 @@ | |
| 1 1 | 
             
            #include "rbs_extension.h"
         | 
| 2 | 
            +
            #include "rbs/util/rbs_constant_pool.h"
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            #define INTERN(str)                  \
         | 
| 5 | 
            +
              rbs_constant_pool_insert_constant( \
         | 
| 6 | 
            +
                RBS_GLOBAL_CONSTANT_POOL,        \
         | 
| 7 | 
            +
                (const uint8_t *) str,           \
         | 
| 8 | 
            +
                strlen(str)                      \
         | 
| 9 | 
            +
              )
         | 
| 2 10 |  | 
| 3 11 | 
             
            #define INTERN_TOKEN(parserstate, tok) \
         | 
| 4 12 | 
             
              rb_intern3(\
         | 
| @@ -277,7 +285,7 @@ static VALUE parse_function_param(parserstate *state) { | |
| 277 285 | 
             
                VALUE location = rbs_new_location(state->buffer, param_range);
         | 
| 278 286 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 279 287 | 
             
                rbs_loc_alloc_children(loc, 1);
         | 
| 280 | 
            -
                rbs_loc_add_optional_child(loc,  | 
| 288 | 
            +
                rbs_loc_add_optional_child(loc, INTERN("name"), NULL_RANGE);
         | 
| 281 289 |  | 
| 282 290 | 
             
                return rbs_function_param(type, Qnil, location);
         | 
| 283 291 | 
             
              } else {
         | 
| @@ -302,7 +310,7 @@ static VALUE parse_function_param(parserstate *state) { | |
| 302 310 | 
             
                VALUE location = rbs_new_location(state->buffer, param_range);
         | 
| 303 311 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 304 312 | 
             
                rbs_loc_alloc_children(loc, 1);
         | 
| 305 | 
            -
                rbs_loc_add_optional_child(loc,  | 
| 313 | 
            +
                rbs_loc_add_optional_child(loc, INTERN("name"), name_range);
         | 
| 306 314 |  | 
| 307 315 | 
             
                return rbs_function_param(type, name, location);
         | 
| 308 316 | 
             
              }
         | 
| @@ -902,8 +910,8 @@ static VALUE parse_instance_type(parserstate *state, bool parse_alias) { | |
| 902 910 | 
             
                VALUE location = rbs_new_location(state->buffer, type_range);
         | 
| 903 911 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 904 912 | 
             
                rbs_loc_alloc_children(loc, 2);
         | 
| 905 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 906 | 
            -
                rbs_loc_add_optional_child(loc,  | 
| 913 | 
            +
                rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 914 | 
            +
                rbs_loc_add_optional_child(loc, INTERN("args"), args_range);
         | 
| 907 915 |  | 
| 908 916 | 
             
                if (kind == CLASS_NAME) {
         | 
| 909 917 | 
             
                  return rbs_class_instance(typename, types, location);
         | 
| @@ -936,7 +944,7 @@ static VALUE parse_singleton_type(parserstate *state) { | |
| 936 944 | 
             
              VALUE location = rbs_new_location(state->buffer, type_range);
         | 
| 937 945 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 938 946 | 
             
              rbs_loc_alloc_children(loc, 1);
         | 
| 939 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 947 | 
            +
              rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 940 948 |  | 
| 941 949 | 
             
              return rbs_class_singleton(typename, location);
         | 
| 942 950 | 
             
            }
         | 
| @@ -985,12 +993,10 @@ static VALUE parse_simple(parserstate *state) { | |
| 985 993 | 
             
                return rbs_bases_void(rbs_location_current_token(state));
         | 
| 986 994 | 
             
              }
         | 
| 987 995 | 
             
              case kUNTYPED: {
         | 
| 988 | 
            -
                return rbs_bases_any(rbs_location_current_token(state));
         | 
| 996 | 
            +
                return rbs_bases_any(false, rbs_location_current_token(state));
         | 
| 989 997 | 
             
              }
         | 
| 990 998 | 
             
              case k__TODO__: {
         | 
| 991 | 
            -
                 | 
| 992 | 
            -
                rb_funcall(type, rb_intern("todo!"), 0);
         | 
| 993 | 
            -
                return type;
         | 
| 999 | 
            +
                return rbs_bases_any(true, rbs_location_current_token(state));
         | 
| 994 1000 | 
             
              }
         | 
| 995 1001 | 
             
              case tINTEGER: {
         | 
| 996 1002 | 
             
                VALUE literal = rb_funcall(
         | 
| @@ -1023,8 +1029,13 @@ static VALUE parse_simple(parserstate *state) { | |
| 1023 1029 | 
             
                return parse_symbol(state);
         | 
| 1024 1030 | 
             
              }
         | 
| 1025 1031 | 
             
              case tUIDENT: {
         | 
| 1026 | 
            -
                 | 
| 1032 | 
            +
                const char *name_str = peek_token(state->lexstate, state->current_token);
         | 
| 1033 | 
            +
                size_t name_len = token_bytes(state->current_token);
         | 
| 1034 | 
            +
             | 
| 1035 | 
            +
                rbs_constant_id_t name = rbs_constant_pool_find(&state->constant_pool, (const uint8_t *) name_str, name_len);
         | 
| 1036 | 
            +
             | 
| 1027 1037 | 
             
                if (parser_typevar_member(state, name)) {
         | 
| 1038 | 
            +
                  ID name = rb_intern3(name_str, name_len, rb_enc_get(state->lexstate->string));
         | 
| 1028 1039 | 
             
                  return rbs_variable(ID2SYM(name), rbs_location_current_token(state));
         | 
| 1029 1040 | 
             
                }
         | 
| 1030 1041 | 
             
                // fallthrough for type name
         | 
| @@ -1077,26 +1088,24 @@ static VALUE parse_simple(parserstate *state) { | |
| 1077 1088 | 
             
                             | {} <optional>
         | 
| 1078 1089 | 
             
            */
         | 
| 1079 1090 | 
             
            static VALUE parse_intersection(parserstate *state) {
         | 
| 1080 | 
            -
              range | 
| 1081 | 
            -
              rg.start = state->next_token.range.start;
         | 
| 1082 | 
            -
             | 
| 1091 | 
            +
              position start = state->next_token.range.start;
         | 
| 1083 1092 | 
             
              VALUE type = parse_optional(state);
         | 
| 1084 | 
            -
               | 
| 1093 | 
            +
              if (state->next_token.type != pAMP) {
         | 
| 1094 | 
            +
                return type;
         | 
| 1095 | 
            +
              }
         | 
| 1085 1096 |  | 
| 1097 | 
            +
              VALUE intersection_types = rb_ary_new();
         | 
| 1086 1098 | 
             
              rb_ary_push(intersection_types, type);
         | 
| 1087 1099 | 
             
              while (state->next_token.type == pAMP) {
         | 
| 1088 1100 | 
             
                parser_advance(state);
         | 
| 1089 1101 | 
             
                rb_ary_push(intersection_types, parse_optional(state));
         | 
| 1090 1102 | 
             
              }
         | 
| 1091 | 
            -
             | 
| 1092 | 
            -
             | 
| 1093 | 
            -
             | 
| 1094 | 
            -
               | 
| 1095 | 
            -
             | 
| 1096 | 
            -
             | 
| 1097 | 
            -
              }
         | 
| 1098 | 
            -
             | 
| 1099 | 
            -
              return type;
         | 
| 1103 | 
            +
              range rg = (range) {
         | 
| 1104 | 
            +
                .start = start,
         | 
| 1105 | 
            +
                .end = state->current_token.range.end,
         | 
| 1106 | 
            +
              };
         | 
| 1107 | 
            +
              VALUE location = rbs_new_location(state->buffer, rg);
         | 
| 1108 | 
            +
              return rbs_intersection(intersection_types, location);
         | 
| 1100 1109 | 
             
            }
         | 
| 1101 1110 |  | 
| 1102 1111 | 
             
            /*
         | 
| @@ -1104,26 +1113,24 @@ static VALUE parse_intersection(parserstate *state) { | |
| 1104 1113 | 
             
                      | {} <intersection>
         | 
| 1105 1114 | 
             
            */
         | 
| 1106 1115 | 
             
            VALUE parse_type(parserstate *state) {
         | 
| 1107 | 
            -
              range | 
| 1108 | 
            -
              rg.start = state->next_token.range.start;
         | 
| 1109 | 
            -
             | 
| 1116 | 
            +
              position start = state->next_token.range.start;
         | 
| 1110 1117 | 
             
              VALUE type = parse_intersection(state);
         | 
| 1111 | 
            -
               | 
| 1118 | 
            +
              if (state->next_token.type != pBAR) {
         | 
| 1119 | 
            +
                return type;
         | 
| 1120 | 
            +
              }
         | 
| 1112 1121 |  | 
| 1122 | 
            +
              VALUE union_types = rb_ary_new();
         | 
| 1113 1123 | 
             
              rb_ary_push(union_types, type);
         | 
| 1114 1124 | 
             
              while (state->next_token.type == pBAR) {
         | 
| 1115 1125 | 
             
                parser_advance(state);
         | 
| 1116 1126 | 
             
                rb_ary_push(union_types, parse_intersection(state));
         | 
| 1117 1127 | 
             
              }
         | 
| 1118 | 
            -
             | 
| 1119 | 
            -
             | 
| 1120 | 
            -
             | 
| 1121 | 
            -
               | 
| 1122 | 
            -
             | 
| 1123 | 
            -
             | 
| 1124 | 
            -
              }
         | 
| 1125 | 
            -
             | 
| 1126 | 
            -
              return type;
         | 
| 1128 | 
            +
              range rg = (range) {
         | 
| 1129 | 
            +
                .start = start,
         | 
| 1130 | 
            +
                .end = state->current_token.range.end,
         | 
| 1131 | 
            +
              };
         | 
| 1132 | 
            +
              VALUE location = rbs_new_location(state->buffer, rg);
         | 
| 1133 | 
            +
              return rbs_union(union_types, location);
         | 
| 1127 1134 | 
             
            }
         | 
| 1128 1135 |  | 
| 1129 1136 | 
             
            /*
         | 
| @@ -1145,7 +1152,7 @@ static VALUE parse_type_params(parserstate *state, range *rg, bool module_type_p | |
| 1145 1152 | 
             
                rg->start = state->current_token.range.start;
         | 
| 1146 1153 |  | 
| 1147 1154 | 
             
                while (true) {
         | 
| 1148 | 
            -
                   | 
| 1155 | 
            +
                  VALUE unchecked = Qfalse;
         | 
| 1149 1156 | 
             
                  VALUE variance = ID2SYM(rb_intern("invariant"));
         | 
| 1150 1157 | 
             
                  VALUE upper_bound = Qnil;
         | 
| 1151 1158 | 
             
                  VALUE default_type = Qnil;
         | 
| @@ -1157,7 +1164,7 @@ static VALUE parse_type_params(parserstate *state, range *rg, bool module_type_p | |
| 1157 1164 | 
             
                  range unchecked_range = NULL_RANGE;
         | 
| 1158 1165 | 
             
                  if (module_type_params) {
         | 
| 1159 1166 | 
             
                    if (state->next_token.type == kUNCHECKED) {
         | 
| 1160 | 
            -
                      unchecked =  | 
| 1167 | 
            +
                      unchecked = Qtrue;
         | 
| 1161 1168 | 
             
                      parser_advance(state);
         | 
| 1162 1169 | 
             
                      unchecked_range = state->current_token.range;
         | 
| 1163 1170 | 
             
                    }
         | 
| @@ -1182,8 +1189,13 @@ static VALUE parse_type_params(parserstate *state, range *rg, bool module_type_p | |
| 1182 1189 | 
             
                  parser_advance_assert(state, tUIDENT);
         | 
| 1183 1190 | 
             
                  range name_range = state->current_token.range;
         | 
| 1184 1191 |  | 
| 1185 | 
            -
                   | 
| 1186 | 
            -
             | 
| 1192 | 
            +
                  rbs_constant_id_t id = rbs_constant_pool_insert_shared(
         | 
| 1193 | 
            +
                    &state->constant_pool,
         | 
| 1194 | 
            +
                    (const uint8_t *) peek_token(state->lexstate, state->current_token),
         | 
| 1195 | 
            +
                    token_bytes(state->current_token)
         | 
| 1196 | 
            +
                  );
         | 
| 1197 | 
            +
             | 
| 1198 | 
            +
                  VALUE name = ID2SYM(INTERN_TOKEN(state, state->current_token));
         | 
| 1187 1199 |  | 
| 1188 1200 | 
             
                  parser_insert_typevar(state, id);
         | 
| 1189 1201 |  | 
| @@ -1221,17 +1233,13 @@ static VALUE parse_type_params(parserstate *state, range *rg, bool module_type_p | |
| 1221 1233 | 
             
                  VALUE location = rbs_new_location(state->buffer, param_range);
         | 
| 1222 1234 | 
             
                  rbs_loc *loc = rbs_check_location(location);
         | 
| 1223 1235 | 
             
                  rbs_loc_alloc_children(loc, 5);
         | 
| 1224 | 
            -
                  rbs_loc_add_required_child(loc,  | 
| 1225 | 
            -
                  rbs_loc_add_optional_child(loc,  | 
| 1226 | 
            -
                  rbs_loc_add_optional_child(loc,  | 
| 1227 | 
            -
                  rbs_loc_add_optional_child(loc,  | 
| 1228 | 
            -
                  rbs_loc_add_optional_child(loc,  | 
| 1229 | 
            -
             | 
| 1230 | 
            -
                  VALUE param = rbs_ast_type_param(name, variance, upper_bound, default_type, location);
         | 
| 1236 | 
            +
                  rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 1237 | 
            +
                  rbs_loc_add_optional_child(loc, INTERN("variance"), variance_range);
         | 
| 1238 | 
            +
                  rbs_loc_add_optional_child(loc, INTERN("unchecked"), unchecked_range);
         | 
| 1239 | 
            +
                  rbs_loc_add_optional_child(loc, INTERN("upper_bound"), upper_bound_range);
         | 
| 1240 | 
            +
                  rbs_loc_add_optional_child(loc, INTERN("default"), default_type_range);
         | 
| 1231 1241 |  | 
| 1232 | 
            -
                   | 
| 1233 | 
            -
                    rb_funcall(param, rb_intern("unchecked!"), 0);
         | 
| 1234 | 
            -
                  }
         | 
| 1242 | 
            +
                  VALUE param = rbs_ast_type_param(name, variance, upper_bound, default_type, unchecked, location);
         | 
| 1235 1243 |  | 
| 1236 1244 | 
             
                  melt_array(¶ms);
         | 
| 1237 1245 | 
             
                  rb_ary_push(params, param);
         | 
| @@ -1288,8 +1296,8 @@ VALUE parse_method_type(parserstate *state) { | |
| 1288 1296 | 
             
              VALUE location = rbs_new_location(state->buffer, rg);
         | 
| 1289 1297 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 1290 1298 | 
             
              rbs_loc_alloc_children(loc, 2);
         | 
| 1291 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1292 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 1299 | 
            +
              rbs_loc_add_required_child(loc, INTERN("type"), type_range);
         | 
| 1300 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("type_params"), params_range);
         | 
| 1293 1301 |  | 
| 1294 1302 | 
             
              return rbs_method_type(
         | 
| 1295 1303 | 
             
                type_params,
         | 
| @@ -1302,7 +1310,7 @@ VALUE parse_method_type(parserstate *state) { | |
| 1302 1310 | 
             
            /*
         | 
| 1303 1311 | 
             
              global_decl ::= {tGIDENT} `:` <type>
         | 
| 1304 1312 | 
             
            */
         | 
| 1305 | 
            -
            static VALUE parse_global_decl(parserstate *state) {
         | 
| 1313 | 
            +
            static VALUE parse_global_decl(parserstate *state, VALUE annotations) {
         | 
| 1306 1314 | 
             
              range decl_range;
         | 
| 1307 1315 | 
             
              decl_range.start = state->current_token.range.start;
         | 
| 1308 1316 |  | 
| @@ -1319,16 +1327,16 @@ static VALUE parse_global_decl(parserstate *state) { | |
| 1319 1327 | 
             
              VALUE location = rbs_new_location(state->buffer, decl_range);
         | 
| 1320 1328 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 1321 1329 | 
             
              rbs_loc_alloc_children(loc, 2);
         | 
| 1322 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1323 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1330 | 
            +
              rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 1331 | 
            +
              rbs_loc_add_required_child(loc, INTERN("colon"), colon_range);
         | 
| 1324 1332 |  | 
| 1325 | 
            -
              return rbs_ast_decl_global(typename, type, location, comment);
         | 
| 1333 | 
            +
              return rbs_ast_decl_global(typename, type, location, comment, annotations);
         | 
| 1326 1334 | 
             
            }
         | 
| 1327 1335 |  | 
| 1328 1336 | 
             
            /*
         | 
| 1329 1337 | 
             
              const_decl ::= {const_name} `:` <type>
         | 
| 1330 1338 | 
             
            */
         | 
| 1331 | 
            -
            static VALUE parse_const_decl(parserstate *state) {
         | 
| 1339 | 
            +
            static VALUE parse_const_decl(parserstate *state, VALUE annotations) {
         | 
| 1332 1340 | 
             
              range decl_range;
         | 
| 1333 1341 |  | 
| 1334 1342 | 
             
              decl_range.start = state->current_token.range.start;
         | 
| @@ -1346,10 +1354,10 @@ static VALUE parse_const_decl(parserstate *state) { | |
| 1346 1354 | 
             
              VALUE location = rbs_new_location(state->buffer, decl_range);
         | 
| 1347 1355 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 1348 1356 | 
             
              rbs_loc_alloc_children(loc, 2);
         | 
| 1349 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1350 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1357 | 
            +
              rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 1358 | 
            +
              rbs_loc_add_required_child(loc, INTERN("colon"), colon_range);
         | 
| 1351 1359 |  | 
| 1352 | 
            -
              return rbs_ast_decl_constant(typename, type, location, comment);
         | 
| 1360 | 
            +
              return rbs_ast_decl_constant(typename, type, location, comment, annotations);
         | 
| 1353 1361 | 
             
            }
         | 
| 1354 1362 |  | 
| 1355 1363 | 
             
            /*
         | 
| @@ -1381,10 +1389,10 @@ static VALUE parse_type_decl(parserstate *state, position comment_pos, VALUE ann | |
| 1381 1389 | 
             
              VALUE location = rbs_new_location(state->buffer, decl_range);
         | 
| 1382 1390 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 1383 1391 | 
             
              rbs_loc_alloc_children(loc, 4);
         | 
| 1384 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1385 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1386 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 1387 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1392 | 
            +
              rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 1393 | 
            +
              rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 1394 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("type_params"), params_range);
         | 
| 1395 | 
            +
              rbs_loc_add_required_child(loc, INTERN("eq"), eq_range);
         | 
| 1388 1396 |  | 
| 1389 1397 | 
             
              parser_pop_typevar_table(state);
         | 
| 1390 1398 |  | 
| @@ -1726,11 +1734,11 @@ static VALUE parse_member_def(parserstate *state, bool instance_only, bool accep | |
| 1726 1734 | 
             
              VALUE location = rbs_new_location(state->buffer, member_range);
         | 
| 1727 1735 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 1728 1736 | 
             
              rbs_loc_alloc_children(loc, 5);
         | 
| 1729 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1730 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1731 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 1732 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 1733 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 1737 | 
            +
              rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 1738 | 
            +
              rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 1739 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("kind"), kind_range);
         | 
| 1740 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("overloading"), overloading_range);
         | 
| 1741 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("visibility"), visibility_range);
         | 
| 1734 1742 |  | 
| 1735 1743 | 
             
              return rbs_ast_members_method_definition(
         | 
| 1736 1744 | 
             
                name,
         | 
| @@ -1826,9 +1834,9 @@ static VALUE parse_mixin_member(parserstate *state, bool from_interface, positio | |
| 1826 1834 | 
             
              VALUE location = rbs_new_location(state->buffer, member_range);
         | 
| 1827 1835 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 1828 1836 | 
             
              rbs_loc_alloc_children(loc, 3);
         | 
| 1829 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1830 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1831 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 1837 | 
            +
              rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 1838 | 
            +
              rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 1839 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("args"), args_range);
         | 
| 1832 1840 |  | 
| 1833 1841 | 
             
              VALUE comment = get_comment(state, comment_pos.line);
         | 
| 1834 1842 | 
             
              switch (type)
         | 
| @@ -1889,11 +1897,11 @@ static VALUE parse_alias_member(parserstate *state, bool instance_only, position | |
| 1889 1897 | 
             
              VALUE location = rbs_new_location(state->buffer, member_range);
         | 
| 1890 1898 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 1891 1899 | 
             
              rbs_loc_alloc_children(loc, 5);
         | 
| 1892 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1893 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1894 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 1895 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 1896 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 1900 | 
            +
              rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 1901 | 
            +
              rbs_loc_add_required_child(loc, INTERN("new_name"), new_name_range);
         | 
| 1902 | 
            +
              rbs_loc_add_required_child(loc, INTERN("old_name"), old_name_range);
         | 
| 1903 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("new_kind"), new_kind_range);
         | 
| 1904 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("old_kind"), old_kind_range);
         | 
| 1897 1905 |  | 
| 1898 1906 | 
             
              return rbs_ast_members_alias(
         | 
| 1899 1907 | 
             
                new_name,
         | 
| @@ -1939,9 +1947,9 @@ static VALUE parse_variable_member(parserstate *state, position comment_pos, VAL | |
| 1939 1947 | 
             
                VALUE location = rbs_new_location(state->buffer, member_range);
         | 
| 1940 1948 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 1941 1949 | 
             
                rbs_loc_alloc_children(loc, 3);
         | 
| 1942 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 1943 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 1944 | 
            -
                rbs_loc_add_optional_child(loc,  | 
| 1950 | 
            +
                rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 1951 | 
            +
                rbs_loc_add_required_child(loc, INTERN("colon"), colon_range);
         | 
| 1952 | 
            +
                rbs_loc_add_optional_child(loc, INTERN("kind"), NULL_RANGE);
         | 
| 1945 1953 |  | 
| 1946 1954 | 
             
                return rbs_ast_members_instance_variable(name, type, location, comment);
         | 
| 1947 1955 | 
             
              }
         | 
| @@ -1960,9 +1968,9 @@ static VALUE parse_variable_member(parserstate *state, position comment_pos, VAL | |
| 1960 1968 | 
             
                VALUE location = rbs_new_location(state->buffer, member_range);
         | 
| 1961 1969 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 1962 1970 | 
             
                rbs_loc_alloc_children(loc, 3);
         | 
| 1963 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 1964 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 1965 | 
            -
                rbs_loc_add_optional_child(loc,  | 
| 1971 | 
            +
                rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 1972 | 
            +
                rbs_loc_add_required_child(loc, INTERN("colon"), colon_range);
         | 
| 1973 | 
            +
                rbs_loc_add_optional_child(loc, INTERN("kind"), NULL_RANGE);
         | 
| 1966 1974 |  | 
| 1967 1975 | 
             
                return rbs_ast_members_class_variable(name, type, location, comment);
         | 
| 1968 1976 | 
             
              }
         | 
| @@ -1989,9 +1997,9 @@ static VALUE parse_variable_member(parserstate *state, position comment_pos, VAL | |
| 1989 1997 | 
             
                VALUE location = rbs_new_location(state->buffer, member_range);
         | 
| 1990 1998 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 1991 1999 | 
             
                rbs_loc_alloc_children(loc, 3);
         | 
| 1992 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 1993 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 1994 | 
            -
                rbs_loc_add_optional_child(loc,  | 
| 2000 | 
            +
                rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 2001 | 
            +
                rbs_loc_add_required_child(loc, INTERN("colon"), colon_range);
         | 
| 2002 | 
            +
                rbs_loc_add_optional_child(loc, INTERN("kind"), kind_range);
         | 
| 1995 2003 |  | 
| 1996 2004 | 
             
                return rbs_ast_members_class_instance_variable(name, type, location, comment);
         | 
| 1997 2005 | 
             
              }
         | 
| @@ -2109,13 +2117,13 @@ static VALUE parse_attribute_member(parserstate *state, position comment_pos, VA | |
| 2109 2117 | 
             
              VALUE location = rbs_new_location(state->buffer, member_range);
         | 
| 2110 2118 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 2111 2119 | 
             
              rbs_loc_alloc_children(loc, 7);
         | 
| 2112 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2113 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2114 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2115 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 2116 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 2117 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 2118 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 2120 | 
            +
              rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 2121 | 
            +
              rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 2122 | 
            +
              rbs_loc_add_required_child(loc, INTERN("colon"), colon_range);
         | 
| 2123 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("kind"), kind_range);
         | 
| 2124 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("ivar"), ivar_range);
         | 
| 2125 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("ivar_name"), ivar_name_range);
         | 
| 2126 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("visibility"), visibility_range);
         | 
| 2119 2127 |  | 
| 2120 2128 | 
             
              switch (attr_type)
         | 
| 2121 2129 | 
             
              {
         | 
| @@ -2211,10 +2219,10 @@ static VALUE parse_interface_decl(parserstate *state, position comment_pos, VALU | |
| 2211 2219 | 
             
              VALUE location = rbs_new_location(state->buffer, member_range);
         | 
| 2212 2220 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 2213 2221 | 
             
              rbs_loc_alloc_children(loc, 4);
         | 
| 2214 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2215 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2216 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2217 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 2222 | 
            +
              rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 2223 | 
            +
              rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 2224 | 
            +
              rbs_loc_add_required_child(loc, INTERN("end"), end_range);
         | 
| 2225 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("type_params"), type_params_range);
         | 
| 2218 2226 |  | 
| 2219 2227 | 
             
              return rbs_ast_decl_interface(
         | 
| 2220 2228 | 
             
                name,
         | 
| @@ -2255,8 +2263,8 @@ static void parse_module_self_types(parserstate *state, VALUE *array) { | |
| 2255 2263 | 
             
                VALUE location = rbs_new_location(state->buffer, self_range);
         | 
| 2256 2264 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 2257 2265 | 
             
                rbs_loc_alloc_children(loc, 2);
         | 
| 2258 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 2259 | 
            -
                rbs_loc_add_optional_child(loc,  | 
| 2266 | 
            +
                rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 2267 | 
            +
                rbs_loc_add_optional_child(loc, INTERN("args"), args_range);
         | 
| 2260 2268 |  | 
| 2261 2269 | 
             
                VALUE self_type = rbs_ast_decl_module_self(module_name, args, location);
         | 
| 2262 2270 | 
             
                melt_array(array);
         | 
| @@ -2397,12 +2405,12 @@ static VALUE parse_module_decl0(parserstate *state, range keyword_range, VALUE m | |
| 2397 2405 | 
             
              VALUE location = rbs_new_location(state->buffer, decl_range);
         | 
| 2398 2406 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 2399 2407 | 
             
              rbs_loc_alloc_children(loc, 6);
         | 
| 2400 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2401 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2402 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2403 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 2404 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 2405 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 2408 | 
            +
              rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 2409 | 
            +
              rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 2410 | 
            +
              rbs_loc_add_required_child(loc, INTERN("end"), end_range);
         | 
| 2411 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("type_params"), type_params_range);
         | 
| 2412 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("colon"), colon_range);
         | 
| 2413 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("self_types"), self_types_range);
         | 
| 2406 2414 |  | 
| 2407 2415 | 
             
              parser_pop_typevar_table(state);
         | 
| 2408 2416 |  | 
| @@ -2448,12 +2456,12 @@ static VALUE parse_module_decl(parserstate *state, position comment_pos, VALUE a | |
| 2448 2456 | 
             
                VALUE location = rbs_new_location(state->buffer, decl_range);
         | 
| 2449 2457 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 2450 2458 | 
             
                rbs_loc_alloc_children(loc, 4);
         | 
| 2451 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 2452 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 2453 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 2454 | 
            -
                rbs_loc_add_optional_child(loc,  | 
| 2459 | 
            +
                rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 2460 | 
            +
                rbs_loc_add_required_child(loc, INTERN("new_name"), module_name_range);
         | 
| 2461 | 
            +
                rbs_loc_add_required_child(loc, INTERN("eq"), eq_range);
         | 
| 2462 | 
            +
                rbs_loc_add_optional_child(loc, INTERN("old_name"), old_name_range);
         | 
| 2455 2463 |  | 
| 2456 | 
            -
                return rbs_ast_decl_module_alias(module_name, old_name, location, comment);
         | 
| 2464 | 
            +
                return rbs_ast_decl_module_alias(module_name, old_name, location, comment, annotations);
         | 
| 2457 2465 | 
             
              } else {
         | 
| 2458 2466 | 
             
                return parse_module_decl0(state, keyword_range, module_name, module_name_range, comment, annotations);
         | 
| 2459 2467 | 
             
              }
         | 
| @@ -2480,8 +2488,8 @@ static VALUE parse_class_decl_super(parserstate *state, range *lt_range) { | |
| 2480 2488 | 
             
                VALUE location = rbs_new_location(state->buffer, super_range);
         | 
| 2481 2489 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 2482 2490 | 
             
                rbs_loc_alloc_children(loc, 2);
         | 
| 2483 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 2484 | 
            -
                rbs_loc_add_optional_child(loc,  | 
| 2491 | 
            +
                rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 2492 | 
            +
                rbs_loc_add_optional_child(loc, INTERN("args"), args_range);
         | 
| 2485 2493 |  | 
| 2486 2494 | 
             
                return rbs_ast_decl_class_super(name, args, location);
         | 
| 2487 2495 | 
             
              } else {
         | 
| @@ -2518,11 +2526,11 @@ static VALUE parse_class_decl0(parserstate *state, range keyword_range, VALUE na | |
| 2518 2526 | 
             
              VALUE location = rbs_new_location(state->buffer, decl_range);
         | 
| 2519 2527 | 
             
              rbs_loc *loc = rbs_check_location(location);
         | 
| 2520 2528 | 
             
              rbs_loc_alloc_children(loc, 5);
         | 
| 2521 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2522 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2523 | 
            -
              rbs_loc_add_required_child(loc,  | 
| 2524 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 2525 | 
            -
              rbs_loc_add_optional_child(loc,  | 
| 2529 | 
            +
              rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 2530 | 
            +
              rbs_loc_add_required_child(loc, INTERN("name"), name_range);
         | 
| 2531 | 
            +
              rbs_loc_add_required_child(loc, INTERN("end"), end_range);
         | 
| 2532 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("type_params"), type_params_range);
         | 
| 2533 | 
            +
              rbs_loc_add_optional_child(loc, INTERN("lt"), lt_range);
         | 
| 2526 2534 |  | 
| 2527 2535 | 
             
              return rbs_ast_decl_class(
         | 
| 2528 2536 | 
             
                name,
         | 
| @@ -2565,12 +2573,12 @@ static VALUE parse_class_decl(parserstate *state, position comment_pos, VALUE an | |
| 2565 2573 | 
             
                VALUE location = rbs_new_location(state->buffer, decl_range);
         | 
| 2566 2574 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 2567 2575 | 
             
                rbs_loc_alloc_children(loc, 4);
         | 
| 2568 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 2569 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 2570 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 2571 | 
            -
                rbs_loc_add_optional_child(loc,  | 
| 2576 | 
            +
                rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 2577 | 
            +
                rbs_loc_add_required_child(loc, INTERN("new_name"), class_name_range);
         | 
| 2578 | 
            +
                rbs_loc_add_required_child(loc, INTERN("eq"), eq_range);
         | 
| 2579 | 
            +
                rbs_loc_add_optional_child(loc, INTERN("old_name"), old_name_range);
         | 
| 2572 2580 |  | 
| 2573 | 
            -
                return rbs_ast_decl_class_alias(class_name, old_name, location, comment);
         | 
| 2581 | 
            +
                return rbs_ast_decl_class_alias(class_name, old_name, location, comment, annotations);
         | 
| 2574 2582 | 
             
              } else {
         | 
| 2575 2583 | 
             
                return parse_class_decl0(state, keyword_range, class_name, class_name_range, comment, annotations);
         | 
| 2576 2584 | 
             
              }
         | 
| @@ -2590,11 +2598,11 @@ static VALUE parse_nested_decl(parserstate *state, const char *nested_in, positi | |
| 2590 2598 | 
             
              switch (state->current_token.type) {
         | 
| 2591 2599 | 
             
              case tUIDENT:
         | 
| 2592 2600 | 
             
              case pCOLON2: {
         | 
| 2593 | 
            -
                decl = parse_const_decl(state);
         | 
| 2601 | 
            +
                decl = parse_const_decl(state, annotations);
         | 
| 2594 2602 | 
             
                break;
         | 
| 2595 2603 | 
             
              }
         | 
| 2596 2604 | 
             
              case tGIDENT: {
         | 
| 2597 | 
            -
                decl = parse_global_decl(state);
         | 
| 2605 | 
            +
                decl = parse_global_decl(state, annotations);
         | 
| 2598 2606 | 
             
                break;
         | 
| 2599 2607 | 
             
              }
         | 
| 2600 2608 | 
             
              case kTYPE: {
         | 
| @@ -2636,10 +2644,10 @@ static VALUE parse_decl(parserstate *state) { | |
| 2636 2644 | 
             
              switch (state->current_token.type) {
         | 
| 2637 2645 | 
             
              case tUIDENT:
         | 
| 2638 2646 | 
             
              case pCOLON2: {
         | 
| 2639 | 
            -
                return parse_const_decl(state);
         | 
| 2647 | 
            +
                return parse_const_decl(state, annotations);
         | 
| 2640 2648 | 
             
              }
         | 
| 2641 2649 | 
             
              case tGIDENT: {
         | 
| 2642 | 
            -
                return parse_global_decl(state);
         | 
| 2650 | 
            +
                return parse_global_decl(state, annotations);
         | 
| 2643 2651 | 
             
              }
         | 
| 2644 2652 | 
             
              case kTYPE: {
         | 
| 2645 2653 | 
             
                return parse_type_decl(state, annot_pos, annotations);
         | 
| @@ -2747,9 +2755,9 @@ static void parse_use_clauses(parserstate *state, VALUE clauses) { | |
| 2747 2755 | 
             
                    VALUE location = rbs_new_location(state->buffer, clause_range);
         | 
| 2748 2756 | 
             
                    rbs_loc *loc = rbs_check_location(location);
         | 
| 2749 2757 | 
             
                    rbs_loc_alloc_children(loc, 3);
         | 
| 2750 | 
            -
                    rbs_loc_add_required_child(loc,  | 
| 2751 | 
            -
                    rbs_loc_add_optional_child(loc,  | 
| 2752 | 
            -
                    rbs_loc_add_optional_child(loc,  | 
| 2758 | 
            +
                    rbs_loc_add_required_child(loc, INTERN("type_name"), type_name_range);
         | 
| 2759 | 
            +
                    rbs_loc_add_optional_child(loc, INTERN("keyword"), keyword_range);
         | 
| 2760 | 
            +
                    rbs_loc_add_optional_child(loc, INTERN("new_name"), new_name_range);
         | 
| 2753 2761 |  | 
| 2754 2762 | 
             
                    rb_ary_push(clauses, rbs_ast_directives_use_single_clause(type_name, new_name, location));
         | 
| 2755 2763 |  | 
| @@ -2766,8 +2774,8 @@ static void parse_use_clauses(parserstate *state, VALUE clauses) { | |
| 2766 2774 | 
             
                    VALUE location = rbs_new_location(state->buffer, clause_range);
         | 
| 2767 2775 | 
             
                    rbs_loc *loc = rbs_check_location(location);
         | 
| 2768 2776 | 
             
                    rbs_loc_alloc_children(loc, 2);
         | 
| 2769 | 
            -
                    rbs_loc_add_required_child(loc,  | 
| 2770 | 
            -
                    rbs_loc_add_required_child(loc,  | 
| 2777 | 
            +
                    rbs_loc_add_required_child(loc, INTERN("namespace"), namespace_range);
         | 
| 2778 | 
            +
                    rbs_loc_add_required_child(loc, INTERN("star"), star_range);
         | 
| 2771 2779 |  | 
| 2772 2780 | 
             
                    rb_ary_push(clauses, rbs_ast_directives_use_wildcard_clause(namespace, location));
         | 
| 2773 2781 |  | 
| @@ -2809,7 +2817,7 @@ static VALUE parse_use_directive(parserstate *state) { | |
| 2809 2817 | 
             
                VALUE location = rbs_new_location(state->buffer, directive_range);
         | 
| 2810 2818 | 
             
                rbs_loc *loc = rbs_check_location(location);
         | 
| 2811 2819 | 
             
                rbs_loc_alloc_children(loc, 1);
         | 
| 2812 | 
            -
                rbs_loc_add_required_child(loc,  | 
| 2820 | 
            +
                rbs_loc_add_required_child(loc, INTERN("keyword"), keyword_range);
         | 
| 2813 2821 |  | 
| 2814 2822 | 
             
                return rbs_ast_directives_use(clauses, location);
         | 
| 2815 2823 | 
             
              } else {
         | 
| @@ -2917,12 +2925,12 @@ parse_signature_try(VALUE a) { | |
| 2917 2925 | 
             
            }
         | 
| 2918 2926 |  | 
| 2919 2927 | 
             
            static VALUE
         | 
| 2920 | 
            -
            rbsparser_parse_signature(VALUE self, VALUE buffer, VALUE end_pos)
         | 
| 2928 | 
            +
            rbsparser_parse_signature(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos)
         | 
| 2921 2929 | 
             
            {
         | 
| 2922 2930 | 
             
              VALUE string = rb_funcall(buffer, rb_intern("content"), 0);
         | 
| 2923 2931 | 
             
              StringValue(string);
         | 
| 2924 | 
            -
              lexstate *lexer = alloc_lexer(string,  | 
| 2925 | 
            -
              parserstate *parser = alloc_parser(buffer, lexer,  | 
| 2932 | 
            +
              lexstate *lexer = alloc_lexer(string, FIX2INT(start_pos), FIX2INT(end_pos));
         | 
| 2933 | 
            +
              parserstate *parser = alloc_parser(buffer, lexer, FIX2INT(start_pos), FIX2INT(end_pos), Qnil);
         | 
| 2926 2934 | 
             
              return rb_ensure(parse_signature_try, (VALUE)parser, ensure_free_parser, (VALUE)parser);
         | 
| 2927 2935 | 
             
            }
         | 
| 2928 2936 |  | 
| @@ -2956,6 +2964,6 @@ void rbs__init_parser(void) { | |
| 2956 2964 |  | 
| 2957 2965 | 
             
              rb_define_singleton_method(RBS_Parser, "_parse_type", rbsparser_parse_type, 5);
         | 
| 2958 2966 | 
             
              rb_define_singleton_method(RBS_Parser, "_parse_method_type", rbsparser_parse_method_type, 5);
         | 
| 2959 | 
            -
              rb_define_singleton_method(RBS_Parser, "_parse_signature", rbsparser_parse_signature,  | 
| 2967 | 
            +
              rb_define_singleton_method(RBS_Parser, "_parse_signature", rbsparser_parse_signature, 3);
         | 
| 2960 2968 | 
             
              rb_define_singleton_method(RBS_Parser, "_lex", rbsparser_lex, 2);
         | 
| 2961 2969 | 
             
            }
         |