Package spoon.reflect.visitor
Interface TokenWriter
- All Known Implementing Classes:
DefaultTokenWriter
,MutableTokenWriter
,TokenWriterProxy
public interface TokenWriter
Responsible for writing a token while pretty-printing.
Default is
DefaultTokenWriter
, can be provided by client too.-
Method Summary
Modifier and TypeMethodDescriptiondecTab()
decrements indentationincTab()
increments indentationvoid
reset()
resets to the initial statewriteCodeSnippet(String token)
writes a code snippet - represents arbitrary code ofCtCodeSnippetExpression
orCtCodeSnippetStatement
writeComment(CtComment comment)
writes a commentwriteIdentifier(String token)
writes a java identifier.writeKeyword(String token)
writes a keyword abstract continue for new switch assert default goto package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super whilewriteLiteral(String token)
writes literal.writeln()
writes new line (EOL)writeOperator(String token)
Writes one operator.writeSeparator(String token)
Writes one separator.Writes a single space.
-
Method Details
-
writeSeparator
Writes one separator. It is -> or :: or one of these characters: (){}[];,.:@=<>?&| -
writeOperator
Writes one operator. = > < ! ~ ? : == <= >= != && || ++ -- + - * / & | ^ % << >> >>> += -= *= /= &= |= ^= %= <<= >>= >>>= instanceof -
writeLiteral
writes literal. It can be a String, Character or an number -
writeKeyword
writes a keyword abstract continue for new switch assert default goto package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super while -
writeIdentifier
writes a java identifier. -
writeCodeSnippet
writes a code snippet - represents arbitrary code ofCtCodeSnippetExpression
orCtCodeSnippetStatement
-
writeComment
writes a comment -
writeln
TokenWriter writeln()writes new line (EOL) -
incTab
TokenWriter incTab()increments indentation -
decTab
TokenWriter decTab()decrements indentation -
getPrinterHelper
PrinterHelper getPrinterHelper()- Returns:
PrinterHelper
used by this TokenWriter. Note that in the future, will return an interface eg IPrinterHelper instead.
-
reset
void reset()resets to the initial state -
writeSpace
TokenWriter writeSpace()Writes a single space.
-