Package com.google.caja.lexer

Examples of com.google.caja.lexer.FilePosition.source()


            && expectedPart instanceof FilePosition) {
          FilePosition a = (FilePosition) candidate;
          FilePosition b = (FilePosition) expectedPart;
          // Ignore startCharInFile for purposes of testing to make tests more
          // robust against changes.
          if (a.source().equals(b.source())
              && a.startLineNo() == b.startLineNo()
              && a.startCharInLine() == b.startCharInLine()
              && a.endLineNo() == b.endLineNo()
              && a.endCharInLine() == b.endCharInLine()) {
            continue outerLoop;
View Full Code Here


  }

  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

      FilePosition attrs = FilePosition.startOfFile(new InputSource(
          attrsFile.getAbsoluteFile().toURI()));

      MessageContext mc = new MessageContext();
      mc.addInputSource(elements.source());
      mc.addInputSource(attrs.source());
      MessageQueue mq = new EchoingMessageQueue(
          new PrintWriter(new OutputStreamWriter(System.err), true), mc, false);

      Set<File> inputsAndDeps = new HashSet<File>();
      for (File f : inputs) { inputsAndDeps.add(f.getAbsoluteFile()); }
View Full Code Here

      try {
        schema = new HtmlSchema(
            ConfigUtil.loadWhiteListFromJson(
                elements.source().getUri(), resolver, mq),
            ConfigUtil.loadWhiteListFromJson(
                attrs.source().getUri(), resolver, mq));
      } catch (ParseException ex) {
        ex.toMessageQueue(mq);
        throw (IOException) new IOException("Failed to parse schema")
            .initCause(ex);
      }
View Full Code Here

    }
    // Impose an order on output not dependent on hashing
    Collections.sort(stmts, new Comparator<Statement>() {
      public int compare(Statement a, Statement b) {
        FilePosition pa = a.getFilePosition(), pb = b.getFilePosition();
        int delta = pa.source().toString().compareTo(pb.source().toString());
        if (delta != 0) { return delta; }
        return pa.startCharInFile() - pb.startCharInFile();
      }
    });
    return Collections.unmodifiableSet(Sets.newLinkedHashSet(stmts));
View Full Code Here

      FilePosition fns = FilePosition.startOfFile(new InputSource(
          functionsFile.getAbsoluteFile().toURI()));

      MessageContext mc = new MessageContext();
      mc.addInputSource(sps.source());
      mc.addInputSource(fns.source());
      MessageQueue mq = new EchoingMessageQueue(
          new PrintWriter(new OutputStreamWriter(System.err), true), mc, false);

      Set<File> inputsAndDeps = Sets.newHashSet();
      for (File f : inputs) { inputsAndDeps.add(f.getAbsoluteFile()); }
View Full Code Here

      try {
        schema = new CssSchema(
            ConfigUtil.loadWhiteListFromJson(
                sps.source().getUri(), resolver, mq),
            ConfigUtil.loadWhiteListFromJson(
                fns.source().getUri(), resolver, mq));
      } catch (ParseException ex) {
        ex.toMessageQueue(mq);
        throw (IOException) new IOException("Failed to parse schema")
            .initCause(ex);
      }
View Full Code Here

      } else {
        // Implied ending.
        endPos = FilePosition.startOf(startTok.pos);
      }
      FilePosition startPos = Nodes.getFilePositionFor(node);
      if (startPos.source().equals(InputSource.UNKNOWN)) {
        Node first = node.getFirstChild();
        if (first != null) {
          startPos = Nodes.getFilePositionFor(first);
        }
      }
View Full Code Here

  /** Emit an inlined script. */
  private void fleshOutScriptBlock(ScriptBone bone) {
    FilePosition unk = FilePosition.UNKNOWN;

    FilePosition pos = bone.body.getFilePosition();
    String sourcePath = mc.abbreviate(pos.source());
    if (bone.source.fromCache) {
      CajoledModule scriptFromCache = (CajoledModule) bone.body;
      finishBlock();
      this.js.add(new SafeJsChunk(bone.source, scriptFromCache));
    } else {
View Full Code Here

      FilePosition attrs = FilePosition.startOfFile(new InputSource(
          attrsFile.getAbsoluteFile().toURI()));

      MessageContext mc = new MessageContext();
      mc.addInputSource(elements.source());
      mc.addInputSource(attrs.source());
      MessageQueue mq = new EchoingMessageQueue(
          new PrintWriter(new OutputStreamWriter(System.err), true), mc, false);

      Set<File> inputsAndDeps = new HashSet<File>();
      for (File f : inputs) { inputsAndDeps.add(f.getAbsoluteFile()); }
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.