Skip to content

Commit 7eb9f72

Browse files
committed
WIP parser
1 parent 815665f commit 7eb9f72

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

ext/rbs_extension/parser.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2922,6 +2922,19 @@ static void parse_inline_method_overloads(parserstate *state, VALUE *overloads,
29222922
}
29232923
}
29242924

2925+
static VALUE parse_inline_comment(parserstate *state) {
2926+
VALUE comment = Qnil;
2927+
2928+
if (state->next_token.type == tCOMMENT) {
2929+
range comment_range = state->next_token.range;
2930+
parser_advance(state);
2931+
2932+
comment = rbs_new_location(state->buffer, comment_range);
2933+
}
2934+
2935+
return comment;
2936+
}
2937+
29252938
static VALUE parse_inline_leading_annotation(parserstate *state) {
29262939
switch (state->next_token.type) {
29272940
case pCOLON: {
@@ -2962,6 +2975,19 @@ static VALUE parse_inline_leading_annotation(parserstate *state) {
29622975
bar_locations
29632976
);
29642977
}
2978+
case kSKIP: {
2979+
parser_advance(state);
2980+
2981+
range skip_loc = state->current_token.range;
2982+
VALUE comment_loc = parse_inline_comment(state);
2983+
2984+
return rbs_ast_ruby_annotations_skip_annotation(
2985+
rbs_new_location(state->buffer, (range) { .start = rbs_range.start, .end = state->current_token.range.end }),
2986+
rbs_new_location(state->buffer, rbs_range),
2987+
rbs_new_location(state->buffer, skip_loc),
2988+
comment_loc
2989+
);
2990+
}
29652991
default: {
29662992
raise_syntax_error(
29672993
state,

0 commit comments

Comments
 (0)