public class ASTLiteral extends ASTExpression
Here are the Decaf data types and their corresponding Java data types:
ASTNode.DataType | Java type |
---|---|
INT | Integer |
BOOL | Boolean |
STR | String |
VOID | null |
ASTNode.DataType
Modifier and Type | Field and Description |
---|---|
ASTNode.DataType |
type |
Object |
value |
attributes
Constructor and Description |
---|
ASTLiteral(ASTNode.DataType type,
Object value) |
Modifier and Type | Method and Description |
---|---|
static String |
addEscapeCodes(String str)
Remove quotes, newlines, and tabs from string literals
and replace them with their escape codes.
|
static String |
removeEscapeCodes(String str)
Remove escape codes from string literals and replace them with
the corresponding special character (quotes, newlines, or tabs)
|
String |
toString() |
void |
traverse(ASTVisitor visitor)
Generic traversal method for the visitor pattern.
|
getASTTypeStr, getDepth, getParent, getSourceInfo, getType, setDepth, setParent, setSourceInfo, setType, typeToString
public ASTNode.DataType type
public Object value
public ASTLiteral(ASTNode.DataType type, Object value)
public static String removeEscapeCodes(String str)
str
- String to manipulatepublic static String addEscapeCodes(String str)
str
- String to manipulatepublic void traverse(ASTVisitor visitor)
ASTNode
Copyright © 2019. All rights reserved.