org.extendj.ast
node type NumericLiteral

General Info

Production
NumericLiteral : Literal;
Type Hierarchy:
java.lang.Object
  extended by beaver.Symbol
      extended by org.extendj.ast.ASTNode<ASTNode>
          extended by org.extendj.ast.Expr
              extended by org.extendj.ast.PrimaryExpr
                  extended by org.extendj.ast.Literal
                      extended by org.extendj.ast.NumericLiteral
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<ASTNode>, org.jastadd.util.PrettyPrintable
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 /home/jesper/git/extendj/java7/grammar/Literals.ast at line 18

Member Filters

API level:

Aspect:

Constructors

public NumericLiteral()
 
Source
Declared in /home/jesper/git/extendj/ASTNode at line 1
public NumericLiteral(java.lang.String p0)
 
Source
Declared in /home/jesper/git/extendj/ASTNode at line 12
public NumericLiteral(beaver.Symbol p0)
 
Source
Declared in /home/jesper/git/extendj/ASTNode at line 15

Attributes

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 /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 241
Aspect
Java7Literals
Parse a hexadecimal long literal.
Throws:
java.lang.NumberFormatException - if the literal is too large.
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 260
Aspect
Java7Literals
Parse an octal long literal.
Throws:
java.lang.NumberFormatException - if the literal is too large.
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 285
Aspect
Java7Literals
Parse a binary long literal.
Throws:
java.lang.NumberFormatException - if the literal is too large.
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 311
Aspect
Java7Literals
Parse a decimal long literal.
Throws:
java.lang.NumberFormatException - if the literal is too large.
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 331
Aspect
Java7Literals
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 /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 373
Aspect
Java7Literals
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 410
Aspect
Java7Literals
@ASTNodeAnnotation.Attribute
syn java.lang.String getDigits()
Get the trimmed digits of this literal, excluding underscore, prefix and suffix.
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 416
Aspect
Java7Literals
The literal kind tells which kind of literal it is; either a DECIMAL, HEXADECIMAL, OCTAL or BINARY literal.
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 434
Aspect
Java7Literals
Get the radix of this literal.
Returns:
16 (hex), 10 (decimal), 8 (octal) or 2 (binary)
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 453
Aspect
Java7Literals
Returns:
true if the literal is a decimal literal
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 470
Aspect
Java7Literals
Returns:
true if the literal is a hexadecimal literal
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 475
Aspect
Java7Literals
Returns:
true if the literal is an octal literal
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 480
Aspect
Java7Literals
Returns:
true if the literal is a binary literal
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 485
Aspect
Java7Literals
Specified by:type in class Expr
Source
Declared in /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag at line 302
Aspect
TypeAnalysis

Methods

public void setDigits(java.lang.String digits)
Sets the trimmed digits of this literal.
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 426
Aspect
Java7Literals
public void setKind(int kind)
Sets the literal kind.
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 445
Aspect
Java7Literals
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
Source
Declared in /home/jesper/git/extendj/ASTNode at line 10
protected int numChildren()
Overrides:numChildren in class Literal
Source
Declared in /home/jesper/git/extendj/ASTNode at line 21
public boolean mayHaveRewrite()
Overrides:mayHaveRewrite in class Literal
Source
Declared in /home/jesper/git/extendj/ASTNode at line 27
public void flushAttrCache()
Overrides:flushAttrCache in class Literal
Source
Declared in /home/jesper/git/extendj/ASTNode at line 33
public void flushCollectionCache()
Overrides:flushCollectionCache in class Literal
Source
Declared in /home/jesper/git/extendj/ASTNode at line 40
public void flushRewriteCache()
Overrides:flushRewriteCache in class Literal
Source
Declared in /home/jesper/git/extendj/ASTNode at line 46
public NumericLiteral clone()
                     throws java.lang.CloneNotSupportedException
Overrides:clone in class Literal
Throws:
java.lang.CloneNotSupportedException
Source
Declared in /home/jesper/git/extendj/ASTNode at line 52
public NumericLiteral copy()
Overrides:copy in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/ASTNode at line 59
@Deprecated
public NumericLiteral fullCopy()
Deprecated. Please use treeCopy or treeCopyNoTransform instead

Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.

Specified by:fullCopy in class Literal
Returns:
dangling copy of the subtree at this node
Source
Declared in /home/jesper/git/extendj/ASTNode at line 78
public NumericLiteral treeCopyNoTransform()
Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.
Specified by:treeCopyNoTransform in class Literal
Returns:
dangling copy of the subtree at this node
Source
Declared in /home/jesper/git/extendj/ASTNode at line 88
public NumericLiteral treeCopy()
Create a deep copy of the AST subtree at this node. The subtree of this node is traversed to trigger rewrites before copy. The copy is dangling, i.e. has no parent.
Specified by:treeCopy in class Literal
Returns:
dangling copy of the subtree at this node
Source
Declared in /home/jesper/git/extendj/ASTNode at line 108
protected boolean is$Equal(ASTNode node)
Overrides:is$Equal in class ASTNode<ASTNode>
Source
Declared in /home/jesper/git/extendj/ASTNode at line 115
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
Parameters:
symbol - Symbol containing the new value for the lexeme LITERAL
@ASTNodeAnnotation.Token(name="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 /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 360
Aspect
Java7Literals
public static final int HEXADECIMAL
See Also:
Constant Field Values
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 361
Aspect
Java7Literals
public static final int OCTAL
See Also:
Constant Field Values
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 362
Aspect
Java7Literals
public static final int BINARY
See Also:
Constant Field Values
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 363
Aspect
Java7Literals
protected java.lang.String digits
The trimmed digits.
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 421
Aspect
Java7Literals
protected int kind
The literal kind tells which kind of literal it is; either a DECIMAL, HEXADECIMAL, OCTAL or BINARY literal.
Source
Declared in /home/jesper/git/extendj/java7/frontend/Literals.jrag at line 440
Aspect
Java7Literals
protected boolean type_computed

Inherited Members

Attributes inherited from org.extendj.ast.Literal

Attributes inherited from org.extendj.ast.Expr

Attributes inherited from org.extendj.ast.ASTNode

Methods inherited from class org.extendj.ast.Literal

Methods inherited from class org.extendj.ast.Expr

Methods inherited from class org.extendj.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 org.extendj.ast.Literal

Fields inherited from org.extendj.ast.Expr

Fields inherited from org.extendj.ast.ASTNode

Fields inherited from beaver.Symbol

end
id
start
value