public Node new_call(Node receiver, ByteList callType, ByteList name, Node argsNode, Node iter) { if (argsNode instanceof BlockPassNode) { if (iter != null) lexer.compile_error(PID.BLOCK_ARG_AND_BLOCK_GIVEN, "Both block arg and actual block given."); BlockPassNode blockPass = (BlockPassNode) argsNode; return new CallNode(position(receiver, argsNode), receiver, symbolID(name), blockPass.getArgsNode(), blockPass, isLazy(callType)); } return new CallNode(position(receiver, argsNode), receiver, symbolID(name), argsNode, iter, isLazy(callType)); }
public Node new_super(Node args, Token operation) { if (args != null && args instanceof BlockPassNode) { return new SuperNode(position(operation, args), ((BlockPassNode) args).getArgsNode(), args); } return new SuperNode(operation.getPosition(), args); }
private Node new_call_noargs(Node receiver, Token name, IterNode iter) { ISourcePosition position = position(receiver, name); if (receiver == null) receiver = NilImplicitNode.NIL; if (iter != null) return new CallNoArgBlockNode(position, receiver, (String) name.getValue(), iter); return new CallNoArgNode(position, receiver, (String) name.getValue()); }
private Node new_call_complexargs(Node receiver, Token name, Node args, Node iter) { if (args instanceof BlockPassNode) { // Block and block pass passed in at same time....uh oh if (iter != null) { throw new SyntaxException(PID.BLOCK_ARG_AND_BLOCK_GIVEN, iter.getPosition(), lexer.getCurrentLine(), "Both block arg and actual block given."); } return new_call_blockpass(receiver, name, (BlockPassNode) args); } if (iter != null) return new CallSpecialArgBlockNode(position(receiver, args), receiver,(String) name.getValue(), args, (IterNode) iter); return new CallSpecialArgNode(position(receiver, args), receiver, (String) name.getValue(), args); }
public Node new_aref(Node receiver, Token name, Node argsNode) { if (argsNode instanceof ArrayNode) { ArrayNode args = (ArrayNode) argsNode; if (args.size() == 1 && args.get(0) instanceof FixnumNode) { return new CallOneArgFixnumNode(position(receiver, args), receiver, "[]", args); } } return new_call(receiver, name, argsNode, null); }
private Node new_call_noargs(Node receiver, Token name, IterNode iter) { ISourcePosition position = position(receiver, name); if (receiver == null) receiver = NilImplicitNode.NIL; if (iter != null) return new CallNoArgBlockNode(position, receiver, (String) name.getValue(), iter); return new CallNoArgNode(position, receiver, (String) name.getValue()); }
public Node new_super(Node args, Token operation) { if (args != null && args instanceof BlockPassNode) { return new SuperNode(position(operation, args), ((BlockPassNode) args).getArgsNode(), args); } return new SuperNode(operation.getPosition(), args); }
public Node new_call(Node receiver, ByteList callType, ByteList name, Node argsNode, Node iter) { if (argsNode instanceof BlockPassNode) { if (iter != null) lexer.compile_error(PID.BLOCK_ARG_AND_BLOCK_GIVEN, "Both block arg and actual block given."); BlockPassNode blockPass = (BlockPassNode) argsNode; return new CallNode(position(receiver, argsNode), receiver, symbolID(name), blockPass.getArgsNode(), blockPass, isLazy(callType)); } return new CallNode(position(receiver, argsNode), receiver, symbolID(name), argsNode, iter, isLazy(callType)); }
public AndNode newAndNode(ISourcePosition position, Node left, Node right) { value_expr(lexer, left); if (left == null && right == null) return new AndNode(position, makeNullNil(left), makeNullNil(right)); return new AndNode(position(left, right), makeNullNil(left), makeNullNil(right)); }
public OrNode newOrNode(ISourcePosition position, Node left, Node right) { value_expr(lexer, left); if (left == null && right == null) return new OrNode(position, makeNullNil(left), makeNullNil(right)); return new OrNode(position(left, right), makeNullNil(left), makeNullNil(right)); }
public OrNode newOrNode(ISourcePosition position, Node left, Node right) { value_expr(lexer, left); if (left == null && right == null) return new OrNode(position, makeNullNil(left), makeNullNil(right)); return new OrNode(position(left, right), makeNullNil(left), makeNullNil(right)); }
public AndNode newAndNode(ISourcePosition position, Node left, Node right) { value_expr(lexer, left); if (left == null && right == null) return new AndNode(position, makeNullNil(left), makeNullNil(right)); return new AndNode(position(left, right), makeNullNil(left), makeNullNil(right)); }
public AndNode newAndNode(ISourcePosition position, Node left, Node right) { checkExpression(left); if (left == null && right == null) return new AndNode(position, makeNullNil(left), makeNullNil(right)); return new AndNode(position(left, right), makeNullNil(left), makeNullNil(right)); }
public OrNode newOrNode(ISourcePosition position, Node left, Node right) { checkExpression(left); if (left == null && right == null) return new OrNode(position, makeNullNil(left), makeNullNil(right)); return new OrNode(position(left, right), makeNullNil(left), makeNullNil(right)); }
public Node new_fcall(Token operation, Node args, Node iter) { if (args == null) return new_fcall_noargs(operation, (IterNode) iter); if (args instanceof ArrayNode) return new_fcall_simpleargs(operation, (ArrayNode) args, iter); if (args instanceof BlockPassNode) { if (iter == null) return new_fcall_blockpass(operation, (BlockPassNode) args); throw new SyntaxException(PID.BLOCK_ARG_AND_BLOCK_GIVEN, iter.getPosition(), lexer.getCurrentLine(), "Both block arg and actual block given."); } return new FCallSpecialArgNode(position(operation, args), (String) operation.getValue(), args); }
public Node new_fcall(Token operation, Node args, Node iter) { if (args == null) return new_fcall_noargs(operation, (IterNode) iter); if (args instanceof ArrayNode) return new_fcall_simpleargs(operation, (ArrayNode) args, iter); if (args instanceof BlockPassNode) { if (iter == null) return new_fcall_blockpass(operation, (BlockPassNode) args); throw new SyntaxException(PID.BLOCK_ARG_AND_BLOCK_GIVEN, iter.getPosition(), lexer.getCurrentLine(), "Both block arg and actual block given."); } return new FCallSpecialArgNode(position(operation, args), (String) operation.getValue(), args); }
public Node arg_append(Node node1, Node node2) { if (node1 == null) return new ArrayNode(node2.getPosition(), node2); if (node1 instanceof ListNode) return ((ListNode) node1).add(node2); if (node1 instanceof BlockPassNode) return arg_append(((BlockPassNode) node1).getBodyNode(), node2); if (node1 instanceof ArgsPushNode) { ArgsPushNode pushNode = (ArgsPushNode) node1; Node body = pushNode.getSecondNode(); return new ArgsCatNode(pushNode.getPosition(), pushNode.getFirstNode(), new ArrayNode(body.getPosition(), body).add(node2)); } return new ArgsPushNode(position(node1, node2), node1, node2); }
public Node arg_append(Node node1, Node node2) { if (node1 == null) return new ArrayNode(node2.getPosition(), node2); if (node1 instanceof ListNode) return ((ListNode) node1).add(node2); if (node1 instanceof BlockPassNode) return arg_append(((BlockPassNode) node1).getBodyNode(), node2); if (node1 instanceof ArgsPushNode) { ArgsPushNode pushNode = (ArgsPushNode) node1; Node body = pushNode.getSecondNode(); return new ArgsCatNode(pushNode.getPosition(), pushNode.getFirstNode(), new ArrayNode(body.getPosition(), body).add(node2)); } return new ArgsPushNode(position(node1, node2), node1, node2); }
public Node arg_append(Node node1, Node node2) { if (node1 == null) return new ArrayNode(node2.getPosition(), node2); if (node1 instanceof ListNode) return ((ListNode) node1).add(node2); if (node1 instanceof BlockPassNode) return arg_append(((BlockPassNode) node1).getBodyNode(), node2); if (node1 instanceof ArgsPushNode) { ArgsPushNode pushNode = (ArgsPushNode) node1; Node body = pushNode.getSecondNode(); return new ArgsCatNode(pushNode.getPosition(), pushNode.getFirstNode(), new ArrayNode(body.getPosition(), body).add(node2)); } return new ArgsPushNode(position(node1, node2), node1, node2); }
public Node arg_append(Node node1, Node node2) { if (node1 == null) return new ArrayNode(node2.getPosition(), node2); if (node1 instanceof ListNode) return ((ListNode) node1).add(node2); if (node1 instanceof BlockPassNode) return arg_append(((BlockPassNode) node1).getBodyNode(), node2); if (node1 instanceof ArgsPushNode) { ArgsPushNode pushNode = (ArgsPushNode) node1; Node body = pushNode.getSecondNode(); return new ArgsCatNode(pushNode.getPosition(), pushNode.getFirstNode(), new ArrayNode(body.getPosition(), body).add(node2)); } return new ArgsPushNode(position(node1, node2), node1, node2); }