lib/rbs/parser.y in rbs-0.4.0 vs lib/rbs/parser.y in rbs-0.5.0
- old
+ new
@@ -8,11 +8,11 @@
kPRIVATE kPUBLIC kALIAS
kCOLON kCOLON2 kCOMMA kBAR kAMP kHAT kARROW kQUESTION kEXCLAMATION kSTAR kSTAR2 kFATARROW kEQ kDOT kLT
kINTERFACE kEND kINCLUDE kEXTEND kATTRREADER kATTRWRITER kATTRACCESSOR tOPERATOR tQUOTEDMETHOD tQUOTEDIDENT
kPREPEND kEXTENSION kINCOMPATIBLE
type_TYPE type_SIGNATURE type_METHODTYPE tEOF
- kOUT kIN kUNCHECKED
+ kOUT kIN kUNCHECKED kOVERLOAD
prechigh
nonassoc kQUESTION
left kAMP
left kBAR
@@ -159,10 +159,11 @@
}
| kPRIVATE {
result = Members::Private.new(location: val[0].location)
}
| alias_member
+ | signature
attribute_member:
annotations kATTRREADER keyword type {
location = val[1].location + val[3].location
result = Members::AttrReader.new(name: val[2].value,
@@ -384,29 +385,32 @@
annotations: val[0],
location: location,
comment: leading_comment(val[0].first&.location || location))
}
+ overload: { result = nil } | kOVERLOAD
+
method_member:
- annotations attributes kDEF method_kind def_name method_types {
- location = val[2].location + val[5].last.location
- types = val[5].map do |type|
+ annotations attributes overload kDEF method_kind def_name method_types {
+ location = val[3].location + val[6].last.location
+ types = val[6].map do |type|
case type
when LocatedValue
type.value
else
type
end
end
result = Members::MethodDefinition.new(
- name: val[4].value,
- kind: val[3],
+ name: val[5].value,
+ kind: val[4],
types: types,
annotations: val[0],
location: location,
- comment: leading_comment(val[0].first&.location || val[1].first&.location || val[2].location),
- attributes: val[1].map(&:value)
+ comment: leading_comment(val[0].first&.location || val[1].first&.location || val[2]&.location || val[3].location),
+ attributes: val[1].map(&:value),
+ overload: !!val[2]
)
}
attributes:
{ result = [] }
@@ -504,11 +508,11 @@
identifier_keywords:
kCLASS | kVOID | kNIL | kTRUE | kFALSE | kANY | kUNTYPED | kTOP | kBOT | kINSTANCE | kBOOL | kSINGLETON
| kTYPE | kMODULE | kPRIVATE | kPUBLIC | kEND | kINCLUDE | kEXTEND | kPREPEND
| kATTRREADER | kATTRACCESSOR | kATTRWRITER | kDEF | kEXTENSION | kSELF | kINCOMPATIBLE
- | kUNCHECKED | kINTERFACE | kSUPER | kALIAS | kOUT | kIN
+ | kUNCHECKED | kINTERFACE | kSUPER | kALIAS | kOUT | kIN | kOVERLOAD
module_type_params:
{ result = nil }
| kLBRACKET module_type_params0 kRBRACKET {
val[1].each {|p| insert_bound_variable(p.name) }
@@ -1171,9 +1175,10 @@
"private" => :kPRIVATE,
"alias" => :kALIAS,
"extension" => :kEXTENSION,
"incompatible" => :kINCOMPATIBLE,
"unchecked" => :kUNCHECKED,
+ "overload" => :kOVERLOAD,
"out" => :kOUT,
"in" => :kIN,
}
KEYWORDS_RE = /#{Regexp.union(*KEYWORDS.keys)}\b/