当前位置: 首页>>代码示例>>Java>>正文


Java RenderContext.getOut方法代码示例

本文整理汇总了Java中com.google.caja.reporting.RenderContext.getOut方法的典型用法代码示例。如果您正苦于以下问题:Java RenderContext.getOut方法的具体用法?Java RenderContext.getOut怎么用?Java RenderContext.getOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.caja.reporting.RenderContext的用法示例。


在下文中一共展示了RenderContext.getOut方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderShort

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
/**
 * Renders the short form without the "var" keyword.
 * This is used in multi declarations, such as in
 * {@code for (var a = 0, b = 1, ...)}.
 */
void renderShort(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());
  if (identifier.getName() == null) {
    throw new IllegalStateException(
        "null name for declaration at " + getFilePosition());
  }
  identifier.render(rc);
  if (null != initializer) {
    out.consume("=");
    boolean isComma = Operation.is(initializer, Operator.COMMA);
    if (isComma) { out.consume("("); }
    initializer.render(rc);
    if (isComma) { out.consume(")"); }
  }
}
 
开发者ID:google,项目名称:caja,代码行数:22,代码来源:Declaration.java

示例2: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public void render(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());
  String label = getRenderedLabel();
  if (null != label) {
    out.consume(label);
    out.consume(":");
  }
  out.consume("for");
  out.consume("(");
  if (!(initializer instanceof Noop)) { initializer.render(rc); }
  out.consume(JsMinimalPrinter.NOOP);
  if (!(condition instanceof BooleanLiteral
        && ((BooleanLiteral) condition).getValue())) {
    condition.render(rc);
  }
  out.consume(JsMinimalPrinter.NOOP);
  if (!(increment instanceof Noop)) { increment.render(rc); }
  out.consume(")");
  getBody().renderBlock(rc, false);
}
 
开发者ID:google,项目名称:caja,代码行数:22,代码来源:ForLoop.java

示例3: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
@Override
public void render(RenderContext rc) {
  FunctionConstructor fc = getInitializer();
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());
  out.consume("function");
  getIdentifier().render(rc);
  out.consume("(");
  boolean seen = false;
  for (FormalParam p : fc.getParams()) {
    if (seen) {
      out.consume(",");
    } else {
      seen = true;
    }
    p.render(rc);
  }
  out.consume(")");
  fc.getBody().renderBlock(rc, false);
}
 
开发者ID:google,项目名称:caja,代码行数:21,代码来源:FunctionDeclaration.java

示例4: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public void render(RenderContext r) {
  TokenConsumer out = r.getOut();
  children().get(0).render(r);
  out.consume("{");
  out.consume(String.valueOf(minCount));
  if (minCount != maxCount) {
    out.consume(",");
    if (Integer.MAX_VALUE != maxCount) {
      out.consume(String.valueOf(maxCount));
    }
  }
  out.consume("}");
}
 
开发者ID:google,项目名称:caja,代码行数:14,代码来源:CssPropertySignature.java

示例5: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public void render(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());
  String label = getRenderedLabel();
  if (null != label) {
    out.consume(label);
    out.consume(":");
  }
  getBody().render(rc);
}
 
开发者ID:google,项目名称:caja,代码行数:11,代码来源:LabeledStmtWrapper.java

示例6: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public void render(RenderContext rc) {
  Expression value = children().get(1);
  TokenConsumer out = rc.getOut();
  renderPropertyName(rc, false);
  out.consume(":");
  if (!Operation.is(value, Operator.COMMA)) {
    value.render(rc);
  } else {
    out.mark(value.getFilePosition());
    out.consume("(");
    value.render(rc);
    out.consume(")");
  }
}
 
开发者ID:google,项目名称:caja,代码行数:15,代码来源:ValueProperty.java

示例7: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public final void render(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());
  renderHead(rc);
  out.consume(":");
  out.consume("\n");
  Block body = getBody();
  rc.getOut().mark(body.getFilePosition());
  body.renderBody(rc);
}
 
开发者ID:google,项目名称:caja,代码行数:11,代码来源:SwitchCase.java

示例8: renderBody

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public void renderBody(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  for (Statement stmt : children()) {
    out.mark(stmt.getFilePosition());
    stmt.render(rc);
    if (!stmt.isTerminal()) {
      out.mark(FilePosition.endOfOrNull(stmt.getFilePosition()));
      out.consume(";");
    }
  }
  out.mark(FilePosition.endOfOrNull(getFilePosition()));
}
 
开发者ID:google,项目名称:caja,代码行数:13,代码来源:Block.java

示例9: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
@Override
public void render(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());

  String body = value.getMatchText();
  String mods = value.getModifiers();
  if ("".equals(body) || !areRegexpModifiersValid(mods)) {
    // (new (/./.constructor))('', 'g')
    out.consume("(");
    out.consume("new");
    out.consume("(");
    out.consume("/./");
    out.consume(".");
    out.consume("constructor");
    out.consume(")");
    out.consume("(");
    StringLiteral.renderUnquotedValue(body, rc);
    out.consume(",");
    StringLiteral.renderUnquotedValue(mods, rc);
    out.consume(")");
    out.consume(")");
  } else {
    StringBuilder sb = new StringBuilder();
    sb.append('/');
    Escaping.normalizeRegex(body, sb);
    sb.append('/');
    sb.append(mods);
    out.consume(sb.toString());
  }
}
 
开发者ID:google,项目名称:caja,代码行数:32,代码来源:RegexpLiteral.java

示例10: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public void render(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());
  String label = getRenderedLabel();
  if (null != label) {
    out.consume(label);
    out.consume(":");
  }
  out.consume("while");
  out.consume("(");
  condition.render(rc);
  out.consume(")");
  body.renderBlock(rc, false);
}
 
开发者ID:google,项目名称:caja,代码行数:15,代码来源:WhileLoop.java

示例11: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public void render(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());
  Expression e = getExpression();
  if (e instanceof FunctionConstructor
      || e instanceof ObjectConstructor
      || startsWithRegex(e)) {
    // We need to parenthesize Object constructors because otherwise an
    // object constructor with only one entry:
    //   { x : 4 }
    // is ambiguous.  It could be a block containing a labeled expression
    // statement, and depending on semicolon insertion.

    // We need to parenthesize Function constructors because otherwise
    // we might output something like
    //   function a () {
    //     ;
    //   };
    // which is interpreted as two statements -- a declaration and a noop for
    // the semicolon.

    // Rhino fails to parse
    //   if(...)/foo/.test(x)?bar:baz;
    // so we parenthesize operator trees whose left-most operand is a regex
    // literal.

    out.consume("(");
    e.render(rc);
    out.consume(")");
  } else {
    e.render(rc);
  }
}
 
开发者ID:google,项目名称:caja,代码行数:34,代码来源:ExpressionStmt.java

示例12: renderActuals

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
void renderActuals(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.consume("(");
  boolean seen = false;
  for (FormalParam e : params) {
    if (seen) {
      out.consume(",");
    } else {
      seen = true;
    }
    e.render(rc);
  }
  out.consume(")");
}
 
开发者ID:google,项目名称:caja,代码行数:15,代码来源:FunctionConstructor.java

示例13: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public void render(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());
  out.consume("catch");
  out.consume("(");
  out.mark(exception.getFilePosition());
  exception.getIdentifier().render(rc);
  out.consume(")");
  body.renderBlock(rc, false);
}
 
开发者ID:google,项目名称:caja,代码行数:11,代码来源:CatchStmt.java

示例14: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public void render(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());
  out.consume("continue");
  if (null != label && !"".equals(label)) {
    out.consume(label);
  }
}
 
开发者ID:google,项目名称:caja,代码行数:9,代码来源:ContinueStmt.java

示例15: render

import com.google.caja.reporting.RenderContext; //导入方法依赖的package包/类
public void render(RenderContext rc) {
  TokenConsumer out = rc.getOut();
  out.mark(getFilePosition());
  out.consume("var");
  renderShort(rc);
}
 
开发者ID:google,项目名称:caja,代码行数:7,代码来源:Declaration.java


注:本文中的com.google.caja.reporting.RenderContext.getOut方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。