@@ -143,7 +143,7 @@ void parser_advance_no_gap(parserstate *state) {
143
143
| {(tUIDENT `::`)*} <tXIDENT>
144
144
| {<tXIDENT>}
145
145
*/
146
- VALUE parse_type_name (parserstate * state , TypeNameKind kind , range * rg ) {
146
+ static VALUE parse_type_name (parserstate * state , TypeNameKind kind , range * rg ) {
147
147
VALUE absolute = Qfalse ;
148
148
VALUE path = EMPTY_ARRAY ;
149
149
VALUE namespace ;
@@ -757,7 +757,7 @@ static void check_key_duplication(parserstate *state, VALUE fields, VALUE key) {
757
757
record_attribute ::= {} keyword_token `:` <type>
758
758
| {} literal_type `=>` <type>
759
759
*/
760
- VALUE parse_record_attributes (parserstate * state ) {
760
+ static VALUE parse_record_attributes (parserstate * state ) {
761
761
VALUE fields = rb_hash_new ();
762
762
763
763
if (state -> next_token .type == pRBRACE ) {
@@ -1123,7 +1123,7 @@ VALUE parse_type(parserstate *state) {
1123
1123
1124
1124
type_param ::= tUIDENT upper_bound? default_type? (module_type_params == false)
1125
1125
*/
1126
- VALUE parse_type_params (parserstate * state , range * rg , bool module_type_params ) {
1126
+ static VALUE parse_type_params (parserstate * state , range * rg , bool module_type_params ) {
1127
1127
VALUE params = EMPTY_ARRAY ;
1128
1128
1129
1129
bool required_param_allowed = true;
@@ -1295,7 +1295,7 @@ VALUE parse_method_type(parserstate *state) {
1295
1295
/*
1296
1296
global_decl ::= {tGIDENT} `:` <type>
1297
1297
*/
1298
- VALUE parse_global_decl (parserstate * state ) {
1298
+ static VALUE parse_global_decl (parserstate * state ) {
1299
1299
range decl_range ;
1300
1300
range name_range , colon_range ;
1301
1301
@@ -1330,7 +1330,7 @@ VALUE parse_global_decl(parserstate *state) {
1330
1330
/*
1331
1331
const_decl ::= {const_name} `:` <type>
1332
1332
*/
1333
- VALUE parse_const_decl (parserstate * state ) {
1333
+ static VALUE parse_const_decl (parserstate * state ) {
1334
1334
range decl_range ;
1335
1335
range name_range , colon_range ;
1336
1336
@@ -1364,7 +1364,7 @@ VALUE parse_const_decl(parserstate *state) {
1364
1364
/*
1365
1365
type_decl ::= {kTYPE} alias_name `=` <type>
1366
1366
*/
1367
- VALUE parse_type_decl (parserstate * state , position comment_pos , VALUE annotations ) {
1367
+ static VALUE parse_type_decl (parserstate * state , position comment_pos , VALUE annotations ) {
1368
1368
range decl_range ;
1369
1369
range keyword_range , name_range , params_range , eq_range ;
1370
1370
@@ -1409,7 +1409,7 @@ VALUE parse_type_decl(parserstate *state, position comment_pos, VALUE annotation
1409
1409
/*
1410
1410
annotation ::= {<tANNOTATION>}
1411
1411
*/
1412
- VALUE parse_annotation (parserstate * state ) {
1412
+ static VALUE parse_annotation (parserstate * state ) {
1413
1413
VALUE content = rb_funcall (state -> buffer , rb_intern ("content" ), 0 );
1414
1414
rb_encoding * enc = rb_enc_get (content );
1415
1415
@@ -1465,7 +1465,7 @@ VALUE parse_annotation(parserstate *state) {
1465
1465
annotations ::= {} annotation ... <annotation>
1466
1466
| {<>}
1467
1467
*/
1468
- void parse_annotations (parserstate * state , VALUE * annotations , position * annot_pos ) {
1468
+ static void parse_annotations (parserstate * state , VALUE * annotations , position * annot_pos ) {
1469
1469
* annot_pos = NullPosition ;
1470
1470
1471
1471
while (true) {
@@ -1488,7 +1488,7 @@ void parse_annotations(parserstate *state, VALUE *annotations, position *annot_p
1488
1488
method_name ::= {} <IDENT | keyword>
1489
1489
| {} (IDENT | keyword)~<`?`>
1490
1490
*/
1491
- VALUE parse_method_name (parserstate * state , range * range ) {
1491
+ static VALUE parse_method_name (parserstate * state , range * range ) {
1492
1492
parser_advance (state );
1493
1493
1494
1494
switch (state -> current_token .type )
@@ -1556,7 +1556,7 @@ typedef enum {
1556
1556
1557
1557
@param allow_selfq `true` to accept `self?` kind.
1558
1558
*/
1559
- InstanceSingletonKind parse_instance_singleton_kind (parserstate * state , bool allow_selfq , range * rg ) {
1559
+ static InstanceSingletonKind parse_instance_singleton_kind (parserstate * state , bool allow_selfq , range * rg ) {
1560
1560
InstanceSingletonKind kind = INSTANCE_KIND ;
1561
1561
1562
1562
if (state -> next_token .type == kSELF ) {
@@ -1599,7 +1599,7 @@ InstanceSingletonKind parse_instance_singleton_kind(parserstate *state, bool all
1599
1599
* @param instance_only `true` to reject singleton method definition.
1600
1600
* @param accept_overload `true` to accept overloading (...) definition.
1601
1601
* */
1602
- VALUE parse_member_def (parserstate * state , bool instance_only , bool accept_overload , position comment_pos , VALUE annotations ) {
1602
+ static VALUE parse_member_def (parserstate * state , bool instance_only , bool accept_overload , position comment_pos , VALUE annotations ) {
1603
1603
range member_range ;
1604
1604
range visibility_range ;
1605
1605
range keyword_range ;
@@ -1779,7 +1779,7 @@ void class_instance_name(parserstate *state, TypeNameKind kind, VALUE *name, VAL
1779
1779
*
1780
1780
* @param from_interface `true` when the member is in an interface.
1781
1781
* */
1782
- VALUE parse_mixin_member (parserstate * state , bool from_interface , position comment_pos , VALUE annotations ) {
1782
+ static VALUE parse_mixin_member (parserstate * state , bool from_interface , position comment_pos , VALUE annotations ) {
1783
1783
range member_range ;
1784
1784
range name_range ;
1785
1785
range keyword_range ;
@@ -1861,7 +1861,7 @@ VALUE parse_mixin_member(parserstate *state, bool from_interface, position comme
1861
1861
*
1862
1862
* @param[in] instance_only `true` to reject `self.` alias.
1863
1863
* */
1864
- VALUE parse_alias_member (parserstate * state , bool instance_only , position comment_pos , VALUE annotations ) {
1864
+ static VALUE parse_alias_member (parserstate * state , bool instance_only , position comment_pos , VALUE annotations ) {
1865
1865
range member_range ;
1866
1866
range keyword_range , new_name_range , old_name_range ;
1867
1867
range new_kind_range , old_kind_range ;
@@ -1924,7 +1924,7 @@ VALUE parse_alias_member(parserstate *state, bool instance_only, position commen
1924
1924
| {kSELF} `.` tAIDENT `:` <type>
1925
1925
| {tA2IDENT} `:` <type>
1926
1926
*/
1927
- VALUE parse_variable_member (parserstate * state , position comment_pos , VALUE annotations ) {
1927
+ static VALUE parse_variable_member (parserstate * state , position comment_pos , VALUE annotations ) {
1928
1928
range member_range ;
1929
1929
range name_range , colon_range ;
1930
1930
range kind_range = NULL_RANGE ;
@@ -2024,7 +2024,7 @@ VALUE parse_variable_member(parserstate *state, position comment_pos, VALUE anno
2024
2024
visibility_member ::= {<`public`>}
2025
2025
| {<`private`>}
2026
2026
*/
2027
- VALUE parse_visibility_member (parserstate * state , VALUE annotations ) {
2027
+ static VALUE parse_visibility_member (parserstate * state , VALUE annotations ) {
2028
2028
if (rb_array_len (annotations ) > 0 ) {
2029
2029
raise_syntax_error (
2030
2030
state ,
@@ -2060,7 +2060,7 @@ VALUE parse_visibility_member(parserstate *state, VALUE annotations) {
2060
2060
| `(` tAIDENT `)` # Ivar name
2061
2061
| `(` `)` # No variable
2062
2062
*/
2063
- VALUE parse_attribute_member (parserstate * state , position comment_pos , VALUE annotations ) {
2063
+ static VALUE parse_attribute_member (parserstate * state , position comment_pos , VALUE annotations ) {
2064
2064
range member_range ;
2065
2065
range keyword_range , name_range , colon_range ;
2066
2066
range kind_range = NULL_RANGE , ivar_range = NULL_RANGE , ivar_name_range = NULL_RANGE , visibility_range = NULL_RANGE ;
@@ -2166,7 +2166,7 @@ VALUE parse_attribute_member(parserstate *state, position comment_pos, VALUE ann
2166
2166
| mixin_member (interface only)
2167
2167
| alias_member (instance only)
2168
2168
*/
2169
- VALUE parse_interface_members (parserstate * state ) {
2169
+ static VALUE parse_interface_members (parserstate * state ) {
2170
2170
VALUE members = EMPTY_ARRAY ;
2171
2171
2172
2172
while (state -> next_token .type != kEND ) {
@@ -2211,7 +2211,7 @@ VALUE parse_interface_members(parserstate *state) {
2211
2211
/*
2212
2212
interface_decl ::= {`interface`} interface_name module_type_params interface_members <kEND>
2213
2213
*/
2214
- VALUE parse_interface_decl (parserstate * state , position comment_pos , VALUE annotations ) {
2214
+ static VALUE parse_interface_decl (parserstate * state , position comment_pos , VALUE annotations ) {
2215
2215
range member_range ;
2216
2216
range name_range , keyword_range , end_range ;
2217
2217
range type_params_range = NULL_RANGE ;
@@ -2258,7 +2258,7 @@ VALUE parse_interface_decl(parserstate *state, position comment_pos, VALUE annot
2258
2258
module_self_type ::= <module_name>
2259
2259
| module_name `[` type_list <`]`>
2260
2260
*/
2261
- void parse_module_self_types (parserstate * state , VALUE * array ) {
2261
+ static void parse_module_self_types (parserstate * state , VALUE * array ) {
2262
2262
while (true) {
2263
2263
range self_range ;
2264
2264
range name_range ;
@@ -2298,7 +2298,7 @@ void parse_module_self_types(parserstate *state, VALUE *array) {
2298
2298
}
2299
2299
}
2300
2300
2301
- VALUE parse_nested_decl (parserstate * state , const char * nested_in , position annot_pos , VALUE annotations );
2301
+ static VALUE parse_nested_decl (parserstate * state , const char * nested_in , position annot_pos , VALUE annotations );
2302
2302
2303
2303
/*
2304
2304
module_members ::= {} ...<module_member> kEND
@@ -2311,7 +2311,7 @@ VALUE parse_nested_decl(parserstate *state, const char *nested_in, position anno
2311
2311
| `public`
2312
2312
| `private`
2313
2313
*/
2314
- VALUE parse_module_members (parserstate * state ) {
2314
+ static VALUE parse_module_members (parserstate * state ) {
2315
2315
VALUE members = EMPTY_ARRAY ;
2316
2316
2317
2317
while (state -> next_token .type != kEND ) {
@@ -2388,7 +2388,7 @@ VALUE parse_module_members(parserstate *state) {
2388
2388
module_decl ::= {module_name} module_type_params module_members <kEND>
2389
2389
| {module_name} module_name module_type_params `:` module_self_types module_members <kEND>
2390
2390
*/
2391
- VALUE parse_module_decl0 (parserstate * state , range keyword_range , VALUE module_name , range name_range , VALUE comment , VALUE annotations ) {
2391
+ static VALUE parse_module_decl0 (parserstate * state , range keyword_range , VALUE module_name , range name_range , VALUE comment , VALUE annotations ) {
2392
2392
range decl_range ;
2393
2393
range end_range ;
2394
2394
range type_params_range ;
@@ -2447,7 +2447,7 @@ VALUE parse_module_decl0(parserstate *state, range keyword_range, VALUE module_n
2447
2447
| {`module`} module_name module_decl0 <kEND>
2448
2448
2449
2449
*/
2450
- VALUE parse_module_decl (parserstate * state , position comment_pos , VALUE annotations ) {
2450
+ static VALUE parse_module_decl (parserstate * state , position comment_pos , VALUE annotations ) {
2451
2451
range keyword_range = state -> current_token .range ;
2452
2452
range module_name_range ;
2453
2453
@@ -2487,7 +2487,7 @@ VALUE parse_module_decl(parserstate *state, position comment_pos, VALUE annotati
2487
2487
class_decl_super ::= {} `<` <class_instance_name>
2488
2488
| {<>}
2489
2489
*/
2490
- VALUE parse_class_decl_super (parserstate * state , range * lt_range ) {
2490
+ static VALUE parse_class_decl_super (parserstate * state , range * lt_range ) {
2491
2491
if (parser_advance_if (state , pLT )) {
2492
2492
range super_range ;
2493
2493
range name_range ;
@@ -2522,7 +2522,7 @@ VALUE parse_class_decl_super(parserstate *state, range *lt_range) {
2522
2522
/*
2523
2523
class_decl ::= {class_name} type_params class_decl_super class_members <`end`>
2524
2524
*/
2525
- VALUE parse_class_decl0 (parserstate * state , range keyword_range , VALUE name , range name_range , VALUE comment , VALUE annotations ) {
2525
+ static VALUE parse_class_decl0 (parserstate * state , range keyword_range , VALUE name , range name_range , VALUE comment , VALUE annotations ) {
2526
2526
range decl_range ;
2527
2527
range end_range ;
2528
2528
range type_params_range ;
@@ -2573,7 +2573,7 @@ VALUE parse_class_decl0(parserstate *state, range keyword_range, VALUE name, ran
2573
2573
class_decl ::= {`class`} class_name `=` <class_name>
2574
2574
| {`class`} class_name <class_decl0>
2575
2575
*/
2576
- VALUE parse_class_decl (parserstate * state , position comment_pos , VALUE annotations ) {
2576
+ static VALUE parse_class_decl (parserstate * state , position comment_pos , VALUE annotations ) {
2577
2577
range keyword_range = state -> current_token .range ;
2578
2578
range class_name_range ;
2579
2579
@@ -2616,7 +2616,7 @@ VALUE parse_class_decl(parserstate *state, position comment_pos, VALUE annotatio
2616
2616
| {<module_decl>}
2617
2617
| {<class_decl>}
2618
2618
*/
2619
- VALUE parse_nested_decl (parserstate * state , const char * nested_in , position annot_pos , VALUE annotations ) {
2619
+ static VALUE parse_nested_decl (parserstate * state , const char * nested_in , position annot_pos , VALUE annotations ) {
2620
2620
VALUE decl ;
2621
2621
2622
2622
parser_push_typevar_table (state , true);
@@ -2654,7 +2654,7 @@ VALUE parse_nested_decl(parserstate *state, const char *nested_in, position anno
2654
2654
return decl ;
2655
2655
}
2656
2656
2657
- VALUE parse_decl (parserstate * state ) {
2657
+ static VALUE parse_decl (parserstate * state ) {
2658
2658
VALUE annotations = EMPTY_ARRAY ;
2659
2659
position annot_pos = NullPosition ;
2660
2660
@@ -2688,7 +2688,7 @@ VALUE parse_decl(parserstate *state) {
2688
2688
namespace ::= {} (`::`)? (`tUIDENT` `::`)* `tUIDENT` <`::`>
2689
2689
| {} <> (empty -- returns empty namespace)
2690
2690
*/
2691
- VALUE parse_namespace (parserstate * state , range * rg ) {
2691
+ static VALUE parse_namespace (parserstate * state , range * rg ) {
2692
2692
bool is_absolute = false;
2693
2693
2694
2694
if (state -> next_token .type == pCOLON2 ) {
@@ -2726,7 +2726,7 @@ VALUE parse_namespace(parserstate *state, range *rg) {
2726
2726
| {} namespace tUIDENT `as` <tUIDENT>
2727
2727
| {} namespace <tSTAR>
2728
2728
*/
2729
- void parse_use_clauses (parserstate * state , VALUE clauses ) {
2729
+ static void parse_use_clauses (parserstate * state , VALUE clauses ) {
2730
2730
while (true) {
2731
2731
range namespace_range = NULL_RANGE ;
2732
2732
VALUE namespace = parse_namespace (state , & namespace_range );
@@ -2819,7 +2819,7 @@ void parse_use_clauses(parserstate *state, VALUE clauses) {
2819
2819
/*
2820
2820
use_directive ::= {} `use` <clauses>
2821
2821
*/
2822
- VALUE parse_use_directive (parserstate * state ) {
2822
+ static VALUE parse_use_directive (parserstate * state ) {
2823
2823
if (state -> next_token .type == kUSE ) {
2824
2824
parser_advance (state );
2825
2825
0 commit comments