jsilver-1.0.0

getPosition().apply(this);
    }
    outALoopCommand(node);
  }
  
  public void inALoopIncCommand(ALoopIncCommand node)
  {
    defaultIn(node);
  }
  
  public void outALoopIncCommand(ALoopIncCommand node)
  {
    defaultOut(node);
  }
  
  public void caseALoopIncCommand(ALoopIncCommand node)
  {
    inALoopIncCommand(node);
    if (node.getCommand() != null) {
      node.getCommand().apply(this);
    }
    if (node.getIncrement() != null) {
      node.getIncrement().apply(this);
    }
    if (node.getEnd() != null) {
      node.getEnd().apply(this);
    }
    if (node.getStart() != null) {
      node.getStart().apply(this);
    }
    if (node.getVariable() != null) {
      node.getVariable().apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outALoopIncCommand(node);
  }
  
  public void inAEachCommand(AEachCommand node)
  {
    defaultIn(node);
  }
  
  public void outAEachCommand(AEachCommand node)
  {
    defaultOut(node);
  }
  
  public void caseAEachCommand(AEachCommand node)
  {
    inAEachCommand(node);
    if (node.getCommand() != null) {
      node.getCommand().apply(this);
    }
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    if (node.getVariable() != null) {
      node.getVariable().apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outAEachCommand(node);
  }
  
  public void inADefCommand(ADefCommand node)
  {
    defaultIn(node);
  }
  
  public void outADefCommand(ADefCommand node)
  {
    defaultOut(node);
  }
  
  public void caseADefCommand(ADefCommand node)
  {
    inADefCommand(node);
    if (node.getCommand() != null) {
      node.getCommand().apply(this);
    }
    List<PVariable> copy = new ArrayList(node.getArguments());
    Collections.reverse(copy);
    for (PVariable e : copy) {
      e.apply(this);
    }
    List<TWord> copy = new ArrayList(node.getMacro());
    Collections.reverse(copy);
    for (TWord e : copy) {
      e.apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outADefCommand(node);
  }
  
  public void inACallCommand(ACallCommand node)
  {
    defaultIn(node);
  }
  
  public void outACallCommand(ACallCommand node)
  {
    defaultOut(node);
  }
  
  public void caseACallCommand(ACallCommand node)
  {
    inACallCommand(node);
    
    List<PExpression> copy = new ArrayList(node.getArguments());
    Collections.reverse(copy);
    for (PExpression e : copy) {
      e.apply(this);
    }
    List<TWord> copy = new ArrayList(node.getMacro());
    Collections.reverse(copy);
    for (TWord e : copy) {
      e.apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outACallCommand(node);
  }
  
  public void inAIfCommand(AIfCommand node)
  {
    defaultIn(node);
  }
  
  public void outAIfCommand(AIfCommand node)
  {
    defaultOut(node);
  }
  
  public void caseAIfCommand(AIfCommand node)
  {
    inAIfCommand(node);
    if (node.getOtherwise() != null) {
      node.getOtherwise().apply(this);
    }
    if (node.getBlock() != null) {
      node.getBlock().apply(this);
    }
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outAIfCommand(node);
  }
  
  public void inAAltCommand(AAltCommand node)
  {
    defaultIn(node);
  }
  
  public void outAAltCommand(AAltCommand node)
  {
    defaultOut(node);
  }
  
  public void caseAAltCommand(AAltCommand node)
  {
    inAAltCommand(node);
    if (node.getCommand() != null) {
      node.getCommand().apply(this);
    }
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outAAltCommand(node);
  }
  
  public void inAIncludeCommand(AIncludeCommand node)
  {
    defaultIn(node);
  }
  
  public void outAIncludeCommand(AIncludeCommand node)
  {
    defaultOut(node);
  }
  
  public void caseAIncludeCommand(AIncludeCommand node)
  {
    inAIncludeCommand(node);
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outAIncludeCommand(node);
  }
  
  public void inAHardIncludeCommand(AHardIncludeCommand node)
  {
    defaultIn(node);
  }
  
  public void outAHardIncludeCommand(AHardIncludeCommand node)
  {
    defaultOut(node);
  }
  
  public void caseAHardIncludeCommand(AHardIncludeCommand node)
  {
    inAHardIncludeCommand(node);
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outAHardIncludeCommand(node);
  }
  
  public void inALincludeCommand(ALincludeCommand node)
  {
    defaultIn(node);
  }
  
  public void outALincludeCommand(ALincludeCommand node)
  {
    defaultOut(node);
  }
  
  public void caseALincludeCommand(ALincludeCommand node)
  {
    inALincludeCommand(node);
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outALincludeCommand(node);
  }
  
  public void inAHardLincludeCommand(AHardLincludeCommand node)
  {
    defaultIn(node);
  }
  
  public void outAHardLincludeCommand(AHardLincludeCommand node)
  {
    defaultOut(node);
  }
  
  public void caseAHardLincludeCommand(AHardLincludeCommand node)
  {
    inAHardLincludeCommand(node);
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outAHardLincludeCommand(node);
  }
  
  public void inAContentTypeCommand(AContentTypeCommand node)
  {
    defaultIn(node);
  }
  
  public void outAContentTypeCommand(AContentTypeCommand node)
  {
    defaultOut(node);
  }
  
  public void caseAContentTypeCommand(AContentTypeCommand node)
  {
    inAContentTypeCommand(node);
    if (node.getString() != null) {
      node.getString().apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outAContentTypeCommand(node);
  }
  
  public void inAInlineCommand(AInlineCommand node)
  {
    defaultIn(node);
  }
  
  public void outAInlineCommand(AInlineCommand node)
  {
    defaultOut(node);
  }
  
  public void caseAInlineCommand(AInlineCommand node)
  {
    inAInlineCommand(node);
    if (node.getCommand() != null) {
      node.getCommand().apply(this);
    }
    if (node.getPosition() != null) {
      node.getPosition().apply(this);
    }
    outAInlineCommand(node);
  }
  
  public void inANoopCommand(ANoopCommand node)
  {
    defaultIn(node);
  }
  
  public void outANoopCommand(ANoopCommand node)
  {
    defaultOut(node);
  }
  
  public void caseANoopCommand(ANoopCommand node)
  {
    inANoopCommand(node);
    outANoopCommand(node);
  }
  
  public void inACsOpenPosition(ACsOpenPosition node)
  {
    defaultIn(node);
  }
  
  public void outACsOpenPosition(ACsOpenPosition node)
  {
    defaultOut(node);
  }
  
  public void caseACsOpenPosition(ACsOpenPosition node)
  {
    inACsOpenPosition(node);
    if (node.getCsOpen() != null) {
      node.getCsOpen().apply(this);
    }
    outACsOpenPosition(node);
  }
  
  public void inAStringExpression(AStringExpression node)
  {
    defaultIn(node);
  }
  
  public void outAStringExpression(AStringExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAStringExpression(AStringExpression node)
  {
    inAStringExpression(node);
    if (node.getValue() != null) {
      node.getValue().apply(this);
    }
    outAStringExpression(node);
  }
  
  public void inANumericExpression(ANumericExpression node)
  {
    defaultIn(node);
  }
  
  public void outANumericExpression(ANumericExpression node)
  {
    defaultOut(node);
  }
  
  public void caseANumericExpression(ANumericExpression node)
  {
    inANumericExpression(node);
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    outANumericExpression(node);
  }
  
  public void inADecimalExpression(ADecimalExpression node)
  {
    defaultIn(node);
  }
  
  public void outADecimalExpression(ADecimalExpression node)
  {
    defaultOut(node);
  }
  
  public void caseADecimalExpression(ADecimalExpression node)
  {
    inADecimalExpression(node);
    if (node.getValue() != null) {
      node.getValue().apply(this);
    }
    outADecimalExpression(node);
  }
  
  public void inAHexExpression(AHexExpression node)
  {
    defaultIn(node);
  }
  
  public void outAHexExpression(AHexExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAHexExpression(AHexExpression node)
  {
    inAHexExpression(node);
    if (node.getValue() != null) {
      node.getValue().apply(this);
    }
    outAHexExpression(node);
  }
  
  public void inAVariableExpression(AVariableExpression node)
  {
    defaultIn(node);
  }
  
  public void outAVariableExpression(AVariableExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAVariableExpression(AVariableExpression node)
  {
    inAVariableExpression(node);
    if (node.getVariable() != null) {
      node.getVariable().apply(this);
    }
    outAVariableExpression(node);
  }
  
  public void inAFunctionExpression(AFunctionExpression node)
  {
    defaultIn(node);
  }
  
  public void outAFunctionExpression(AFunctionExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAFunctionExpression(AFunctionExpression node)
  {
    inAFunctionExpression(node);
    
    List<PExpression> copy = new ArrayList(node.getArgs());
    Collections.reverse(copy);
    for (PExpression e : copy) {
      e.apply(this);
    }
    if (node.getName() != null) {
      node.getName().apply(this);
    }
    outAFunctionExpression(node);
  }
  
  public void inASequenceExpression(ASequenceExpression node)
  {
    defaultIn(node);
  }
  
  public void outASequenceExpression(ASequenceExpression node)
  {
    defaultOut(node);
  }
  
  public void caseASequenceExpression(ASequenceExpression node)
  {
    inASequenceExpression(node);
    
    List<PExpression> copy = new ArrayList(node.getArgs());
    Collections.reverse(copy);
    for (PExpression e : copy) {
      e.apply(this);
    }
    outASequenceExpression(node);
  }
  
  public void inANegativeExpression(ANegativeExpression node)
  {
    defaultIn(node);
  }
  
  public void outANegativeExpression(ANegativeExpression node)
  {
    defaultOut(node);
  }
  
  public void caseANegativeExpression(ANegativeExpression node)
  {
    inANegativeExpression(node);
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    outANegativeExpression(node);
  }
  
  public void inANotExpression(ANotExpression node)
  {
    defaultIn(node);
  }
  
  public void outANotExpression(ANotExpression node)
  {
    defaultOut(node);
  }
  
  public void caseANotExpression(ANotExpression node)
  {
    inANotExpression(node);
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    outANotExpression(node);
  }
  
  public void inAExistsExpression(AExistsExpression node)
  {
    defaultIn(node);
  }
  
  public void outAExistsExpression(AExistsExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAExistsExpression(AExistsExpression node)
  {
    inAExistsExpression(node);
    if (node.getExpression() != null) {
      node.getExpression().apply(this);
    }
    outAExistsExpression(node);
  }
  
  public void inACommaExpression(ACommaExpression node)
  {
    defaultIn(node);
  }
  
  public void outACommaExpression(ACommaExpression node)
  {
    defaultOut(node);
  }
  
  public void caseACommaExpression(ACommaExpression node)
  {
    inACommaExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outACommaExpression(node);
  }
  
  public void inAEqExpression(AEqExpression node)
  {
    defaultIn(node);
  }
  
  public void outAEqExpression(AEqExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAEqExpression(AEqExpression node)
  {
    inAEqExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outAEqExpression(node);
  }
  
  public void inANumericEqExpression(ANumericEqExpression node)
  {
    defaultIn(node);
  }
  
  public void outANumericEqExpression(ANumericEqExpression node)
  {
    defaultOut(node);
  }
  
  public void caseANumericEqExpression(ANumericEqExpression node)
  {
    inANumericEqExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outANumericEqExpression(node);
  }
  
  public void inANeExpression(ANeExpression node)
  {
    defaultIn(node);
  }
  
  public void outANeExpression(ANeExpression node)
  {
    defaultOut(node);
  }
  
  public void caseANeExpression(ANeExpression node)
  {
    inANeExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outANeExpression(node);
  }
  
  public void inANumericNeExpression(ANumericNeExpression node)
  {
    defaultIn(node);
  }
  
  public void outANumericNeExpression(ANumericNeExpression node)
  {
    defaultOut(node);
  }
  
  public void caseANumericNeExpression(ANumericNeExpression node)
  {
    inANumericNeExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outANumericNeExpression(node);
  }
  
  public void inALtExpression(ALtExpression node)
  {
    defaultIn(node);
  }
  
  public void outALtExpression(ALtExpression node)
  {
    defaultOut(node);
  }
  
  public void caseALtExpression(ALtExpression node)
  {
    inALtExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outALtExpression(node);
  }
  
  public void inAGtExpression(AGtExpression node)
  {
    defaultIn(node);
  }
  
  public void outAGtExpression(AGtExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAGtExpression(AGtExpression node)
  {
    inAGtExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outAGtExpression(node);
  }
  
  public void inALteExpression(ALteExpression node)
  {
    defaultIn(node);
  }
  
  public void outALteExpression(ALteExpression node)
  {
    defaultOut(node);
  }
  
  public void caseALteExpression(ALteExpression node)
  {
    inALteExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outALteExpression(node);
  }
  
  public void inAGteExpression(AGteExpression node)
  {
    defaultIn(node);
  }
  
  public void outAGteExpression(AGteExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAGteExpression(AGteExpression node)
  {
    inAGteExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outAGteExpression(node);
  }
  
  public void inAAndExpression(AAndExpression node)
  {
    defaultIn(node);
  }
  
  public void outAAndExpression(AAndExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAAndExpression(AAndExpression node)
  {
    inAAndExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outAAndExpression(node);
  }
  
  public void inAOrExpression(AOrExpression node)
  {
    defaultIn(node);
  }
  
  public void outAOrExpression(AOrExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAOrExpression(AOrExpression node)
  {
    inAOrExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outAOrExpression(node);
  }
  
  public void inAAddExpression(AAddExpression node)
  {
    defaultIn(node);
  }
  
  public void outAAddExpression(AAddExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAAddExpression(AAddExpression node)
  {
    inAAddExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outAAddExpression(node);
  }
  
  public void inANumericAddExpression(ANumericAddExpression node)
  {
    defaultIn(node);
  }
  
  public void outANumericAddExpression(ANumericAddExpression node)
  {
    defaultOut(node);
  }
  
  public void caseANumericAddExpression(ANumericAddExpression node)
  {
    inANumericAddExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outANumericAddExpression(node);
  }
  
  public void inASubtractExpression(ASubtractExpression node)
  {
    defaultIn(node);
  }
  
  public void outASubtractExpression(ASubtractExpression node)
  {
    defaultOut(node);
  }
  
  public void caseASubtractExpression(ASubtractExpression node)
  {
    inASubtractExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outASubtractExpression(node);
  }
  
  public void inAMultiplyExpression(AMultiplyExpression node)
  {
    defaultIn(node);
  }
  
  public void outAMultiplyExpression(AMultiplyExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAMultiplyExpression(AMultiplyExpression node)
  {
    inAMultiplyExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outAMultiplyExpression(node);
  }
  
  public void inADivideExpression(ADivideExpression node)
  {
    defaultIn(node);
  }
  
  public void outADivideExpression(ADivideExpression node)
  {
    defaultOut(node);
  }
  
  public void caseADivideExpression(ADivideExpression node)
  {
    inADivideExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outADivideExpression(node);
  }
  
  public void inAModuloExpression(AModuloExpression node)
  {
    defaultIn(node);
  }
  
  public void outAModuloExpression(AModuloExpression node)
  {
    defaultOut(node);
  }
  
  public void caseAModuloExpression(AModuloExpression node)
  {
    inAModuloExpression(node);
    if (node.getRight() != null) {
      node.getRight().apply(this);
    }
    if (node.getLeft() != null) {
      node.getLeft().apply(this);
    }
    outAModuloExpression(node);
  }
  
  public void inANoopExpression(ANoopExpression node)
  {
    defaultIn(node);
  }
  
  public void outANoopExpression(ANoopExpression node)
  {
    defaultOut(node);
  }
  
  public void caseANoopExpression(ANoopExpression node)
  {
    inANoopExpression(node);
    outANoopExpression(node);
  }
  
  public void inANameVariable(ANameVariable node)
  {
    defaultIn(node);
  }
  
  public void outANameVariable(ANameVariable node)
  {
    defaultOut(node);
  }
  
  public void caseANameVariable(ANameVariable node)
  {
    inANameVariable(node);
    if (node.getWord() != null) {
      node.getWord().apply(this);
    }
    outANameVariable(node);
  }
  
  public void inADecNumberVariable(ADecNumberVariable node)
  {
    defaultIn(node);
  }
  
  public void outADecNumberVariable(ADecNumberVariable node)
  {
    defaultOut(node);
  }
  
  public void caseADecNumberVariable(ADecNumberVariable node)
  {
    inADecNumberVariable(node);
    if (node.getDecNumber() != null) {
      node.getDecNumber().apply(this);
    }
    outADecNumberVariable(node);
  }
  
  public void inAHexNumberVariable(AHexNumberVariable node)
  {
    defaultIn(node);
  }
  
  public void outAHexNumberVariable(AHexNumberVariable node)
  {
    defaultOut(node);
  }
  
  public void caseAHexNumberVariable(AHexNumberVariable node)
  {
    inAHexNumberVariable(node);
    if (node.getHexNumber() != null) {
      node.getHexNumber().apply(this);
    }
    outAHexNumberVariable(node);
  }
  
  public void inADescendVariable(ADescendVariable node)
  {
    defaultIn(node);
  }
  
  public void outADescendVariable(ADescendVariable node)
  {
    defaultOut(node);
  }
  
  public void caseADescendVariable(ADescendVariable node)
  {
    inADescendVariable(node);
    if (node.getChild() != null) {
      node.getChild().apply(this);
    }
    if (node.getParent() != null) {
      node.getParent().apply(this);
    }
    outADescendVariable(node);
  }
  
  public void inAExpandVariable(AExpandVariable node)
  {
    defaultIn(node);
  }
  
  public void outAExpandVariable(AExpandVariable node)
  {
    defaultOut(node);
  }
  
  public void caseAExpandVariable(AExpandVariable node)
  {
    inAExpandVariable(node);
    if (node.getChild() != null) {
      node.getChild().apply(this);
    }
    if (node.getParent() != null) {
      node.getParent().apply(this);
    }
    outAExpandVariable(node);
  }
}

/* Location:
 * Qualified Name:     com.google.clearsilver.jsilver.syntax.analysis.ReversedDepthFirstAdapter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.google.clearsilver.jsilver.syntax;

import com.google.clearsilver.jsilver.autoescape.AutoEscapeContext;
import com.google.clearsilver.jsilver.autoescape.AutoEscapeContext.AutoEscapeState;
import com.google.clearsilver.jsilver.autoescape.EscapeMode;
import com.google.clearsilver.jsilver.exceptions.JSilverAutoEscapingException;
import com.google.clearsilver.jsilver.syntax.analysis.DepthFirstAdapter;
import com.google.clearsilver.jsilver.syntax.node.AAltCommand;
import com.google.clearsilver.jsilver.syntax.node.AAutoescapeCommand;
import com.google.clearsilver.jsilver.syntax.node.ACallCommand;
import com.google.clearsilver.jsilver.syntax.node.AContentTypeCommand;
import com.google.clearsilver.jsilver.syntax.node.ACsOpenPosition;
import com.google.clearsilver.jsilver.syntax.node.ADataCommand;
import com.google.clearsilver.jsilver.syntax.node.ADefCommand;
import com.google.clearsilver.jsilver.syntax.node.AEscapeCommand;
import com.google.clearsilver.jsilver.syntax.node.AEvarCommand;
import com.google.clearsilver.jsilver.syntax.node.AHardIncludeCommand;
import com.google.clearsilver.jsilver.syntax.node.AHardLincludeCommand;
import com.google.clearsilver.jsilver.syntax.node.AIfCommand;
import com.google.clearsilver.jsilver.syntax.node.AIncludeCommand;
import com.google.clearsilver.jsilver.syntax.node.ALincludeCommand;
import com.google.clearsilver.jsilver.syntax.node.ALvarCommand;
import com.google.clearsilver.jsilver.syntax.node.ANameCommand;
import com.google.clearsilver.jsilver.syntax.node.AStringExpression;
import com.google.clearsilver.jsilver.syntax.node.AUvarCommand;
import com.google.clearsilver.jsilver.syntax.node.AVarCommand;
import com.google.clearsilver.jsilver.syntax.node.Node;
import com.google.clearsilver.jsilver.syntax.node.PCommand;
import com.google.clearsilver.jsilver.syntax.node.PPosition;
import com.google.clearsilver.jsilver.syntax.node.Start;
import com.google.clearsilver.jsilver.syntax.node.TCsOpen;
import com.google.clearsilver.jsilver.syntax.node.TData;
import com.google.clearsilver.jsilver.syntax.node.TString;
import com.google.clearsilver.jsilver.syntax.node.Token;

public class AutoEscaper
  extends DepthFirstAdapter
{
  private AutoEscapeContext autoEscapeContext;
  private boolean skipAutoEscape;
  private final EscapeMode escapeMode;
  private final String templateName;
  private boolean contentTypeCalled;
  
  public AutoEscaper(EscapeMode mode, String templateName)
  {
    this.templateName = templateName;
    if (mode.equals(EscapeMode.ESCAPE_NONE)) {
      throw new JSilverAutoEscapingException("AutoEscaper called when no escaping is required", templateName);
    }
    escapeMode = mode;
    if (mode.isAutoEscapingMode())
    {
      autoEscapeContext = new AutoEscapeContext(mode, templateName);
      skipAutoEscape = false;
    }
    else
    {
      autoEscapeContext = null;
    }
  }
  
  public AutoEscaper(EscapeMode mode)
  {
    this(mode, null);
  }
  
  public void caseStart(Start start)
  {
    if (!escapeMode.isAutoEscapingMode())
    {
      handleExplicitEscapeMode(start);
    }
    else
    {
      AutoEscapeContext.AutoEscapeState startState = autoEscapeContext.getCurrentState();
      
      super.caseStart(start);
      AutoEscapeContext.AutoEscapeState endState = autoEscapeContext.getCurrentState();
      if (!autoEscapeContext.isPermittedStateChangeForIncludes(startState, endState))
      {
        if (contentTypeCalled) {
          return;
        }
        throw new JSilverAutoEscapingException("Template starts in context " + startState + " but ends in different context " + endState, templateName);
      }
    }
  }
  
  private void handleExplicitEscapeMode(Start start)
  {
    AStringExpression escapeExpr = new AStringExpression(new TString("\"" + escapeMode.getEscapeCommand() + "\""));
    
    PCommand node = start.getPCommand();
    AEscapeCommand escape = new AEscapeCommand(new ACsOpenPosition(new TCsOpen("<?cs ", 0, 0)), escapeExpr, (PCommand)node.clone());
    
    node.replaceBy(escape);
  }
  
  public void caseADataCommand(ADataCommand node)
  {
    String data = node.getData().getText();
    autoEscapeContext.setCurrentPosition(node.getData().getLine(), node.getData().getPos());
    autoEscapeContext.parseData(data);
  }
  
  public void caseADefCommand(ADefCommand node) {}
  
  public void caseAIfCommand(AIfCommand node)
  {
    setCurrentPosition(node.getPosition());
    
    AutoEscapeContext originalEscapedContext = autoEscapeContext.cloneCurrentEscapeContext();
    
    int line = autoEscapeContext.getLineNumber();
    int column = autoEscapeContext.getColumnNumber();
    if (node.getBlock() != null) {
      node.getBlock().apply(this);
    }
    AutoEscapeContext.AutoEscapeState ifEndState = autoEscapeContext.getCurrentState();
    
    autoEscapeContext = originalEscapedContext;
    if (node.getOtherwise() != null) {
      node.getOtherwise().apply(this);
    }
    AutoEscapeContext.AutoEscapeState elseEndState = autoEscapeContext.getCurrentState();
    if (!ifEndState.equals(elseEndState)) {
      throw new JSilverAutoEscapingException("'if/else' branches have different ending contexts " + ifEndState + " and " + elseEndState, templateName, line, column);
    }
  }
  
  public void caseAEscapeCommand(AEscapeCommand node)
  {
    boolean saved_skip = skipAutoEscape;
    skipAutoEscape = true;
    node.getCommand().apply(this);
    skipAutoEscape = saved_skip;
  }
  
  public void caseACallCommand(ACallCommand node)
  {
    saveAutoEscapingContext(node, node.getPosition());
  }
  
  public void caseALvarCommand(ALvarCommand node)
  {
    saveAutoEscapingContext(node, node.getPosition());
  }
  
  public void caseAEvarCommand(AEvarCommand node)
  {
    saveAutoEscapingContext(node, node.getPosition());
  }
  
  public void caseALincludeCommand(ALincludeCommand node)
  {
    saveAutoEscapingContext(node, node.getPosition());
  }
  
  public void caseAIncludeCommand(AIncludeCommand node)
  {
    saveAutoEscapingContext(node, node.getPosition());
  }
  
  public void caseAHardLincludeCommand(AHardLincludeCommand node)
  {
    saveAutoEscapingContext(node, node.getPosition());
  }
  
  public void caseAHardIncludeCommand(AHardIncludeCommand node)
  {
    saveAutoEscapingContext(node, node.getPosition());
  }
  
  public void caseAVarCommand(AVarCommand node)
  {
    applyAutoEscaping(node, node.getPosition());
  }
  
  public void caseAAltCommand(AAltCommand node)
  {
    applyAutoEscaping(node, node.getPosition());
  }
  
  public void caseANameCommand(ANameCommand node)
  {
    applyAutoEscaping(node, node.getPosition());
  }
  
  public void caseAUvarCommand(AUvarCommand node)
  {
    setCurrentPosition(node.getPosition());
    autoEscapeContext.insertText();
  }
  
  public void caseAContentTypeCommand(AContentTypeCommand node)
  {
    setCurrentPosition(node.getPosition());
    String contentType = node.getString().getText();
    
    contentType = contentType.substring(1, contentType.length() - 1);
    autoEscapeContext.setContentType(contentType);
    contentTypeCalled = true;
  }
  
  private void applyAutoEscaping(PCommand node, PPosition position)
  {
    setCurrentPosition(position);
    if (skipAutoEscape) {
      return;
    }
    AStringExpression escapeExpr = new AStringExpression(new TString("\"" + getEscaping() + "\""));
    AEscapeCommand escape = new AEscapeCommand(position, escapeExpr, (PCommand)node.clone());
    
    node.replaceBy(escape);
    
    autoEscapeContext.insertText();
  }
  
  private void setCurrentPosition(PPosition position)
  {
    position.apply(this);
  }
  
  public void caseACsOpenPosition(ACsOpenPosition node)
  {
    Token token = node.getCsOpen();
    autoEscapeContext.setCurrentPosition(token.getLine(), token.getPos());
  }
  
  private void saveAutoEscapingContext(Node node, PPosition position)
  {
    setCurrentPosition(position);
    if (skipAutoEscape) {
      return;
    }
    EscapeMode mode = autoEscapeContext.getEscapeModeForCurrentState();
    AStringExpression escapeStrategy = new AStringExpression(new TString("\"" + mode.getEscapeCommand() + "\""));
    
    AAutoescapeCommand command = new AAutoescapeCommand(position, escapeStrategy, (PCommand)node.clone());
    
    node.replaceBy(command);
    autoEscapeContext.insertText();
  }
  
  private String getEscaping()
  {
    return autoEscapeContext.getEscapingFunctionForCurrentState();
  }
}

/* Location:
 * Qualified Name:     com.google.clearsilver.jsilver.syntax.AutoEscaper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.google.clearsilver.jsilver.syntax;

import com.google.clearsilver.jsilver.exceptions.JSilverBadSyntaxException;
import com.google.clearsilver.jsilver.syntax.analysis.DepthFirstAdapter;
import com.google.clearsilver.jsilver.syntax.node.ADataCommand;
import com.google.clearsilver.jsilver.syntax.node.AInlineCommand;
import com.google.clearsilver.jsilver.syntax.node.ANoopCommand;
import com.google.clearsilver.jsilver.syntax.node.PCommand;
import com.google.clearsilver.jsilver.syntax.node.TData;

final class InlineRewriter$1
  extends DepthFirstAdapter
{
  public void caseADataCommand(ADataCommand node)
  {
    TData data = node.getData();
    if (InlineRewriter.access$000(data.getText()))
    {
      node.replaceBy(new ANoopCommand());
      return;
    }
    throw new JSilverBadSyntaxException("literal text in an inline block may only contain whitespace", data.getText(), null, data.getLine(), data.getPos(), null);
  }
  
  public void caseAInlineCommand(AInlineCommand node)
  {
    PCommand command = node.getCommand();
    node.replaceBy(command);
    command.apply(this);
  }
}

/* Location:
 * Qualified Name:     com.google.clearsilver.jsilver.syntax.InlineRewriter.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.google.clearsilver.jsilver.syntax;

import com.google.clearsilver.jsilver.exceptions.JSilverBadSyntaxException;
import com.google.clearsilver.jsilver.syntax.analysis.AnalysisAdapter;
import com.google.clearsilver.jsilver.syntax.analysis.DepthFirstAdapter;
import com.google.clearsilver.jsilver.syntax.node.ADataCommand;
import com.google.clearsilver.jsilver.syntax.node.AInlineCommand;
import com.google.clearsilver.jsilver.syntax.node.ANoopCommand;
import com.google.clearsilver.jsilver.syntax.node.PCommand;
import com.google.clearsilver.jsilver.syntax.node.TData;

public class InlineRewriter
  extends DepthFirstAdapter
{
  private static AnalysisAdapter WHITESPACE_STRIPPER = new DepthFirstAdapter()
  {
    public void caseADataCommand(ADataCommand node)
    {
      TData data = node.getData();
      if (InlineRewriter.isAllWhitespace(data.getText()))
      {
        node.replaceBy(new ANoopCommand());
        return;
      }
      throw new JSilverBadSyntaxException("literal text in an inline block may only contain whitespace", data.getText(), null, data.getLine(), data.getPos(), null);
    }
    
    public void caseAInlineCommand(AInlineCommand node)
    {
      PCommand command = node.getCommand();
      node.replaceBy(command);
      command.apply(this);
    }
  };
  
  private static boolean isAllWhitespace(String s)
  {
    for (int i = 0; i < s.length(); i++) {
      if (!Character.isWhitespace(s.charAt(i))) {
        return false;
      }
    }
    return true;
  }
  
  public void caseAInlineCommand(AInlineCommand node)
  {
    node.getCommand().apply(WHITESPACE_STRIPPER);
    node.replaceBy(node.getCommand());
  }
}

/* Location:
 * Qualified Name:     com.google.clearsilver.jsilver.syntax.InlineRewriter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.google.clearsilver.jsilver.syntax;

import com.google.clearsilver.jsilver.syntax.analysis.DepthFirstAdapter;
import com.google.clearsilver.jsilver.syntax.node.ASequenceExpression;
import com.google.clearsilver.jsilver.syntax.node.Node;
import com.google.clearsilver.jsilver.syntax.node.PExpression;
import java.util.LinkedList;

public class SequenceOptimizer
  extends DepthFirstAdapter
{
  public void caseASequenceExpression(ASequenceExpression originalNode)
  {
    super.caseASequenceExpression(originalNode);
    LinkedList<PExpression> args = originalNode.getArgs();
    if (args.size() == 1) {
      originalNode.replaceBy((Node)args.getFirst());
    }
  }
}

/* Location:
 * Qualified Name:     com.google.clearsilver.jsilver.syntax.SequenceOptimizer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.google.clearsilver.jsilver.syntax.parser;

import com.google.clearsilver.jsilver.syntax.analysis.AnalysisAdapter;
import com.google.clearsilver.jsilver.syntax.node.EOF;
import com.google.clearsilver.jsilver.syntax.node.TAlt;
import com.google.clearsilver.jsilver.syntax.node.TAnd;
import com.google.clearsilver.jsilver.syntax.node.TAssignment;
import com.google.clearsilver.jsilver.syntax.node.TAutoescape;
import com.google.clearsilver.jsilver.syntax.node.TBang;
import com.google.clearsilver.jsilver.syntax.node.TBracketClose;
import com.google.clearsilver.jsilver.syntax.node.TBracketOpen;
import com.google.clearsilver.jsilver.syntax.node.TCall;
import com.google.clearsilver.jsilver.syntax.node.TComma;
import com.google.clearsilver.jsilver.syntax.node.TCommandDelimiter;
import com.google.clearsilver.jsilver.syntax.node.TComment;
import com.google.clearsilver.jsilver.syntax.node.TCommentStart;
import com.google.clearsilver.jsilver.syntax.node.TContentType;
import com.google.clearsilver.jsilver.syntax.node.TCsClose;
import com.google.clearsilver.jsilver.syntax.node.TCsOpen;
import com.google.clearsilver.jsilver.syntax.node.TData;
import com.google.clearsilver.jsilver.syntax.node.TDecNumber;
import com.google.clearsilver.jsilver.syntax.node.TDef;
import com.google.clearsilver.jsilver.syntax.node.TDollar;
import com.google.clearsilver.jsilver.syntax.node.TDot;
import com.google.clearsilver.jsilver.syntax.node.TEach;
import com.google.clearsilver.jsilver.syntax.node.TElse;
import com.google.clearsilver.jsilver.syntax.node.TElseIf;
import com.google.clearsilver.jsilver.syntax.node.TEq;
import com.google.clearsilver.jsilver.syntax.node.TEscape;
import com.google.clearsilver.jsilver.syntax.node.TEvar;
import com.google.clearsilver.jsilver.syntax.node.TGt;
import com.google.clearsilver.jsilver.syntax.node.TGte;
import com.google.clearsilver.jsilver.syntax.node.THardDelimiter;
import com.google.clearsilver.jsilver.syntax.node.THash;
import com.google.clearsilver.jsilver.syntax.node.THexNumber;
import com.google.clearsilver.jsilver.syntax.node.TIf;
import com.google.clearsilver.jsilver.syntax.node.TInclude;
import com.google.clearsilver.jsilver.syntax.node.TInline;
import com.google.clearsilver.jsilver.syntax.node.TLinclude;
import com.google.clearsilver.jsilver.syntax.node.TLoop;
import com.google.clearsilver.jsilver.syntax.node.TLt;
import com.google.clearsilver.jsilver.syntax.node.TLte;
import com.google.clearsilver.jsilver.syntax.node.TLvar;
import com.google.clearsilver.jsilver.syntax.node.TMinus;
import com.google.clearsilver.jsilver.syntax.node.TName;
import com.google.clearsilver.jsilver.syntax.node.TNe;
import com.google.clearsilver.jsilver.syntax.node.TOr;
import com.google.clearsilver.jsilver.syntax.node.TParenClose;
import com.google.clearsilver.jsilver.syntax.node.TParenOpen;
import com.google.clearsilver.jsilver.syntax.node.TPercent;
import com.google.clearsilver.jsilver.syntax.node.TPlus;
import com.google.clearsilver.jsilver.syntax.node.TQuestion;
import com.google.clearsilver.jsilver.syntax.node.TSet;
import com.google.clearsilver.jsilver.syntax.node.TSlash;
import com.google.clearsilver.jsilver.syntax.node.TStar;
import com.google.clearsilver.jsilver.syntax.node.TString;
import com.google.clearsilver.jsilver.syntax.node.TUvar;
import com.google.clearsilver.jsilver.syntax.node.TVar;
import com.google.clearsilver.jsilver.syntax.node.TWith;
import com.google.clearsilver.jsilver.syntax.node.TWord;

class TokenIndex
  extends AnalysisAdapter
{
  int index;
  
  public void caseTData(TData node)
  {
    index = 0;
  }
  
  public void caseTComment(TComment node)
  {
    index = 1;
  }
  
  public void caseTVar(TVar node)
  {
    index = 2;
  }
  
  public void caseTLvar(TLvar node)
  {
    index = 3;
  }
  
  public void caseTEvar(TEvar node)
  {
    index = 4;
  }
  
  public void caseTUvar(TUvar node)
  {
    index = 5;
  }
  
  public void caseTSet(TSet node)
  {
    index = 6;
  }
  
  public void caseTIf(TIf node)
  {
    index = 7;
  }
  
  public void caseTElseIf(TElseIf node)
  {
    index = 8;
  }
  
  public void caseTElse(TElse node)
  {
    index = 9;
  }
  
  public void caseTWith(TWith node)
  {
    index = 10;
  }
  
  public void caseTEscape(TEscape node)
  {
    index = 11;
  }
  
  public void caseTAutoescape(TAutoescape node)
  {
    index = 12;
  }
  
  public void caseTLoop(TLoop node)
  {
    index = 13;
  }
  
  public void caseTEach(TEach node)
  {
    index = 14;
  }
  
  public void caseTAlt(TAlt node)
  {
    index = 15;
  }
  
  public void caseTName(TName node)
  {
    index = 16;
  }
  
  public void caseTDef(TDef node)
  {
    index = 17;
  }
  
  public void caseTCall(TCall node)
  {
    index = 18;
  }
  
  public void caseTInclude(TInclude node)
  {
    index = 19;
  }
  
  public void caseTLinclude(TLinclude node)
  {
    index = 20;
  }
  
  public void caseTContentType(TContentType node)
  {
    index = 21;
  }
  
  public void caseTInline(TInline node)
  {
    index = 22;
  }
  
  public void caseTComma(TComma node)
  {
    index = 23;
  }
  
  public void caseTBang(TBang node)
  {
    index = 24;
  }
  
  public void caseTAssignment(TAssignment node)
  {
    index = 25;
  }
  
  public void caseTEq(TEq node)
  {
    index = 26;
  }
  
  public void caseTNe(TNe node)
  {
    index = 27;
  }
  
  public void caseTLt(TLt node)
  {
    index = 28;
  }
  
  public void caseTGt(TGt node)
  {
    index 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd