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


Java Builder.appendPlaceholderReference方法代码示例

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


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

示例1: extractFromReturnDescendant

import com.google.javascript.jscomp.JsMessage.Builder; //导入方法依赖的package包/类
/**
 * Appends value parts to the message builder by traversing the descendants
 * of the given RETURN node.
 *
 * @param builder the message builder
 * @param node the node from where we extract a message
 * @throws MalformedException if the parsed message is invalid
 */
private void extractFromReturnDescendant(Builder builder, Node node)
    throws MalformedException {

  switch (node.getType()) {
    case Token.STRING:
      builder.appendStringPart(node.getString());
      break;
    case Token.NAME:
      builder.appendPlaceholderReference(node.getString());
      break;
    case Token.ADD:
      for (Node child : node.children()) {
        extractFromReturnDescendant(builder, child);
      }
      break;
    default:
      throw new MalformedException(
          "STRING, NAME, or ADD node expected; found: "
              + getReadableTokenName(node), node);
  }
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:30,代码来源:JsMessageVisitor.java

示例2: extractFromReturnDescendant

import com.google.javascript.jscomp.JsMessage.Builder; //导入方法依赖的package包/类
/**
 * Appends value parts to the message builder by traversing the descendants
 * of the given RETURN node.
 *
 * @param builder the message builder
 * @param node the node from where we extract a message
 * @throws MalformedException if the parsed message is invalid
 */
private static void extractFromReturnDescendant(Builder builder, Node node)
    throws MalformedException {

  switch (node.getToken()) {
    case STRING:
      builder.appendStringPart(node.getString());
      break;
    case NAME:
      builder.appendPlaceholderReference(node.getString());
      break;
    case ADD:
      for (Node child : node.children()) {
        extractFromReturnDescendant(builder, child);
      }
      break;
    default:
      throw new MalformedException(
          "STRING, NAME, or ADD node expected; found: " + node.getToken(), node);
  }
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:29,代码来源:JsMessageVisitor.java

示例3: extractFromReturnDescendant

import com.google.javascript.jscomp.JsMessage.Builder; //导入方法依赖的package包/类
/**
 * Appends value parts to the message builder by traversing the descendants
 * of the given RETURN node.
 *
 * @param builder the message builder
 * @param node the node from where we extract a message
 * @throws MalformedException if the parsed message is invalid
 */
private static void extractFromReturnDescendant(Builder builder, Node node)
    throws MalformedException {

  switch (node.getType()) {
    case Token.STRING:
      builder.appendStringPart(node.getString());
      break;
    case Token.NAME:
      builder.appendPlaceholderReference(node.getString());
      break;
    case Token.ADD:
      for (Node child : node.children()) {
        extractFromReturnDescendant(builder, child);
      }
      break;
    default:
      throw new MalformedException(
          "STRING, NAME, or ADD node expected; found: "
              + getReadableTokenName(node), node);
  }
}
 
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:30,代码来源:JsMessageVisitor.java

示例4: parseMessageTextNode

import com.google.javascript.jscomp.JsMessage.Builder; //导入方法依赖的package包/类
/**
 * Appends the message parts in a JS message value extracted from the given
 * text node.
 *
 * @param builder the js message builder to append parts to
 * @param node the node with string literal that contains the message text
 * @throws MalformedException if {@code value} contains a reference to
 *         an unregistered placeholder
 */
private void parseMessageTextNode(Builder builder, Node node)
    throws MalformedException {
  String value = extractStringFromStringExprNode(node);

  while(true) {
    int phBegin = value.indexOf(PH_JS_PREFIX);
    if (phBegin < 0) {
      // Just a string literal
      builder.appendStringPart(value);
      return;
    } else {
      if (phBegin > 0) {
        // A string literal followed by a placeholder
        builder.appendStringPart(value.substring(0, phBegin));
      }

      // A placeholder. Find where it ends
      int phEnd = value.indexOf(PH_JS_SUFFIX, phBegin);
      if (phEnd < 0) {
        throw new MalformedException(
            "Placeholder incorrectly formatted in: " + builder.getKey(),
            node);
      }

      String phName = value.substring(phBegin + PH_JS_PREFIX.length(),
          phEnd);
      builder.appendPlaceholderReference(phName);
      int nextPos = phEnd + PH_JS_SUFFIX.length();
      if (nextPos < value.length()) {
        // Iterate on the rest of the message value
        value = value.substring(nextPos);
      } else {
        // The message is parsed
        return;
      }
    }
  }
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:48,代码来源:JsMessageVisitor.java

示例5: parseMessageTextNode

import com.google.javascript.jscomp.JsMessage.Builder; //导入方法依赖的package包/类
/**
 * Appends the message parts in a JS message value extracted from the given
 * text node.
 *
 * @param builder the JS message builder to append parts to
 * @param node the node with string literal that contains the message text
 * @throws MalformedException if {@code value} contains a reference to
 *         an unregistered placeholder
 */
private void parseMessageTextNode(Builder builder, Node node)
    throws MalformedException {
  String value = extractStringFromStringExprNode(node);

  while(true) {
    int phBegin = value.indexOf(PH_JS_PREFIX);
    if (phBegin < 0) {
      // Just a string literal
      builder.appendStringPart(value);
      return;
    } else {
      if (phBegin > 0) {
        // A string literal followed by a placeholder
        builder.appendStringPart(value.substring(0, phBegin));
      }

      // A placeholder. Find where it ends
      int phEnd = value.indexOf(PH_JS_SUFFIX, phBegin);
      if (phEnd < 0) {
        throw new MalformedException(
            "Placeholder incorrectly formatted in: " + builder.getKey(),
            node);
      }

      String phName = value.substring(phBegin + PH_JS_PREFIX.length(),
          phEnd);
      builder.appendPlaceholderReference(phName);
      int nextPos = phEnd + PH_JS_SUFFIX.length();
      if (nextPos < value.length()) {
        // Iterate on the rest of the message value
        value = value.substring(nextPos);
      } else {
        // The message is parsed
        return;
      }
    }
  }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:48,代码来源:JsMessageVisitor.java

示例6: parseMessageTextNode

import com.google.javascript.jscomp.JsMessage.Builder; //导入方法依赖的package包/类
/**
 * Appends the message parts in a JS message value extracted from the given
 * text node.
 *
 * @param builder the JS message builder to append parts to
 * @param node the node with string literal that contains the message text
 * @throws MalformedException if {@code value} contains a reference to
 *         an unregistered placeholder
 */
private static void parseMessageTextNode(Builder builder, Node node)
    throws MalformedException {
  String value = extractStringFromStringExprNode(node);

  while (true) {
    int phBegin = value.indexOf(PH_JS_PREFIX);
    if (phBegin < 0) {
      // Just a string literal
      builder.appendStringPart(value);
      return;
    } else {
      if (phBegin > 0) {
        // A string literal followed by a placeholder
        builder.appendStringPart(value.substring(0, phBegin));
      }

      // A placeholder. Find where it ends
      int phEnd = value.indexOf(PH_JS_SUFFIX, phBegin);
      if (phEnd < 0) {
        throw new MalformedException(
            "Placeholder incorrectly formatted in: " + builder.getKey(),
            node);
      }

      String phName = value.substring(phBegin + PH_JS_PREFIX.length(),
          phEnd);
      builder.appendPlaceholderReference(phName);
      int nextPos = phEnd + PH_JS_SUFFIX.length();
      if (nextPos < value.length()) {
        // Iterate on the rest of the message value
        value = value.substring(nextPos);
      } else {
        // The message is parsed
        return;
      }
    }
  }
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:48,代码来源:JsMessageVisitor.java

示例7: parseMessageTextNode

import com.google.javascript.jscomp.JsMessage.Builder; //导入方法依赖的package包/类
/**
 * Appends the message parts in a JS message value extracted from the given
 * text node.
 *
 * @param builder the JS message builder to append parts to
 * @param node the node with string literal that contains the message text
 * @throws MalformedException if {@code value} contains a reference to
 *         an unregistered placeholder
 */
private void parseMessageTextNode(Builder builder, Node node)
    throws MalformedException {
  String value = extractStringFromStringExprNode(node);

  while (true) {
    int phBegin = value.indexOf(PH_JS_PREFIX);
    if (phBegin < 0) {
      // Just a string literal
      builder.appendStringPart(value);
      return;
    } else {
      if (phBegin > 0) {
        // A string literal followed by a placeholder
        builder.appendStringPart(value.substring(0, phBegin));
      }

      // A placeholder. Find where it ends
      int phEnd = value.indexOf(PH_JS_SUFFIX, phBegin);
      if (phEnd < 0) {
        throw new MalformedException(
            "Placeholder incorrectly formatted in: " + builder.getKey(),
            node);
      }

      String phName = value.substring(phBegin + PH_JS_PREFIX.length(),
          phEnd);
      builder.appendPlaceholderReference(phName);
      int nextPos = phEnd + PH_JS_SUFFIX.length();
      if (nextPos < value.length()) {
        // Iterate on the rest of the message value
        value = value.substring(nextPos);
      } else {
        // The message is parsed
        return;
      }
    }
  }
}
 
开发者ID:Robbert,项目名称:closure-compiler-copy,代码行数:48,代码来源:JsMessageVisitor.java


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