polyglot.ext.jl.ast
Class StringLit_c
java.lang.Object
polyglot.ext.jl.ast.Node_c
polyglot.ext.jl.ast.Term_c
polyglot.ext.jl.ast.Expr_c
polyglot.ext.jl.ast.Lit_c
polyglot.ext.jl.ast.StringLit_c
- All Implemented Interfaces:
- java.lang.Cloneable, Expr, JL, Lit, Node, NodeOps, Prefix, Receiver, StringLit, Term, Typed, Copy
public class StringLit_c
- extends Lit_c
- implements StringLit
A StringLit
represents an immutable instance of a
String
which corresponds to a literal string in Java code.
Fields inherited from class polyglot.ext.jl.ast.Expr_c |
type |
Methods inherited from class polyglot.ext.jl.ast.Expr_c |
booleanValue, buildTypes, byteValue, charValue, doubleValue, dump, floatValue, intValue, longValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type |
Methods inherited from class polyglot.ext.jl.ast.Node_c |
addDecls, addMembers, addMembersEnter, addMembersOverride, buildTypesEnter, buildTypesOverride, childExpectedType, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, enterScope, enterScope, exceptionCheckEnter, exceptionCheckOverride, ext, ext, ext, ext, init, node, position, position, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitChildren, visitEdge, visitList |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface polyglot.ast.Node |
childExpectedType, del, del, dump, ext, ext, ext, ext, position, position, visit, visitChild, visitEdge, visitList |
Methods inherited from interface polyglot.ast.JL |
init, node |
Methods inherited from interface polyglot.ast.NodeOps |
addDecls, addMembers, addMembersEnter, buildTypes, buildTypesEnter, disambiguate, disambiguateEnter, enterScope, enterScope, exceptionCheck, exceptionCheckEnter, throwTypes, translate, typeCheckEnter, visitChildren |
Methods inherited from interface polyglot.util.Copy |
copy |
Methods inherited from interface polyglot.ast.Typed |
type |
value
protected java.lang.String value
MAX_LENGTH
protected int MAX_LENGTH
StringLit_c
public StringLit_c(Position pos,
java.lang.String value)
value
public java.lang.String value()
- Get the value of the expression.
- Specified by:
value
in interface StringLit
value
public StringLit value(java.lang.String value)
- Set the value of the expression.
- Specified by:
value
in interface StringLit
typeCheck
public Node typeCheck(TypeChecker tc)
throws SemanticException
- Type check the expression.
- Specified by:
typeCheck
in interface NodeOps
- Overrides:
typeCheck
in class Node_c
- Parameters:
tc
- The type checking visitor.
- Throws:
SemanticException
toString
public java.lang.String toString()
- Overrides:
toString
in class Node_c
prettyPrint
public void prettyPrint(CodeWriter w,
PrettyPrinter tr)
- Write the expression to an output file.
- Specified by:
prettyPrint
in interface NodeOps
- Overrides:
prettyPrint
in class Node_c
- Parameters:
w
- The code writer to which to write.tr
- The pretty printer. This is not a visitor.
breakupString
public java.util.List breakupString()
- Break a long string literal into a concatenation of small string
literals. This avoids messing up the pretty printer and editors.
ak333: made public to allow CppStringLitDel to get to it.
constantValue
public java.lang.Object constantValue()
- Description copied from interface:
Expr
- Returns the constant value of the expression, if any.
- Specified by:
constantValue
in interface Expr
- Specified by:
constantValue
in class Lit_c