public class StringLit_c extends Lit_c implements StringLit
StringLit
represents an immutable instance of a
String
which corresponds to a literal string in Java code.Term.Instance
Modifier and Type | Field and Description |
---|---|
protected int |
MAX_LENGTH |
protected java.lang.String |
value |
exceptions, reachable
Constructor and Description |
---|
StringLit_c(Position pos,
java.lang.String value) |
StringLit_c(Position pos,
java.lang.String value,
Ext ext) |
Modifier and Type | Method and Description |
---|---|
protected java.util.List<java.lang.String> |
breakupString()
Break a long string literal into a concatenation of small string
literals.
|
java.lang.Object |
constantValue(Lang lang)
Return the constant value of the expression, if any.
|
Node |
copy(NodeFactory nf)
Produce a copy of this node using the given NodeFactory.
|
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given
CodeWriter . |
java.lang.String |
toString() |
Node |
typeCheck(TypeChecker tc)
Type check the AST.
|
java.lang.String |
value()
The string.
|
protected <N extends StringLit_c> |
value(N n,
java.lang.String value) |
StringLit |
value(java.lang.String value)
Set the string.
|
acceptCFG, constantValueSet, firstChild, isConstant, precedence
booleanValue, buildTypes, byteValue, charValue, constantValue, constantValueSet, doubleValue, dump, extRewrite, floatValue, intValue, isConstant, isTypeChecked, lastLang, longValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type, type
exceptionCheck, exceptions, exceptions, exceptions, listChild, reachable, reachable, reachable
addDecls, buildTypesEnter, checkConstants, childExpectedType, copy, copy, copyIfNeeded, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, error, error, error, exceptionCheckEnter, ext, ext, ext, ext, extRewriteEnter, isDisambiguated, lang, position, position, position, prettyPrint, prettyPrint, prettyPrint, prettyPrint, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitChildren, visitEdge, visitList
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
constantValue, constantValueSet, isConstant, precedence, printSubExpr, printSubExpr, type
del, del, dump, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitEdge
addDecls, buildTypes, buildTypesEnter, checkConstants, childExpectedType, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, exceptionCheck, exceptionCheckEnter, extRewrite, extRewriteEnter, lang, prettyPrint, prettyPrint, prettyPrint, prettyPrint, throwTypes, translate, typeCheckEnter, typeCheckOverride, visitChild, visitChildren, visitList
exceptions, exceptions, reachable, reachable
public StringLit_c(Position pos, java.lang.String value)
public java.lang.String value()
StringLit
public StringLit value(java.lang.String value)
StringLit
protected <N extends StringLit_c> N value(N n, java.lang.String value)
public Node typeCheck(TypeChecker tc) throws SemanticException
NodeOps
leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.typeCheck
in interface NodeOps
typeCheck
in class Node_c
tc
- The type checking visitor.SemanticException
public void prettyPrint(CodeWriter w, PrettyPrinter tr)
Node_c
CodeWriter
.prettyPrint
in interface NodeOps
prettyPrint
in class Node_c
w
- The code writer to which to write.tr
- The pretty printer. This is not a visitor.protected java.util.List<java.lang.String> breakupString()
public java.lang.Object constantValue(Lang lang)
ExprOps
isConstant()
is true.constantValue
in interface ExprOps
constantValue
in class Lit_c