Package org.jruby.ast

Examples of org.jruby.ast.FixnumNode


                throw new NotCompilableException("ERROR: Encountered a method with a non-block, non-blockpass iter node at: " + node);
        }
    }

    public void compileFixnum(Node node, BodyCompiler context, boolean expr) {
        FixnumNode fixnumNode = (FixnumNode) node;

        if (expr) context.createNewFixnum(fixnumNode.getValue());
    }
View Full Code Here


    private Object newBignumNode(String value, int radix) {
        return new BignumNode(getPosition(), new BigInteger(value, radix));
    }

    private Object newFixnumNode(String value, int radix) throws NumberFormatException {
        return new FixnumNode(getPosition(), Long.parseLong(value, radix));
    }
View Full Code Here

        }
       
        setState(LexState.EXPR_END);
        if (isOneEight) {
            c &= 0xff;
            yaccValue = new FixnumNode(getPosition(), c);
        } else {
            // TODO: this isn't handling multibyte yet
            ByteList oneCharBL = new ByteList(1);
            oneCharBL.append(c);
            yaccValue = new StrNode(getPosition(), oneCharBL);
View Full Code Here

                case 'E' :
                  tokenBuffer.append('0');
                    break;
                default :
                    src.unread(c);
                    yaccValue = new FixnumNode(getPosition(), 0);
                    return Tokens.tINTEGER;
            }
        }

        boolean seen_point = false;
View Full Code Here

            return new FalseNode(token.getPosition());
        case Tokens.k__FILE__:
            return new FileNode(token.getPosition(), new ByteList(token.getPosition().getFile().getBytes(),
                    getConfiguration().getRuntime().getEncodingService().getLocaleEncoding()));
        case Tokens.k__LINE__:
            return new FixnumNode(token.getPosition(), token.getPosition().getStartLine()+1);
        case Tokens.k__ENCODING__:
            return new EncodingNode(token.getPosition(), lexer.getEncoding());
        case Tokens.tIDENTIFIER:
            return currentScope.declare(token.getPosition(), (String) token.getValue());
        case Tokens.tCONSTANT:
View Full Code Here

        return new YieldNode(position, node, state);
    }
   
    public Node negateInteger(Node integerNode) {
        if (integerNode instanceof FixnumNode) {
            FixnumNode fixnumNode = (FixnumNode) integerNode;
           
            fixnumNode.setValue(-fixnumNode.getValue());
            return fixnumNode;
        } else if (integerNode instanceof BignumNode) {
            BignumNode bignumNode = (BignumNode) integerNode;

            BigInteger value = bignumNode.getValue().negate();

            // Negating a bignum will make the last negative value of our bignum
            if (value.compareTo(RubyBignum.LONG_MIN) >= 0) {
                return new FixnumNode(bignumNode.getPosition(), value.longValue());
            }
           
            bignumNode.setValue(value);
        }
       
View Full Code Here

    private Object newBignumNode(String value, int radix) {
        return new BignumNode(getPosition(), new BigInteger(value, radix));
    }

    private Object newFixnumNode(String value, int radix) throws NumberFormatException {
        return new FixnumNode(getPosition(), Long.parseLong(value, radix));
    }
View Full Code Here

        }
       
        setState(LexState.EXPR_END);
        if (isOneEight) {
            c &= 0xff;
            yaccValue = new FixnumNode(getPosition(), c);
        } else {
            // TODO: this isn't handling multibyte yet
            ByteList oneCharBL = new ByteList(1);
            oneCharBL.append(c);
            yaccValue = new StrNode(getPosition(), oneCharBL);
View Full Code Here

                case 'E' :
                  tokenBuffer.append('0');
                    break;
                default :
                    src.unread(c);
                    yaccValue = new FixnumNode(getPosition(), 0);
                    return Tokens.tINTEGER;
            }
        }

        boolean seen_point = false;
View Full Code Here

    private BignumNode newBignumNode(String value, int radix) {
        return new BignumNode(getPosition(), new BigInteger(value, radix));
    }

    private FixnumNode newFixnumNode(String value, int radix) throws NumberFormatException {
        return new FixnumNode(getPosition(), Long.parseLong(value, radix));
    }
View Full Code Here

TOP

Related Classes of org.jruby.ast.FixnumNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.