public class StructuralWhitespaceStripper extends DepthFirstAdapter
A structural command is any command that never emits any output. These come in three types:
This makes it much easier to write human readable templates in cases where the output format is whitespace sensitive.
Thus the input:
---------------- Value is: <?cs if:x>0 ?> positive <?cs elif:x<0 ?> negative <?cs else ?> zero <?cs /if ?>. ----------------is equivalent to:
---------------- Value is: <?cs if:x>0 ?> positive <?cs elif:x<0 ?> negative <?cs else ?> zero <?cs /if ?>. ----------------but is much easier to read.
Where data commands become empty they are replaced with Noop commands, which effectively removes them from the tree. These can be removed (if needed) by a later optimization step but shouldn't cause any issues.
| Constructor and Description |
|---|
StructuralWhitespaceStripper() |
| Modifier and Type | Method and Description |
|---|---|
void |
caseAAltCommand(AAltCommand node) |
void |
caseADataCommand(ADataCommand data) |
void |
caseADefCommand(ADefCommand node) |
void |
caseAEachCommand(AEachCommand node) |
void |
caseAEscapeCommand(AEscapeCommand node) |
void |
caseAIfCommand(AIfCommand node) |
void |
caseALoopCommand(ALoopCommand node) |
void |
caseALoopIncCommand(ALoopIncCommand node) |
void |
caseALoopToCommand(ALoopToCommand node) |
void |
caseAWithCommand(AWithCommand node) |
void |
caseStart(Start node) |
void |
enterComplexCommand() |
void |
exitComplexCommand() |
void |
inAAltCommand(AAltCommand node) |
void |
inACallCommand(ACallCommand node) |
void |
inAEvarCommand(AEvarCommand node) |
void |
inALvarCommand(ALvarCommand node) |
void |
inANameCommand(ANameCommand node) |
void |
inASetCommand(ASetCommand node) |
void |
inAUvarCommand(AUvarCommand node) |
void |
inAVarCommand(AVarCommand node) |
caseAAddExpression, caseAAndExpression, caseAAutoescapeCommand, caseACallCommand, caseACommaExpression, caseACommentCommand, caseAContentTypeCommand, caseACsOpenPosition, caseADecimalExpression, caseADecNumberVariable, caseADescendVariable, caseADivideExpression, caseAEqExpression, caseAEvarCommand, caseAExistsExpression, caseAExpandVariable, caseAFunctionExpression, caseAGteExpression, caseAGtExpression, caseAHardIncludeCommand, caseAHardLincludeCommand, caseAHexExpression, caseAHexNumberVariable, caseAIncludeCommand, caseAInlineCommand, caseALincludeCommand, caseALteExpression, caseALtExpression, caseALvarCommand, caseAModuloExpression, caseAMultipleCommand, caseAMultiplyExpression, caseANameCommand, caseANameVariable, caseANeExpression, caseANegativeExpression, caseANoopCommand, caseANoopExpression, caseANotExpression, caseANumericAddExpression, caseANumericEqExpression, caseANumericExpression, caseANumericNeExpression, caseAOrExpression, caseASequenceExpression, caseASetCommand, caseAStringExpression, caseASubtractExpression, caseAUvarCommand, caseAVarCommand, caseAVariableExpression, defaultIn, defaultOut, inAAddExpression, inAAndExpression, inAAutoescapeCommand, inACommaExpression, inACommentCommand, inAContentTypeCommand, inACsOpenPosition, inADataCommand, inADecimalExpression, inADecNumberVariable, inADefCommand, inADescendVariable, inADivideExpression, inAEachCommand, inAEqExpression, inAEscapeCommand, inAExistsExpression, inAExpandVariable, inAFunctionExpression, inAGteExpression, inAGtExpression, inAHardIncludeCommand, inAHardLincludeCommand, inAHexExpression, inAHexNumberVariable, inAIfCommand, inAIncludeCommand, inAInlineCommand, inALincludeCommand, inALoopCommand, inALoopIncCommand, inALoopToCommand, inALteExpression, inALtExpression, inAModuloExpression, inAMultipleCommand, inAMultiplyExpression, inANameVariable, inANeExpression, inANegativeExpression, inANoopCommand, inANoopExpression, inANotExpression, inANumericAddExpression, inANumericEqExpression, inANumericExpression, inANumericNeExpression, inAOrExpression, inASequenceExpression, inAStringExpression, inASubtractExpression, inAVariableExpression, inAWithCommand, inStart, outAAddExpression, outAAltCommand, outAAndExpression, outAAutoescapeCommand, outACallCommand, outACommaExpression, outACommentCommand, outAContentTypeCommand, outACsOpenPosition, outADataCommand, outADecimalExpression, outADecNumberVariable, outADefCommand, outADescendVariable, outADivideExpression, outAEachCommand, outAEqExpression, outAEscapeCommand, outAEvarCommand, outAExistsExpression, outAExpandVariable, outAFunctionExpression, outAGteExpression, outAGtExpression, outAHardIncludeCommand, outAHardLincludeCommand, outAHexExpression, outAHexNumberVariable, outAIfCommand, outAIncludeCommand, outAInlineCommand, outALincludeCommand, outALoopCommand, outALoopIncCommand, outALoopToCommand, outALteExpression, outALtExpression, outALvarCommand, outAModuloExpression, outAMultipleCommand, outAMultiplyExpression, outANameCommand, outANameVariable, outANeExpression, outANegativeExpression, outANoopCommand, outANoopExpression, outANotExpression, outANumericAddExpression, outANumericEqExpression, outANumericExpression, outANumericNeExpression, outAOrExpression, outASequenceExpression, outASetCommand, outAStringExpression, outASubtractExpression, outAUvarCommand, outAVarCommand, outAVariableExpression, outAWithCommand, outStartcaseEOF, caseTAlt, caseTAnd, caseTArgWhitespace, caseTAssignment, caseTAutoescape, caseTBang, caseTBracketClose, caseTBracketOpen, caseTCall, caseTComma, caseTCommandDelimiter, caseTComment, caseTCommentStart, caseTContentType, caseTCsClose, caseTCsOpen, caseTData, caseTDecNumber, caseTDef, caseTDollar, caseTDot, caseTEach, caseTElse, caseTElseIf, caseTEq, caseTEscape, caseTEvar, caseTGt, caseTGte, caseTHardDelimiter, caseTHash, caseTHexNumber, caseTIf, caseTInclude, caseTInline, caseTLinclude, caseTLoop, caseTLt, caseTLte, caseTLvar, caseTMinus, caseTName, caseTNe, caseTOr, caseTParenClose, caseTParenOpen, caseTPercent, caseTPlus, caseTQuestion, caseTSet, caseTSlash, caseTStar, caseTString, caseTUvar, caseTVar, caseTWith, caseTWord, defaultCase, getIn, getOut, setIn, setOutpublic void caseStart(Start node)
caseStart in interface AnalysiscaseStart in class DepthFirstAdapterpublic void caseADataCommand(ADataCommand data)
caseADataCommand in interface AnalysiscaseADataCommand in class DepthFirstAdapterpublic void inAAltCommand(AAltCommand node)
inAAltCommand in class DepthFirstAdapterpublic void inACallCommand(ACallCommand node)
inACallCommand in class DepthFirstAdapterpublic void inAEvarCommand(AEvarCommand node)
inAEvarCommand in class DepthFirstAdapterpublic void inALvarCommand(ALvarCommand node)
inALvarCommand in class DepthFirstAdapterpublic void inANameCommand(ANameCommand node)
inANameCommand in class DepthFirstAdapterpublic void inASetCommand(ASetCommand node)
inASetCommand in class DepthFirstAdapterpublic void inAUvarCommand(AUvarCommand node)
inAUvarCommand in class DepthFirstAdapterpublic void inAVarCommand(AVarCommand node)
inAVarCommand in class DepthFirstAdapterpublic void enterComplexCommand()
public void exitComplexCommand()
public void caseAAltCommand(AAltCommand node)
caseAAltCommand in interface AnalysiscaseAAltCommand in class DepthFirstAdapterpublic void caseADefCommand(ADefCommand node)
caseADefCommand in interface AnalysiscaseADefCommand in class DepthFirstAdapterpublic void caseAEachCommand(AEachCommand node)
caseAEachCommand in interface AnalysiscaseAEachCommand in class DepthFirstAdapterpublic void caseAEscapeCommand(AEscapeCommand node)
caseAEscapeCommand in interface AnalysiscaseAEscapeCommand in class DepthFirstAdapterpublic void caseAIfCommand(AIfCommand node)
caseAIfCommand in interface AnalysiscaseAIfCommand in class DepthFirstAdapterpublic void caseALoopCommand(ALoopCommand node)
caseALoopCommand in interface AnalysiscaseALoopCommand in class DepthFirstAdapterpublic void caseALoopIncCommand(ALoopIncCommand node)
caseALoopIncCommand in interface AnalysiscaseALoopIncCommand in class DepthFirstAdapterpublic void caseALoopToCommand(ALoopToCommand node)
caseALoopToCommand in interface AnalysiscaseALoopToCommand in class DepthFirstAdapterpublic void caseAWithCommand(AWithCommand node)
caseAWithCommand in interface AnalysiscaseAWithCommand in class DepthFirstAdapterCopyright © 2010-2012 Google. All Rights Reserved.