Package org.jacorb.idl.runtime

Examples of org.jacorb.idl.runtime.long_token


                        }
                        catch( NumberFormatException ex )
                        {
                            try
                            {
                                return new long_token( sym.LONG_NUMBER,
                                                       Long.parseLong( str, radix ) );
                            }
                            catch( NumberFormatException ex2 )
                            {
                                emit_error( "Invalid octal/hex value:  " + str );
                            }
                        }
                        return null;
                    }
                }

                /* Try to scan integer, floating point or fixed point literals */

                if (isDigit (((char)next_char)) ||
                    next_char == '.'    ||
                    (next_char == '-' && isDigit (((char)next_char2))))
                {
                    StringBuffer value = new StringBuffer();
                    StringBuffer fraction = null;
                    int exp = 0;

                    if ( next_char == '-' )
                    {
                        value.append( (char)next_char );
                        advance();
                    }
                    // Read integer part
                    while( next_char >= '0' && next_char <= '9' )
                    {
                        value.append( (char)next_char );
                        advance();
                    }

                    // Read fraction
                    if( next_char == '.' )
                    {
                        fraction = new StringBuffer();
                        advance();

                        while( next_char >= '0' && next_char <= '9' )
                        {
                            fraction.append( (char)next_char );
                            advance();
                        }
                    }

                    // Read exponent
                    if( next_char == 'e' || next_char == 'E' )
                    {
                        if( fraction == null )
                            fraction = new StringBuffer();

                        fraction.append( 'e' );
                        advance();
                        if( next_char == '-' || next_char == '+' )
                        {
                            fraction.append( (char)next_char );
                            advance();
                        }

                        while( next_char >= '0' && next_char <= '9' )
                        {
                            fraction.append( (char)next_char );
                            advance();
                        }

                        if( fraction.length() == 1 )
                        {
                            emit_error( "Empty exponent in float/double." );
                            continue;
                        }

                        return new float_token( sym.FLOAT_NUMBER,
                                Float.valueOf( value.toString() +
                                "." +
                                fraction.toString() ).floatValue() );
                    }

                    if( next_char == 'd' || next_char == 'D' )
                    {
                        advance();
                        if( fraction == null )
                            fraction = new StringBuffer();

                        java.math.BigDecimal bi =
                                new java.math.BigDecimal( value.toString() + "." +
                                fraction.toString() );
                        return new fixed_token( sym.FIXED_NUMBER, bi );

                    }

                    if( fraction == null )
                    {
                        /* integer or long */

                        token tok = null;
                        String str = value.toString();

                        try
                        {
                            tok = new int_token( sym.NUMBER, Integer.parseInt( str ) );
                        }
                        catch( NumberFormatException ex )
                        {
                            try
                            {
                                tok = new long_token
                                    ( sym.LONG_NUMBER, Long.parseLong( str ) );
                            }
                            catch( NumberFormatException ex2 )
                            {
                                try
View Full Code Here


                    {
                        parser.error ("Value too big for unsigned long");
                    }
                    else
                    {
                        token = new long_token
                        (
                            ((fixed_token)token).sym,
                            ((fixed_token)token).fixed_val.longValue ()
                        );
                        string = Long.toString (((long_token)token).long_val);
View Full Code Here

                    {
                        parser.error ("Value too big for unsigned long");
                    }
                    else
                    {
                        token = new long_token
                        (
                            ((fixed_token)token).sym,
                            ((fixed_token)token).fixed_val.longValue ()
                        );
                        string = Long.toString (((long_token)token).long_val);
View Full Code Here

                    {
                        parser.error ("Value too big for unsigned long");
                    }
                    else
                    {
                        token = new long_token
                        (
                            ((fixed_token)token).sym,
                            ((fixed_token)token).fixed_val.longValue ()
                        );
                        string = Long.toString (((long_token)token).long_val);
View Full Code Here

                        }
                        catch( NumberFormatException ex )
                        {
                            try
                            {
                                return new long_token( sym.LONG_NUMBER,
                                                       Long.parseLong( str, radix ) );
                            }
                            catch( NumberFormatException ex2 )
                            {
                                emit_error( "Invalid octal/hex value:  " + str );
                            }
                        }
                        return null;
                    }
                }

                /* Try to scan integer, floating point or fixed point literals */

                if (isDigit (((char)next_char)) ||
                    next_char == '.'    ||
                    (next_char == '-' && isDigit (((char)next_char2))))
                {
                    StringBuffer value = new StringBuffer();
                    StringBuffer fraction = null;
                    int exp = 0;

                    if ( next_char == '-' )
                    {
                        value.append( (char)next_char );
                        advance();
                    }
                    // Read integer part
                    while( next_char >= '0' && next_char <= '9' )
                    {
                        value.append( (char)next_char );
                        advance();
                    }

                    // Read fraction
                    if( next_char == '.' )
                    {
                        fraction = new StringBuffer();
                        advance();

                        while( next_char >= '0' && next_char <= '9' )
                        {
                            fraction.append( (char)next_char );
                            advance();
                        }
                    }

                    // Read exponent
                    if( next_char == 'e' || next_char == 'E' )
                    {
                        if( fraction == null )
                            fraction = new StringBuffer();

                        fraction.append( 'e' );
                        advance();
                        if( next_char == '-' || next_char == '+' )
                        {
                            fraction.append( (char)next_char );
                            advance();
                        }

                        while( next_char >= '0' && next_char <= '9' )
                        {
                            fraction.append( (char)next_char );
                            advance();
                        }

                        if( fraction.length() == 1 )
                        {
                            emit_error( "Empty exponent in float/double." );
                            continue;
                        }

                        return new float_token( sym.FLOAT_NUMBER,
                                Float.valueOf( value.toString() +
                                "." +
                                fraction.toString() ).floatValue() );
                    }

                    if( next_char == 'd' || next_char == 'D' )
                    {
                        advance();
                        if( fraction == null )
                            fraction = new StringBuffer();

                        java.math.BigDecimal bi =
                                new java.math.BigDecimal( value.toString() + "." +
                                fraction.toString() );
                        return new fixed_token( sym.FIXED_NUMBER, bi );

                    }

                    if( fraction == null )
                    {
                        /* integer or long */

                        token tok = null;
                        String str = value.toString();

                        try
                        {
                            tok = new int_token( sym.NUMBER, Integer.parseInt( str ) );
                        }
                        catch( NumberFormatException ex )
                        {
                            try
                            {
                                tok = new long_token
                                    ( sym.LONG_NUMBER, Long.parseLong( str ) );
                            }
                            catch( NumberFormatException ex2 )
                            {
                                try
View Full Code Here

                            parser.error( "Value " + value.toString()
                                    + " is too big for unsigned long long" );
                        }
                        else if( primitiveToken instanceof fixed_token )
                        {
                            primitiveToken = new long_token
                            (
                                ((fixed_token)primitiveToken).sym,
                                ((fixed_token)primitiveToken).fixed_val.longValue ()
                            );
                            string = Long.toString (((long_token)primitiveToken).long_val);
View Full Code Here

                        }
                        catch( NumberFormatException ex )
                        {
                            try
                            {
                                return new long_token( sym.LONG_NUMBER,
                                                       Long.parseLong( str, radix ) );
                            }
                            catch( NumberFormatException ex2 )
                            {
                                emit_error( "Invalid octal/hex value:  " + str );
                            }
                        }
                        return null;
                    }
                }

                /* Try to scan integer, floating point or fixed point literals */

                if (isDigit (((char)next_char)) ||
                    next_char == '.'    ||
                    (next_char == '-' && isDigit (((char)next_char2))))
                {
                    StringBuffer value = new StringBuffer();
                    StringBuffer fraction = null;

                    if ( next_char == '-' )
                    {
                        value.append( (char)next_char );
                        advance();
                    }
                    // Read integer part
                    while( next_char >= '0' && next_char <= '9' )
                    {
                        value.append( (char)next_char );
                        advance();
                    }

                    // Read fraction
                    if( next_char == '.' )
                    {
                        fraction = new StringBuffer();
                        advance();

                        while( next_char >= '0' && next_char <= '9' )
                        {
                            fraction.append( (char)next_char );
                            advance();
                        }
                    }

                    // Read exponent
                    if( next_char == 'e' || next_char == 'E' )
                    {
                        if( fraction == null )
                            fraction = new StringBuffer();

                        fraction.append( 'e' );
                        advance();
                        if( next_char == '-' || next_char == '+' )
                        {
                            fraction.append( (char)next_char );
                            advance();
                        }

                        while( next_char >= '0' && next_char <= '9' )
                        {
                            fraction.append( (char)next_char );
                            advance();
                        }

                        if( fraction.length() == 1 )
                        {
                            emit_error( "Empty exponent in float/double." );
                            continue;
                        }

                        return new float_token( sym.FLOAT_NUMBER,
                                Float.valueOf( value.toString() +
                                "." +
                                fraction.toString() ).floatValue() );
                    }

                    if( next_char == 'd' || next_char == 'D' )
                    {
                        advance();
                        if( fraction == null )
                            fraction = new StringBuffer();

                        java.math.BigDecimal bi =
                                new java.math.BigDecimal( value.toString() + "." +
                                fraction.toString() );
                        return new fixed_token( sym.FIXED_NUMBER, bi );

                    }

                    if( fraction == null )
                    {
                        /* integer or long */

                        token tok = null;
                        String str = value.toString();

                        try
                        {
                            tok = new int_token( sym.NUMBER, Integer.parseInt( str ) );
                        }
                        catch( NumberFormatException ex )
                        {
                            try
                            {
                                tok = new long_token
                                    ( sym.LONG_NUMBER, Long.parseLong( str ) );
                            }
                            catch( NumberFormatException ex2 )
                            {
                                try
View Full Code Here

TOP

Related Classes of org.jacorb.idl.runtime.long_token

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.