Examples of FilePosition


Examples of com.google.caja.lexer.FilePosition

          if (semicolonInserted()) {
            List<Message> messages = mq.getMessages();
            if (nMessages < messages.size()) {
              messages.subList(nMessages, messages.size()).clear();
            }
            FilePosition semiPoint = FilePosition.endOf(tq.lastPosition());
            messages.add(new Message(
                             MessageType.SEMICOLON_INSERTED, semiPoint));
            return left;
          } else {
            tq.rewind(m3);
View Full Code Here

Examples of com.google.caja.lexer.FilePosition

    return left;
  }

  private boolean semicolonInserted() throws ParseException {
    if (tq.isEmpty() || tq.lookaheadToken(Punctuation.RCURLY)) { return true; }
    FilePosition last = tq.lastPosition(),
              current = tq.currentPosition();
    if (last == null) { return true; // Can insert at beginning
    if (current.startLineNo() == last.endLineNo()) { return false; }
    for (Token<JsTokenType> filtered : tq.filteredTokens()) {
      if (filtered.type == JsTokenType.LINE_CONTINUATION) { return false; }
    }
    return true;
  }
View Full Code Here

Examples of com.google.caja.lexer.FilePosition

    }
    return true;
  }

  private void checkForMissingSemicolon() throws ParseException {
    FilePosition current = tq.currentPosition();
    FilePosition last = tq.lastPosition();
    if (current.source().equals(last.source())
        && current.startLineNo() > last.endLineNo()) {
      mq.addMessage(MessageType.MAYBE_MISSING_SEMI, FilePosition.endOf(last));
    }
  }
View Full Code Here

Examples of com.google.caja.lexer.FilePosition

    if (null == e) {
      if (recoverFromFailure) {
        tq.rewind(m);
        // create a placeholder expression
        FilePosition pos = FilePosition.span(
            tq.lastPosition(), tq.currentPosition());
        mq.addMessage(MessageType.PLACEHOLDER_INSERTED, pos);
        Identifier idNode = new Identifier(pos, "_");
        e = new Reference(idNode);
      } else {
View Full Code Here

Examples of com.google.caja.lexer.FilePosition

    // Look for a semicolon
    if (tq.checkToken(Punctuation.SEMI)) { return; }
    // None found, so maybe do insertion.
    if (tq.isEmpty()) { return; }
    if (semicolonInserted()) {
      FilePosition semiPoint = FilePosition.endOf(tq.lastPosition());
      MessageLevel lvl = tq.isEmpty() || tq.lookaheadToken(Punctuation.RCURLY)
          ? MessageLevel.LOG : MessageLevel.LINT;
      mq.addMessage(MessageType.SEMICOLON_INSERTED, lvl, semiPoint);
    } else {
      tq.expectToken(Punctuation.SEMI)// Just used to throw an exception
View Full Code Here

Examples of com.google.caja.lexer.FilePosition

  private static final AttribKey SCRIPT_SRC = AttribKey.forHtmlAttrib(
      ElKey.forHtmlElement("script"), "src");

  private static Statement export(String key, Expression e) {
    FilePosition unk = FilePosition.UNKNOWN;
    // The html4[@k] assignment is an explicit export for Closure Compiler
    return (Statement) QuasiBuilder.substV(
            "{ html4.@i = @e; html4[@k] = html4.@i; }",
            "i", new Reference(new Identifier(unk, key)),
            "k", new StringLiteral(unk, key),
View Full Code Here

Examples of com.google.caja.lexer.FilePosition

  }

  private static <U> Statement mapFromEnum(
      Iterable<U> entries, String key,
      Function<U, String> keyMaker, Function<U, Integer> valueMaker) {
    FilePosition unk = FilePosition.UNKNOWN;
    List<StringLiteral> keys = Lists.newArrayList();
    List<IntegerLiteral> values = Lists.newArrayList();
    for (U e : entries) {
      // Since enum values are public, we don't want Closure compiler
      // to rewrite them, so we need quoted keys.
View Full Code Here

Examples of com.google.caja.lexer.FilePosition

   * should stringify to the JS keys and whose values are mapped by the function
   * {@code codegen}.
   */
  private static <T> Statement mapFromMap(
      Map<?, T> entries, String key, Function<T, Expression> codegen) {
    final FilePosition unk = FilePosition.UNKNOWN;
    List<StringLiteral> keys = new ArrayList<StringLiteral>();
    List<Expression> values = new ArrayList<Expression>();
    for (Map.Entry<?, T> e : entries.entrySet()) {
      keys.add(StringLiteral.valueOf(unk, e.getKey().toString()));
      values.add(codegen.apply(e.getValue()));
View Full Code Here

Examples of com.google.caja.lexer.FilePosition

        "k", new ParseTreeNodeContainer(keys),
        "v", new ParseTreeNodeContainer(values)));
  }

  public static Block generateJavascriptDefinitions(HtmlSchema schema) {
    final FilePosition unk = FilePosition.UNKNOWN;
    Map<AttribKey, HTML.Attribute.Type> atypes = attributeTypes(schema);
    Map<ElKey, EnumSet<EFlag>> eflags = elementFlags(schema);
    Map<ElKey, String> einterfaces = elementDOMInterfaces(schema);
    Map<AttribKey, UriEffect> uriEffects = uriEffects(schema);
    Map<AttribKey, LoaderType> ltypes = loaderTypes(schema);
View Full Code Here

Examples of com.google.caja.lexer.FilePosition

        .put("z-index", CssPropBit.QUANTITY)
        .build();

  public static void generatePatterns(CssSchema schema, Appendable out)
      throws IOException {
    FilePosition unk = FilePosition.UNKNOWN;
    CssPropertyPatterns pp = new CssPropertyPatterns(schema);
    List<CssSchema.CssPropertyInfo> props
        = Lists.newArrayList(schema.getCssProperties());
    Collections.sort(
        props, new Comparator<CssSchema.CssPropertyInfo>() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.