Class CodePrinter
- java.lang.Object
-
- com.google.common.css.compiler.passes.CodePrinter
-
- All Implemented Interfaces:
CssCompilerPass
- Direct Known Subclasses:
CompactPrinter,PrettyPrinter,SExprPrinter
public abstract class CodePrinter extends java.lang.Object implements CssCompilerPass
An abstract code-printer forCssTreeinstances that provides read/write access to the output buffer and performs common tasks during code generation, like creating sourcemaps.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCodePrinter(VisitController visitController, CodeBuffer buffer, GssSourceMapGenerator generator)Initializes this instance from the givenVisitController, could optionally acceptCodeBufferandGssSourceMapGeneratorto use.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract CssTreeVisitorcreateVisitor(VisitController visitController, CodeBuffer codeBuffer)Constructs the visitor required by the subclass.protected java.lang.StringgetOutputBuffer()protected voidresetBuffer()voidsetPreserveMarkedComments(boolean preserveMarkedComments)Whether special comments in the CSS nodes are preserved in the printed output.protected voidvisit()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.common.css.compiler.ast.CssCompilerPass
runPass
-
-
-
-
Constructor Detail
-
CodePrinter
protected CodePrinter(VisitController visitController, @Nullable CodeBuffer buffer, @Nullable GssSourceMapGenerator generator)
Initializes this instance from the givenVisitController, could optionally acceptCodeBufferandGssSourceMapGeneratorto use.
-
-
Method Detail
-
createVisitor
protected abstract CssTreeVisitor createVisitor(VisitController visitController, CodeBuffer codeBuffer)
Constructs the visitor required by the subclass. This visitor'senter*methods will be called after the source map generator'sstartSourceMappingmethod and before itsendSourceMappingmethod.
-
visit
protected final void visit()
-
resetBuffer
protected final void resetBuffer()
-
getOutputBuffer
protected final java.lang.String getOutputBuffer()
-
setPreserveMarkedComments
public void setPreserveMarkedComments(boolean preserveMarkedComments)
Whether special comments in the CSS nodes are preserved in the printed output. Currently supported special comments are annotated with one of the following:- @preserve
- @license
- /*! (start of comment)
Note: Comments layout is not guaranteed, since detailed position information in the input files is not preserved by the parser.
-
-