org.apache.royale.compiler.tree.as.INumericLiteralNode Maven / Gradle / Ivy
Show all versions of compiler Show documentation
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.royale.compiler.tree.as;
import org.apache.royale.compiler.constants.IASLanguageConstants.BuiltinType;
/**
* An AST node representing a numeric literal such as 3
,
* 0x1FFF
, or -1.23e10
.
*
* This node has no children.
*/
public interface INumericLiteralNode
{
/**
* Maximum value of the AS3 int
datatype
*/
static final int MAX_INT_VALUE = Integer.MAX_VALUE;
/**
* Minimum value of the AS3 int
datatype
*/
static final int MIN_INT_VALUE = Integer.MIN_VALUE;
/**
* Maximum value of the AS3 uint
datatype
*/
static final long MAX_UINT_VALUE = (long)Math.pow(2, 32) - 1l;
/**
* Maximum value of the AS3 Number
datatype
*/
static final double MAX_NUMBER_VALUE = 1.79769313486231e+308;
/**
* Minimum value of the AS3 Number
datatype
*/
static final double MIN_NUMBER_VALUE = 4.940656458412467e-324;
/**
* Represents the value of a numeric literal found in AS3 source
*/
static interface INumericValue
{
/**
* Returns the assumed type of this numeric value based on the range of
* the number. This does not take surrounding source, or program flow,
* into consideration
*
* @return either Number, int or uint
*/
public BuiltinType getAssumedType();
/**
* Returns the integral value of this number as an AS3
* Number
*
* @return an int
value
*/
public double toInteger();
/**
* Returns the value of this number as an AS3 int
*
* @return a int
value
*/
public int toInt32();
/**
* Returns the value of this number as an AS3 uint
*
* @return an uint
value
*/
public long toUint32();
/**
* Returns the value of this number as an AS3 Number
*
* @return an Number
value
*/
public double toNumber();
/**
* Returns the value of this number as a String
*
* @return the orginal string value of this number
*/
@Override
public String toString();
}
INumericValue getNumericValue() throws NumberFormatException;
}