lib/ruby_parser.yy in ruby_parser-3.15.1 vs lib/ruby_parser.yy in ruby_parser-3.16.0
- old
+ new
@@ -14,10 +14,12 @@
class Ruby25Parser
#elif V == 26
class Ruby26Parser
#elif V == 27
class Ruby27Parser
+#elif V == 30
+class Ruby30Parser
#else
fail "version not specified or supported on code generation"
#endif
token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
@@ -44,10 +46,13 @@
tLABEL_END
#endif
#if V >= 23
tLONELY
#endif
+#if V >= 26
+ tBDOT2 tBDOT3
+#endif
preclow
nonassoc tLOWEST
nonassoc tLBRACE_ARG
nonassoc kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
@@ -55,11 +60,11 @@
right kNOT
nonassoc kDEFINED
right tEQL tOP_ASGN
left kRESCUE_MOD
right tEH tCOLON
- nonassoc tDOT2 tDOT3
+ nonassoc tDOT2 tDOT3 tBDOT2 tBDOT3
left tOROP
left tANDOP
nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
left tGT tGEQ tLT tLEQ
left tPIPE tCARET
@@ -78,10 +83,13 @@
self.lexer.lex_state = EXPR_BEG
}
top_compstmt
{
result = new_compstmt val
+
+ lexer.cond.pop # local_pop
+ lexer.cmdarg.pop
}
top_compstmt: top_stmts opt_terms
{
stmt, _ = val
@@ -854,9 +862,27 @@
v2 = nil
result = s(:dot3, v1, v2).line v1.line
}
#endif
+
+#if V >= 27
+ | tBDOT2 arg
+ {
+ _, v2, = val
+ v1 = nil
+
+ result = s(:dot2, v1, v2).line v2.line
+ }
+ | tBDOT3 arg
+ {
+ _, v2 = val
+ v1 = nil
+
+ result = s(:dot3, v1, v2).line v2.line
+ }
+#endif
+
| arg tPLUS arg
{
result = new_call val[0], :+, argl(val[2])
}
| arg tMINUS arg