lib/rbs/parser.y in rbs-1.2.1 vs lib/rbs/parser.y in rbs-1.3.0

- old
+ new

@@ -1,7 +1,7 @@ class RBS::Parser - token tUIDENT tLIDENT tNAMESPACE tINTERFACEIDENT tGLOBALIDENT + token tUIDENT tLIDENT tUNDERSCOREIDENT tNAMESPACE tINTERFACEIDENT tGLOBALIDENT tLKEYWORD tUKEYWORD tLKEYWORD_Q_E tUKEYWORD_Q_E tIVAR tCLASSVAR tANNOTATION tSTRING tSYMBOL tINTEGER tWRITE_ATTR kLPAREN kRPAREN kLBRACKET kRBRACKET kLBRACE kRBRACE @@ -10,10 +10,11 @@ kCOLON kCOLON2 kCOMMA kBAR kAMP kHAT kARROW kQUESTION kEXCLAMATION kSTAR kSTAR2 kFATARROW kEQ kDOT kDOT3 kLT kINTERFACE kEND kINCLUDE kEXTEND kATTRREADER kATTRWRITER kATTRACCESSOR tOPERATOR tQUOTEDMETHOD tQUOTEDIDENT kPREPEND kEXTENSION kINCOMPATIBLE type_TYPE type_SIGNATURE type_METHODTYPE tEOF kOUT kIN kUNCHECKED kOVERLOAD + kUNDERSCORE prechigh nonassoc kQUESTION left kAMP left kBAR @@ -1324,11 +1325,11 @@ location: loc ) } var_name_opt: - | tLIDENT | tINTERFACEIDENT | tQUOTEDIDENT + | tLIDENT | tINTERFACEIDENT | tQUOTEDIDENT | tUNDERSCOREIDENT | kUNDERSCORE qualified_name: namespace simple_name { namespace = val[0]&.value || Namespace.empty name = val[1].value.to_sym @@ -1711,15 +1712,19 @@ new_token(:tGLOBALIDENT) when input.scan(/@[a-zA-Z_]\w*/) new_token(:tIVAR, input.matched.to_sym) when input.scan(/@@[a-zA-Z_]\w*/) new_token(:tCLASSVAR, input.matched.to_sym) - when input.scan(/_[a-zA-Z]\w*\b/) + when input.scan(/_[A-Z]\w*\b/) new_token(:tINTERFACEIDENT) when input.scan(/[A-Z]\w*\b/) new_token(:tUIDENT) - when input.scan(/[a-z_]\w*\b/) + when input.scan(/[a-z]\w*\b/) new_token(:tLIDENT) + when input.scan(/_[a-z]\w*\b/) + new_token(:tUNDERSCOREIDENT) + when input.scan(/_/) + new_token(:kUNDERSCORE) when input.scan(/"(\\"|[^"])*"/) s = input.matched.yield_self {|s| s[1, s.length - 2] } .gsub(DBL_QUOTE_STR_ESCAPE_SEQUENCES_RE) do |match| case match when '\\a' then "\a"