Package soot.JastAddJ

Class NumericLiteral

    • Field Detail

      • digits

        protected String digits
        The trimmed digits.
      • kind

        protected int kind
        The literal kind tells which kind of literal it is; it's either a DECIMAL, HEXADECIMAL, OCTAL or BINARY literal.
      • type_computed

        protected boolean type_computed
      • type_value

        protected TypeDecl type_value
    • Constructor Detail

      • NumericLiteral

        public NumericLiteral()
      • NumericLiteral

        public NumericLiteral​(String p0)
      • NumericLiteral

        public NumericLiteral​(Symbol p0)
    • Method Detail

      • fullCopy

        public NumericLiteral fullCopy()
        Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.
        Overrides:
        fullCopy in class ASTNode<ASTNode>
        Returns:
        dangling copy of the subtree at this node
      • setDigits

        public void setDigits​(String digits)
        Sets the trimmed digits of this literal.
      • setKind

        public void setKind​(int kind)
        Sets the literal kind.
      • parse

        public Literal parse()
        Parse a literal. If there is a syntax error in the literal, an IllegalLiteral will be returned.
      • init$Children

        public void init$Children()
        Initializes the child array to the correct size. Initializes List and Opt nta children.
        Overrides:
        init$Children in class Literal
      • setLITERAL

        public void setLITERAL​(String value)
        Replaces the lexeme LITERAL.
        Overrides:
        setLITERAL in class Literal
        Parameters:
        value - The new value for the lexeme LITERAL.
      • setLITERAL

        public void setLITERAL​(Symbol symbol)
        JastAdd-internal setter for lexeme LITERAL using the Beaver parser.
        Overrides:
        setLITERAL in class Literal
      • getLITERAL

        public String getLITERAL()
        Retrieves the value for the lexeme LITERAL.
        Overrides:
        getLITERAL in class Literal
        Returns:
        The value for the lexeme LITERAL.
      • parseLong

        public long parseLong()
        This is a refactored version of Literal.parseLong which supports binary literals. This version of parseLong is implemented as an attribute rather than a static method. Perhaps some slight performance boost could be gained from keeping it static, but with the loss of declarative- and ReRAGness. There exists only a parseLong, and not a parseInteger. Parsing of regular integer literals works the same, but with stricter bounds requirements on the resulting parsed value.
      • parseLongHexadecimal

        public long parseLongHexadecimal()
        Parse a hexadecimal long literal.
        Throws:
        NumberFormatException - if the literal is too large.
      • parseLongOctal

        public long parseLongOctal()
        Parse an octal long literal.
        Throws:
        NumberFormatException - if the literal is too large.
      • parseLongBinary

        public long parseLongBinary()
        Parse a binary long literal.
        Throws:
        NumberFormatException - if the literal is too large.
      • parseLongDecimal

        public long parseLongDecimal()
        Parse an octal long literal.
        Throws:
        NumberFormatException - if the literal is too large.
      • needsRewrite

        public boolean needsRewrite()
        Utility attribute for literal rewriting. Any of the NumericLiteral subclasses have already been rewritten and/or parsed, and should not be rewritten again.
        Returns:
        true if this literal is a "raw", not-yet-parsed NumericLiteral
      • isNegative

        public boolean isNegative()
      • getDigits

        public String getDigits()
        Get the trimmed digits of this literal, excluding underscore, prefix and suffix.
      • getKind

        public int getKind()
        The literal kind tells which kind of literal it is; it's either a DECIMAL, HEXADECIMAL, OCTAL or BINARY literal.
      • getRadix

        public int getRadix()
        Get the radix of this literal.
        Returns:
        16 (hex), 10 (decimal), 8 (octal) or 2 (binary)
      • isDecimal

        public boolean isDecimal()
        Returns:
        true if the literal is a decimal literal
      • isHex

        public boolean isHex()
        Returns:
        true if the literal is a hexadecimal literal
      • isOctal

        public boolean isOctal()
        Returns:
        true if the literal is an octal literal
      • isBinary

        public boolean isBinary()
        Returns:
        true if the literal is a binary literal
      • type

        public TypeDecl type()
        The type of a NumericLiteral is undefined. The literal must be parsed before it can have a type.
        Specified by:
        type in class Expr