case 281:
// line 1047 "DefaultRubyParser.y"
{
ISourcePosition position = support.union(((Token)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop]));
if (((Node)yyVals[-1+yyTop]) == null) {
yyVal = new ZArrayNode(position); /* zero length array */
} else {
yyVal = ((Node)yyVals[-1+yyTop]);
((ISourcePositionHolder)yyVal).setPosition(position);
}
}
break;
case 282:
// line 1056 "DefaultRubyParser.y"
{
yyVal = new HashNode(support.union(((Token)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop])), ((ListNode)yyVals[-1+yyTop]));
}
break;
case 283:
// line 1059 "DefaultRubyParser.y"
{
yyVal = new ReturnNode(((Token)yyVals[0+yyTop]).getPosition(), NilImplicitNode.NIL);
}
break;
case 284:
// line 1062 "DefaultRubyParser.y"
{
yyVal = support.new_yield(support.union(((Token)yyVals[-3+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-1+yyTop]));
}
break;
case 285:
// line 1065 "DefaultRubyParser.y"
{
yyVal = new YieldNode(support.union(((Token)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop])), null, false);
}
break;
case 286:
// line 1068 "DefaultRubyParser.y"
{
yyVal = new YieldNode(((Token)yyVals[0+yyTop]).getPosition(), null, false);
}
break;
case 287:
// line 1071 "DefaultRubyParser.y"
{
yyVal = new DefinedNode(getPosition(((Token)yyVals[-4+yyTop])), ((Node)yyVals[-1+yyTop]));
}
break;
case 288:
// line 1074 "DefaultRubyParser.y"
{
yyVal = new FCallNoArgBlockNode(support.union(((Token)yyVals[-1+yyTop]), ((IterNode)yyVals[0+yyTop])), (String) ((Token)yyVals[-1+yyTop]).getValue(), ((IterNode)yyVals[0+yyTop]));
}
break;
case 290:
// line 1078 "DefaultRubyParser.y"
{
if (((Node)yyVals[-1+yyTop]) != null &&
((BlockAcceptingNode)yyVals[-1+yyTop]).getIterNode() instanceof BlockPassNode) {
throw new SyntaxException(PID.BLOCK_ARG_AND_BLOCK_GIVEN, getPosition(((Node)yyVals[-1+yyTop])), "Both block arg and actual block given.");
}
yyVal = ((BlockAcceptingNode)yyVals[-1+yyTop]).setIterNode(((IterNode)yyVals[0+yyTop]));
((Node)yyVal).setPosition(support.union(((Node)yyVals[-1+yyTop]), ((IterNode)yyVals[0+yyTop])));
}
break;
case 291:
// line 1086 "DefaultRubyParser.y"
{
yyVal = new IfNode(support.union(((Token)yyVals[-5+yyTop]), ((Token)yyVals[0+yyTop])), support.getConditionNode(((Node)yyVals[-4+yyTop])), ((Node)yyVals[-2+yyTop]), ((Node)yyVals[-1+yyTop]));
}
break;
case 292:
// line 1089 "DefaultRubyParser.y"
{
yyVal = new IfNode(support.union(((Token)yyVals[-5+yyTop]), ((Token)yyVals[0+yyTop])), support.getConditionNode(((Node)yyVals[-4+yyTop])), ((Node)yyVals[-1+yyTop]), ((Node)yyVals[-2+yyTop]));
}
break;
case 293:
// line 1092 "DefaultRubyParser.y"
{
lexer.getConditionState().begin();
}
break;
case 294:
// line 1094 "DefaultRubyParser.y"
{
lexer.getConditionState().end();
}
break;
case 295:
// line 1096 "DefaultRubyParser.y"
{
Node body = ((Node)yyVals[-1+yyTop]) == null ? NilImplicitNode.NIL : ((Node)yyVals[-1+yyTop]);
yyVal = new WhileNode(support.union(((Token)yyVals[-6+yyTop]), ((Token)yyVals[0+yyTop])), support.getConditionNode(((Node)yyVals[-4+yyTop])), body);
}
break;
case 296:
// line 1100 "DefaultRubyParser.y"
{
lexer.getConditionState().begin();
}
break;
case 297:
// line 1102 "DefaultRubyParser.y"
{
lexer.getConditionState().end();
}
break;
case 298:
// line 1104 "DefaultRubyParser.y"
{
Node body = ((Node)yyVals[-1+yyTop]) == null ? NilImplicitNode.NIL : ((Node)yyVals[-1+yyTop]);
yyVal = new UntilNode(getPosition(((Token)yyVals[-6+yyTop])), support.getConditionNode(((Node)yyVals[-4+yyTop])), body);
}
break;
case 299:
// line 1108 "DefaultRubyParser.y"
{
yyVal = new CaseNode(support.union(((Token)yyVals[-4+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-3+yyTop]), ((Node)yyVals[-1+yyTop]));
}
break;
case 300:
// line 1111 "DefaultRubyParser.y"
{
/* TODO: MRI is just a when node. We need this extra logic for IDE consumers (null in casenode statement should be implicit nil)*/
/* if (support.getConfiguration().hasExtraPositionInformation()) {*/
yyVal = new CaseNode(support.union(((Token)yyVals[-3+yyTop]), ((Token)yyVals[0+yyTop])), null, ((Node)yyVals[-1+yyTop]));
/* } else {*/
/* $$ = $3;*/
/* }*/
}
break;
case 301:
// line 1119 "DefaultRubyParser.y"
{
yyVal = ((Node)yyVals[-1+yyTop]);
}
break;
case 302:
// line 1122 "DefaultRubyParser.y"
{
lexer.getConditionState().begin();
}
break;
case 303:
// line 1124 "DefaultRubyParser.y"
{
lexer.getConditionState().end();
}
break;
case 304:
// line 1126 "DefaultRubyParser.y"
{
yyVal = new ForNode(support.union(((Token)yyVals[-8+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-7+yyTop]), ((Node)yyVals[-1+yyTop]), ((Node)yyVals[-4+yyTop]));
}
break;
case 305:
// line 1129 "DefaultRubyParser.y"
{
if (support.isInDef() || support.isInSingle()) {
yyerror("class definition in method body");
}
support.pushLocalScope();
}
break;
case 306:
// line 1134 "DefaultRubyParser.y"
{
Node body = ((Node)yyVals[-1+yyTop]) == null ? NilImplicitNode.NIL : ((Node)yyVals[-1+yyTop]);
yyVal = new ClassNode(support.union(((Token)yyVals[-5+yyTop]), ((Token)yyVals[0+yyTop])), ((Colon3Node)yyVals[-4+yyTop]), support.getCurrentScope(), body, ((Node)yyVals[-3+yyTop]));
support.popCurrentScope();
}
break;
case 307:
// line 1140 "DefaultRubyParser.y"
{
yyVal = new Boolean(support.isInDef());
support.setInDef(false);
}
break;
case 308:
// line 1143 "DefaultRubyParser.y"
{
yyVal = new Integer(support.getInSingle());
support.setInSingle(0);
support.pushLocalScope();
}
break;
case 309:
// line 1147 "DefaultRubyParser.y"
{
yyVal = new SClassNode(support.union(((Token)yyVals[-7+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-5+yyTop]), support.getCurrentScope(), ((Node)yyVals[-1+yyTop]));
support.popCurrentScope();
support.setInDef(((Boolean)yyVals[-4+yyTop]).booleanValue());
support.setInSingle(((Integer)yyVals[-2+yyTop]).intValue());
}
break;
case 310:
// line 1153 "DefaultRubyParser.y"
{
if (support.isInDef() || support.isInSingle()) {
yyerror("module definition in method body");
}
support.pushLocalScope();
}
break;
case 311:
// line 1158 "DefaultRubyParser.y"
{
Node body = ((Node)yyVals[-1+yyTop]) == null ? NilImplicitNode.NIL : ((Node)yyVals[-1+yyTop]);
yyVal = new ModuleNode(support.union(((Token)yyVals[-4+yyTop]), ((Token)yyVals[0+yyTop])), ((Colon3Node)yyVals[-3+yyTop]), support.getCurrentScope(), body);
support.popCurrentScope();
}
break;
case 312:
// line 1164 "DefaultRubyParser.y"
{
support.setInDef(true);
support.pushLocalScope();
}
break;
case 313:
// line 1167 "DefaultRubyParser.y"
{
/* TODO: We should use implicit nil for body, but problem (punt til later)*/
Node body = ((Node)yyVals[-1+yyTop]); /*$5 == null ? NilImplicitNode.NIL : $5;*/
/* NOEX_PRIVATE for toplevel */
yyVal = new DefnNode(support.union(((Token)yyVals[-5+yyTop]), ((Token)yyVals[0+yyTop])), new ArgumentNode(((Token)yyVals[-4+yyTop]).getPosition(), (String) ((Token)yyVals[-4+yyTop]).getValue()), ((ArgsNode)yyVals[-2+yyTop]), support.getCurrentScope(), body);
support.popCurrentScope();
support.setInDef(false);
}
break;
case 314:
// line 1176 "DefaultRubyParser.y"
{
lexer.setState(LexState.EXPR_FNAME);
}
break;
case 315:
// line 1178 "DefaultRubyParser.y"
{
support.setInSingle(support.getInSingle() + 1);
support.pushLocalScope();
lexer.setState(LexState.EXPR_END); /* force for args */
}
break;
case 316:
// line 1182 "DefaultRubyParser.y"
{
/* TODO: We should use implicit nil for body, but problem (punt til later)*/
Node body = ((Node)yyVals[-1+yyTop]); /*$8 == null ? NilImplicitNode.NIL : $8;*/
yyVal = new DefsNode(support.union(((Token)yyVals[-8+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-7+yyTop]), new ArgumentNode(((Token)yyVals[-4+yyTop]).getPosition(), (String) ((Token)yyVals[-4+yyTop]).getValue()), ((ArgsNode)yyVals[-2+yyTop]), support.getCurrentScope(), body);
support.popCurrentScope();
support.setInSingle(support.getInSingle() - 1);
}
break;
case 317:
// line 1190 "DefaultRubyParser.y"
{
yyVal = new BreakNode(((Token)yyVals[0+yyTop]).getPosition(), NilImplicitNode.NIL);
}
break;
case 318:
// line 1193 "DefaultRubyParser.y"
{
yyVal = new NextNode(((Token)yyVals[0+yyTop]).getPosition(), NilImplicitNode.NIL);
}
break;
case 319:
// line 1196 "DefaultRubyParser.y"
{
yyVal = new RedoNode(((Token)yyVals[0+yyTop]).getPosition());
}
break;
case 320:
// line 1199 "DefaultRubyParser.y"
{
yyVal = new RetryNode(((Token)yyVals[0+yyTop]).getPosition());
}
break;
case 321:
// line 1203 "DefaultRubyParser.y"
{
support.checkExpression(((Node)yyVals[0+yyTop]));
yyVal = ((Node)yyVals[0+yyTop]);
}
break;
case 330:
// line 1218 "DefaultRubyParser.y"
{
/*mirko: support.union($<ISourcePositionHolder>1.getPosition(), getPosition($<ISourcePositionHolder>1)) ?*/
yyVal = new IfNode(getPosition(((Token)yyVals[-4+yyTop])), support.getConditionNode(((Node)yyVals[-3+yyTop])), ((Node)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 332:
// line 1224 "DefaultRubyParser.y"
{
yyVal = ((Node)yyVals[0+yyTop]);
}
break;
case 334:
// line 1229 "DefaultRubyParser.y"
{}
break;
case 336:
// line 1232 "DefaultRubyParser.y"
{
yyVal = new ZeroArgNode(support.union(((Token)yyVals[-1+yyTop]), ((Token)yyVals[0+yyTop])));
}
break;
case 337:
// line 1235 "DefaultRubyParser.y"
{
yyVal = new ZeroArgNode(((Token)yyVals[0+yyTop]).getPosition());
}
break;
case 338:
// line 1238 "DefaultRubyParser.y"
{
yyVal = ((Node)yyVals[-1+yyTop]);
/* Include pipes on multiple arg type*/
if (((Node)yyVals[-1+yyTop]) instanceof MultipleAsgnNode) {
((Node)yyVals[-1+yyTop]).setPosition(support.union(((Token)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop])));
}
}
break;
case 339:
// line 1247 "DefaultRubyParser.y"
{
support.pushBlockScope();
}
break;
case 340:
// line 1249 "DefaultRubyParser.y"
{
yyVal = new IterNode(support.union(((Token)yyVals[-4+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-2+yyTop]), support.getCurrentScope(), ((Node)yyVals[-1+yyTop]));
support.popCurrentScope();
}
break;
case 341:
// line 1255 "DefaultRubyParser.y"
{
if (((BlockAcceptingNode)yyVals[-1+yyTop]).getIterNode() instanceof BlockPassNode) {
throw new SyntaxException(PID.BLOCK_ARG_AND_BLOCK_GIVEN, getPosition(((Node)yyVals[-1+yyTop])), "Both block arg and actual block given.");
}
yyVal = ((BlockAcceptingNode)yyVals[-1+yyTop]).setIterNode(((IterNode)yyVals[0+yyTop]));
((Node)yyVal).setPosition(support.union(((Node)yyVals[-1+yyTop]), ((IterNode)yyVals[0+yyTop])));
}
break;
case 342:
// line 1262 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-3+yyTop]), ((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]), null);
}
break;
case 343:
// line 1265 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-3+yyTop]), ((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]), null);
}
break;
case 344:
// line 1269 "DefaultRubyParser.y"
{
yyVal = support.new_fcall(((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]), null);
}
break;
case 345:
// line 1272 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-3+yyTop]), ((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]), null);
}
break;
case 346:
// line 1275 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-3+yyTop]), ((Token)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]), null);
}
break;
case 347:
// line 1278 "DefaultRubyParser.y"
{
yyVal = support.new_call(((Node)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop]), null, null);
}
break;
case 348:
// line 1281 "DefaultRubyParser.y"
{
yyVal = support.new_super(((Node)yyVals[0+yyTop]), ((Token)yyVals[-1+yyTop]));
}
break;
case 349:
// line 1284 "DefaultRubyParser.y"
{
yyVal = new ZSuperNode(((Token)yyVals[0+yyTop]).getPosition());
}
break;
case 350:
// line 1289 "DefaultRubyParser.y"
{
support.pushBlockScope();
}
break;
case 351:
// line 1291 "DefaultRubyParser.y"
{
yyVal = new IterNode(support.union(((Token)yyVals[-4+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-2+yyTop]), support.getCurrentScope(), ((Node)yyVals[-1+yyTop]));
support.popCurrentScope();
}
break;
case 352:
// line 1295 "DefaultRubyParser.y"
{
support.pushBlockScope();
}
break;
case 353:
// line 1297 "DefaultRubyParser.y"
{
yyVal = new IterNode(support.union(((Token)yyVals[-4+yyTop]), ((Token)yyVals[0+yyTop])), ((Node)yyVals[-2+yyTop]), support.getCurrentScope(), ((Node)yyVals[-1+yyTop]));
((ISourcePositionHolder)yyVals[-5+yyTop]).setPosition(support.union(((ISourcePositionHolder)yyVals[-5+yyTop]), ((ISourcePositionHolder)yyVal)));
support.popCurrentScope();
}
break;
case 354:
// line 1303 "DefaultRubyParser.y"
{
yyVal = support.newWhenNode(support.union(((Token)yyVals[-4+yyTop]), support.unwrapNewlineNode(((Node)yyVals[-1+yyTop]))), ((ListNode)yyVals[-3+yyTop]), ((Node)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 356:
// line 1308 "DefaultRubyParser.y"
{
yyVal = ((ListNode)yyVals[-3+yyTop]).add(support.newWhenNode(getPosition(((ListNode)yyVals[-3+yyTop])), ((Node)yyVals[0+yyTop]), null, null));
}
break;
case 357:
// line 1311 "DefaultRubyParser.y"
{
yyVal = support.newArrayNode(getPosition(((Token)yyVals[-1+yyTop])), support.newWhenNode(getPosition(((Token)yyVals[-1+yyTop])), ((Node)yyVals[0+yyTop]), null, null));
}
break;
case 360:
// line 1318 "DefaultRubyParser.y"
{
Node node;
if (((Node)yyVals[-3+yyTop]) != null) {
node = support.appendToBlock(support.node_assign(((Node)yyVals[-3+yyTop]), new GlobalVarNode(getPosition(((Token)yyVals[-5+yyTop])), "$!")), ((Node)yyVals[-1+yyTop]));
if(((Node)yyVals[-1+yyTop]) != null) {
node.setPosition(support.unwrapNewlineNode(((Node)yyVals[-1+yyTop])).getPosition());
}
} else {
node = ((Node)yyVals[-1+yyTop]);
}
Node body = node == null ? NilImplicitNode.NIL : node;
yyVal = new RescueBodyNode(getPosition(((Token)yyVals[-5+yyTop]), true), ((Node)yyVals[-4+yyTop]), body, ((RescueBodyNode)yyVals[0+yyTop]));
}
break;
case 361:
// line 1331 "DefaultRubyParser.y"
{yyVal = null;}
break;
case 362:
// line 1333 "DefaultRubyParser.y"
{
yyVal = support.newArrayNode(((Node)yyVals[0+yyTop]).getPosition(), ((Node)yyVals[0+yyTop]));
}
break;
case 365:
// line 1339 "DefaultRubyParser.y"
{
yyVal = ((Node)yyVals[0+yyTop]);
}
break;
case 367:
// line 1344 "DefaultRubyParser.y"
{
if (((Node)yyVals[0+yyTop]) != null) {
yyVal = ((Node)yyVals[0+yyTop]);
} else {
yyVal = new NilNode(getPosition(null));
}
}
break;
case 370:
// line 1355 "DefaultRubyParser.y"
{
/* FIXME: We may be intern'ing more than once.*/
yyVal = new SymbolNode(((Token)yyVals[0+yyTop]).getPosition(), ((String) ((Token)yyVals[0+yyTop]).getValue()).intern());
}
break;
case 372:
// line 1362 "DefaultRubyParser.y"
{
yyVal = ((Node)yyVals[0+yyTop]) instanceof EvStrNode ? new DStrNode(getPosition(((Node)yyVals[0+yyTop]))).add(((Node)yyVals[0+yyTop])) : ((Node)yyVals[0+yyTop]);
}
break;
case 374:
// line 1368 "DefaultRubyParser.y"
{
yyVal = support.literal_concat(getPosition(((Node)yyVals[-1+yyTop])), ((Node)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 375:
// line 1373 "DefaultRubyParser.y"
{
yyVal = ((Node)yyVals[-1+yyTop]);
((ISourcePositionHolder)yyVal).setPosition(support.union(((Token)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop])));
int extraLength = ((String) ((Token)yyVals[-2+yyTop]).getValue()).length() - 1;
/* We may need to subtract addition offset off of first */
/* string fragment (we optimistically take one off in*/
/* ParserSupport.literal_concat). Check token length*/
/* and subtract as neeeded.*/
if ((((Node)yyVals[-1+yyTop]) instanceof DStrNode) && extraLength > 0) {
Node strNode = ((DStrNode)((Node)yyVals[-1+yyTop])).get(0);
assert strNode != null;
strNode.getPosition().adjustStartOffset(-extraLength);
}
}
break;
case 376:
// line 1390 "DefaultRubyParser.y"
{
ISourcePosition position = support.union(((Token)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop]));
if (((Node)yyVals[-1+yyTop]) == null) {
yyVal = new XStrNode(position, null);
} else if (((Node)yyVals[-1+yyTop]) instanceof StrNode) {
yyVal = new XStrNode(position, (ByteList) ((StrNode)yyVals[-1+yyTop]).getValue().clone());
} else if (((Node)yyVals[-1+yyTop]) instanceof DStrNode) {
yyVal = new DXStrNode(position, ((DStrNode)yyVals[-1+yyTop]));
((Node)yyVal).setPosition(position);
} else {
yyVal = new DXStrNode(position).add(((Node)yyVals[-1+yyTop]));
}
}
break;
case 377:
// line 1407 "DefaultRubyParser.y"
{
int options = ((RegexpNode)yyVals[0+yyTop]).getOptions();
Node node = ((Node)yyVals[-1+yyTop]);
if (node == null) {
yyVal = new RegexpNode(getPosition(((Token)yyVals[-2+yyTop])), ByteList.create(""), options & ~ReOptions.RE_OPTION_ONCE);
} else if (node instanceof StrNode) {
yyVal = new RegexpNode(((Node)yyVals[-1+yyTop]).getPosition(), (ByteList) ((StrNode) node).getValue().clone(), options & ~ReOptions.RE_OPTION_ONCE);
} else if (node instanceof DStrNode) {
yyVal = new DRegexpNode(getPosition(((Token)yyVals[-2+yyTop])), (DStrNode) node, options, (options & ReOptions.RE_OPTION_ONCE) != 0);
} else {
yyVal = new DRegexpNode(getPosition(((Token)yyVals[-2+yyTop])), options, (options & ReOptions.RE_OPTION_ONCE) != 0).add(node);
}
}
break;
case 378:
// line 1423 "DefaultRubyParser.y"
{
yyVal = new ZArrayNode(support.union(((Token)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop])));
}
break;
case 379:
// line 1426 "DefaultRubyParser.y"
{
yyVal = ((ListNode)yyVals[-1+yyTop]);
((ISourcePositionHolder)yyVal).setPosition(support.union(((Token)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop])));
}
break;
case 380:
// line 1432 "DefaultRubyParser.y"
{
yyVal = new ArrayNode(getPosition(null));
}
break;
case 381:
// line 1435 "DefaultRubyParser.y"
{
yyVal = ((ListNode)yyVals[-2+yyTop]).add(((Node)yyVals[-1+yyTop]) instanceof EvStrNode ? new DStrNode(getPosition(((ListNode)yyVals[-2+yyTop]))).add(((Node)yyVals[-1+yyTop])) : ((Node)yyVals[-1+yyTop]));
}
break;
case 383:
// line 1440 "DefaultRubyParser.y"
{
yyVal = support.literal_concat(getPosition(((Node)yyVals[-1+yyTop])), ((Node)yyVals[-1+yyTop]), ((Node)yyVals[0+yyTop]));
}
break;
case 384:
// line 1445 "DefaultRubyParser.y"
{
yyVal = new ZArrayNode(support.union(((Token)yyVals[-2+yyTop]), ((Token)yyVals[0+yyTop])));
}
break;
case 385:
// line 1448 "DefaultRubyParser.y"
{