Examples of FilePosition


Examples of com.google.caja.lexer.FilePosition

      default:
        break;
    }
    Object v = toLiteralValue(operand);
    if (v != null) {
      FilePosition pos = getFilePosition();
      switch (getOperator()) {
        case NEGATION:
          if (v instanceof Number) {
            if (operand instanceof IntegerLiteral) {
              long n = ((IntegerLiteral) operand).getValue().longValue();
View Full Code Here

Examples of com.google.caja.lexer.FilePosition

      if (left.simplifyForSideEffect() == null) { return right; }
    }
    Object lhs = toLiteralValue(left);
    Object rhs = toLiteralValue(right);
    if (lhs != null && rhs != null) {
      FilePosition pos = getFilePosition();
      switch (op) {
        case EQUAL: case STRICTLY_EQUAL:
        case NOT_EQUAL: case STRICTLY_NOT_EQUAL:
          boolean isStrict =  op == Operator.STRICTLY_EQUAL
              || op == Operator.STRICTLY_NOT_EQUAL;
View Full Code Here

Examples of com.google.collide.dto.FilePosition

   *
   * @param reference reference to migrate
   * @return migrated reference or {@code null} if reference cannot be migrated
   */
  private CodeReference migrateCubeReference(CodeReference reference) {
    FilePosition oldStartPosition = reference.getReferenceStart();
    FilePosition oldEndPosition = reference.getReferenceEnd();
    LineNumberAndColumn newStartPosition = positionMigrator.migrateToNow(
        oldStartPosition.getLineNumber(), oldStartPosition.getColumn());
    LineNumberAndColumn newEndPosition = positionMigrator.migrateToNow(
        oldEndPosition.getLineNumber(), oldEndPosition.getColumn());
    int newLength = newEndPosition.column - newStartPosition.column;
    int oldLength = oldEndPosition.getColumn() - oldStartPosition.getColumn();
    if (newStartPosition.lineNumber != newEndPosition.lineNumber
        || newLength != oldLength || newLength < 0) {
      // TODO: Make the method return null if text has changed inside the reference.
      return null;
    }
View Full Code Here

Examples of com.google.debugging.sourcemap.FilePosition

    // them zero based.
    int lineBaseOffset = 1;

    generator.addMapping(
        sourceFile, originalName,
        new FilePosition(node.getLineno() - lineBaseOffset, node.getCharno()),
        outputStartPosition, outputEndPosition);
  }
View Full Code Here

Examples of com.google.debugging.sourcemap.FilePosition

  private String normalize(String path) {
    return path.replace("/", File.separator);
  }

  public void testInputSourceMaps() throws Exception {
    FilePosition originalSourcePosition = new FilePosition(17, 25);
    ImmutableMap<String, SourceMapInput> inputSourceMaps = ImmutableMap.of(
        normalize("generated_js/example.js"),
        sourcemap(
            normalize("generated_js/example.srcmap"),
            normalize("../original/source.html"),
View Full Code Here

Examples of com.google.debugging.sourcemap.FilePosition

  private SourceMapInput sourcemap(String sourceMapPath, String originalSource,
      FilePosition originalSourcePosition) throws Exception {
    SourceMapGeneratorV3 sourceMap = new SourceMapGeneratorV3();
    sourceMap.addMapping(originalSource, null, originalSourcePosition,
        new FilePosition(1, 1), new FilePosition(100, 1));
    StringBuilder output = new StringBuilder();
    sourceMap.appendTo(output, "unused.js");

    return new SourceMapInput(
        SourceFile.fromCode(sourceMapPath, output.toString()));
View Full Code Here

Examples of com.google.debugging.sourcemap.FilePosition

    assertEquals("[testcode]", msg.getSourceName());
  }

  public void testJsMessagesWithSrcMap() throws Exception {
    SourceMapGeneratorV3 sourceMap = new SourceMapGeneratorV3();
    sourceMap.addMapping("source1.html", null, new FilePosition(10, 0),
        new FilePosition(0, 0), new FilePosition(0, 100));
    sourceMap.addMapping("source2.html", null, new FilePosition(10, 0),
        new FilePosition(1, 0), new FilePosition(1, 100));
    StringBuilder output = new StringBuilder();
    sourceMap.appendTo(output, "unused.js");

    compilerOptions = new CompilerOptions();
    compilerOptions.inputSourceMaps = ImmutableMap.of(
View Full Code Here

Examples of com.google.debugging.sourcemap.FilePosition

        int line = getCurrentLineIndex();
        int index = getCurrentCharIndex();
        Preconditions.checkState(line >= 0);
        Mapping mapping = new Mapping();
        mapping.node = node;
        mapping.start = new FilePosition(line, index);
        mappings.push(mapping);
        allMappings.add(mapping);
      }
    }
View Full Code Here

Examples of com.google.debugging.sourcemap.FilePosition

      if (createSrcMap && !mappings.isEmpty() && mappings.peek().node == node) {
        Mapping mapping = mappings.pop();
        int line = getCurrentLineIndex();
        int index = getCurrentCharIndex();
        Preconditions.checkState(line >= 0);
        mapping.end = new FilePosition(line, index);
      }
    }
View Full Code Here

Examples of com.google.debugging.sourcemap.FilePosition

      int originalChar = position.getColumn();
      if (insertion) {
        if (originalLine == lineIndex && originalChar >= characterPosition) {
          // If the position falls on the line itself, then normalize it
          // if it falls at or after the place the newline was inserted.
          return new FilePosition(
              originalLine + 1, originalChar - characterPosition);
        } else {
          return position;
        }
      } else {
        if (originalLine == lineIndex) {
          return new FilePosition(
              originalLine - 1, originalChar + characterPosition);
        } else if (originalLine > lineIndex) {
            // Not supported, can only undo a cut on the most recent line. To
            // do this on a previous lines would require reevaluating the cut
            // positions on all subsequent lines.
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.