AST
node type NumericLiteral

General Info

Production
NumericLiteral : Literal;
Type Hierarchy:
java.lang.Object
  extended by beaver.Symbol
      extended by AST.ASTNode<ASTNode>
          extended by AST.Expr
              extended by AST.PrimaryExpr
                  extended by AST.Literal
                      extended by AST.NumericLiteral
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<ASTNode>
Direct Known Subclasses:
DoubleLiteral, FloatingPointLiteral, IntegerLiteral, LongLiteral

Description

A NumericLiteral is a raw literal, produced by the parser. NumericLiterals are rewritten to the best matching concrete numeric literal kind, or IllegalLiteral.
Source
Declared in Java7Frontend/Literals.ast at line 18

Member Filters

API level:

Aspect:

Constructors

 
public NumericLiteral(java.lang.String p0)
 
public NumericLiteral(beaver.Symbol p0)
 

Attributes

syn 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.
Source
Declared in Java7Frontend/Literals.jrag at line 212
Aspect
Literals
Parse a hexadecimal long literal.
Throws:
java.lang.NumberFormatException - if the literal is too large.
Source
Declared in Java7Frontend/Literals.jrag at line 231
Aspect
Literals
syn long parseLongOctal()
Parse an octal long literal.
Throws:
java.lang.NumberFormatException - if the literal is too large.
Source
Declared in Java7Frontend/Literals.jrag at line 254
Aspect
Literals
syn long parseLongBinary()
Parse a binary long literal.
Throws:
java.lang.NumberFormatException - if the literal is too large.
Source
Declared in Java7Frontend/Literals.jrag at line 278
Aspect
Literals
syn long parseLongDecimal()
Parse an octal long literal.
Throws:
java.lang.NumberFormatException - if the literal is too large.
Source
Declared in Java7Frontend/Literals.jrag at line 296
Aspect
Literals
syn 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
Source
Declared in Java7Frontend/Literals.jrag at line 334
Aspect
Literals
syn boolean isNegative()
Source
Declared in Java7Frontend/Literals.jrag at line 371
Aspect
Literals
syn java.lang.String getDigits()
Get the trimmed digits of this literal, excluding underscore, prefix and suffix.
Source
Declared in Java7Frontend/Literals.jrag at line 377
Aspect
Literals
syn int getKind()
The literal kind tells which kind of literal it is; it's either a DECIMAL, HEXADECIMAL, OCTAL or BINARY literal.
Source
Declared in Java7Frontend/Literals.jrag at line 395
Aspect
Literals
syn int getRadix()
Get the radix of this literal.
Returns:
16 (hex), 10 (decimal), 8 (octal) or 2 (binary)
Source
Declared in Java7Frontend/Literals.jrag at line 414
Aspect
Literals
syn boolean isDecimal()
Returns:
true if the literal is a decimal literal
Source
Declared in Java7Frontend/Literals.jrag at line 431
Aspect
Literals
syn boolean isHex()
Returns:
true if the literal is a hexadecimal literal
Source
Declared in Java7Frontend/Literals.jrag at line 436
Aspect
Literals
syn boolean isOctal()
Returns:
true if the literal is an octal literal
Source
Declared in Java7Frontend/Literals.jrag at line 441
Aspect
Literals
syn boolean isBinary()
Returns:
true if the literal is a binary literal
Source
Declared in Java7Frontend/Literals.jrag at line 446
Aspect
Literals
syn 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
Source
Declared in Java7Frontend/Literals.jrag at line 463
Aspect
Literals

Methods

public void flushCache()
Overrides:flushCache in class Literal
public void flushCollectionCache()
Overrides:flushCollectionCache in class Literal
public NumericLiteral clone()
                     throws java.lang.CloneNotSupportedException
Overrides:clone in class Literal
Throws:
java.lang.CloneNotSupportedException
Overrides:copy in class ASTNode<ASTNode>
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
public void setDigits(java.lang.String digits)
Sets the trimmed digits of this literal.
Source
Declared in Java7Frontend/Literals.jrag at line 387
Aspect
Literals
public void setKind(int kind)
Sets the literal kind.
Source
Declared in Java7Frontend/Literals.jrag at line 406
Aspect
Literals
public Literal parse()
Parse a literal. If there is a syntax error in the literal, an IllegalLiteral will be returned.
public void init$Children()
Initializes the child array to the correct size. Initializes List and Opt nta children.
Overrides:init$Children in class Literal
protected int numChildren()
Overrides:numChildren in class Literal
public boolean mayHaveRewrite()
Overrides:mayHaveRewrite in class Literal
public void setLITERAL(java.lang.String value)
Replaces the lexeme LITERAL.
Overrides:setLITERAL in class Literal
Parameters:
value - The new value for the lexeme LITERAL.
public void setLITERAL(beaver.Symbol symbol)
JastAdd-internal setter for lexeme LITERAL using the Beaver parser.
Overrides:setLITERAL in class Literal
public java.lang.String getLITERAL()
Retrieves the value for the lexeme LITERAL.
Overrides:getLITERAL in class Literal
Returns:
The value for the lexeme LITERAL.
Overrides:rewriteTo in class Literal

Fields

public static final int DECIMAL
See Also:
Constant Field Values
Source
Declared in Java7Frontend/Literals.jrag at line 321
Aspect
Literals
public static final int HEXADECIMAL
See Also:
Constant Field Values
Source
Declared in Java7Frontend/Literals.jrag at line 322
Aspect
Literals
public static final int OCTAL
See Also:
Constant Field Values
Source
Declared in Java7Frontend/Literals.jrag at line 323
Aspect
Literals
public static final int BINARY
See Also:
Constant Field Values
Source
Declared in Java7Frontend/Literals.jrag at line 324
Aspect
Literals
protected java.lang.String digits
The trimmed digits.
protected int kind
The literal kind tells which kind of literal it is; it's either a DECIMAL, HEXADECIMAL, OCTAL or BINARY literal.
protected boolean type_computed

Inherited Members

Attributes inherited from AST.Literal

Attributes inherited from AST.Expr

Attributes inherited from AST.ASTNode

Methods inherited from class AST.Literal

Methods inherited from class AST.Expr

Methods inherited from class AST.ASTNode

Methods inherited from class beaver.Symbol

getColumn
getEnd
getId
getLine
getStart
makePosition

Methods inherited from class java.lang.Object

equals
finalize
getClass
hashCode
notify
notifyAll
wait
wait
wait

Fields inherited from AST.Literal

Fields inherited from AST.Expr

Fields inherited from AST.ASTNode

Fields inherited from beaver.Symbol

end
id
start
value