Package spoon.reflect.visitor
Class DefaultTokenWriter
java.lang.Object
spoon.reflect.visitor.DefaultTokenWriter
- All Implemented Interfaces:
TokenWriter
Implementation of
TokenWriter
, which writes all tokens to PrinterHelper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondecTab()
decrements indentationincTab()
increments indentationvoid
reset()
resets to the initial statetoString()
writeCodeSnippet(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.
-
Constructor Details
-
DefaultTokenWriter
public DefaultTokenWriter() -
DefaultTokenWriter
-
-
Method Details
-
writeOperator
Description copied from interface:TokenWriter
Writes one operator. = > < ! ~ ? : == <= >= != && || ++ -- + - * / & | ^ % << >> >>> += -= *= /= &= |= ^= %= <<= >>= >>>= instanceof- Specified by:
writeOperator
in interfaceTokenWriter
-
writeSeparator
Description copied from interface:TokenWriter
Writes one separator. It is -> or :: or one of these characters: (){}[];,.:@=<>?&|- Specified by:
writeSeparator
in interfaceTokenWriter
-
writeLiteral
Description copied from interface:TokenWriter
writes literal. It can be a String, Character or an number- Specified by:
writeLiteral
in interfaceTokenWriter
-
writeKeyword
Description copied from interface:TokenWriter
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- Specified by:
writeKeyword
in interfaceTokenWriter
-
writeIdentifier
Description copied from interface:TokenWriter
writes a java identifier.- Specified by:
writeIdentifier
in interfaceTokenWriter
-
writeCodeSnippet
Description copied from interface:TokenWriter
writes a code snippet - represents arbitrary code ofCtCodeSnippetExpression
orCtCodeSnippetStatement
- Specified by:
writeCodeSnippet
in interfaceTokenWriter
-
writeComment
Description copied from interface:TokenWriter
writes a comment- Specified by:
writeComment
in interfaceTokenWriter
-
writeln
Description copied from interface:TokenWriter
writes new line (EOL)- Specified by:
writeln
in interfaceTokenWriter
-
incTab
Description copied from interface:TokenWriter
increments indentation- Specified by:
incTab
in interfaceTokenWriter
-
decTab
Description copied from interface:TokenWriter
decrements indentation- Specified by:
decTab
in interfaceTokenWriter
-
reset
public void reset()Description copied from interface:TokenWriter
resets to the initial state- Specified by:
reset
in interfaceTokenWriter
-
writeSpace
Description copied from interface:TokenWriter
Writes a single space.- Specified by:
writeSpace
in interfaceTokenWriter
-
getPrinterHelper
- Specified by:
getPrinterHelper
in interfaceTokenWriter
- Returns:
PrinterHelper
used by this TokenWriter. Note that in the future, will return an interface eg IPrinterHelper instead.
-
toString
-