Package com.google.gxp.compiler.alerts

Examples of com.google.gxp.compiler.alerts.SourcePosition


*/
public class IOError extends ErrorAlert {
  private final IOException exception;

  public IOError(FileRef source, IOException exception) {
    this(new SourcePosition(source), exception);
  }
View Full Code Here


      // will always be one more text segment than non-text value.
      List<String> textSegments = Lists.newArrayList();
      List<SourcePosition> textPositions = Lists.newArrayList();
      List<Expression> nonTextValues = Lists.newArrayList();
      {
        SourcePosition sbPos = null;
        for (Expression value : values) {
          if (value instanceof StringConstant) {
            StringConstant stringConstant = (StringConstant) value;
            sb.append(stringConstant.evaluate());
            if (sbPos == null) {
View Full Code Here

    line++;
    int column = 1;
    for (Node node : children) {
      column = Math.max(column, node.getSourcePosition().getColumn() + 1);
    }
    return new SourcePosition(filename, line, column);
  }
View Full Code Here

  /**
   * Creates a parse tree.
   */
  private IfExpandedTree tree(ParsedElement... children) {
    return new IfExpandedTree(new SourcePosition(filename),
                              parseAlerts.buildAndClear(), list(children));
  }
View Full Code Here

    ReparentedTree output = reparent(input);
    assertTrue(output.getRoot() instanceof NullRoot);
  }

  public void testWithAlerts() throws Exception {
    Alert parseWarning = new WarningAlert(new SourcePosition("baz", 1, 2),
                                          "test warning"){};
    parseAlerts.add(parseWarning);
    expectedAlerts.add(parseWarning);

    ReparentedTree output = reparent(tree());
View Full Code Here

        xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);

        xmlReader.parse(inputSource);
      } catch (SAXException saxException) {
        if (!saxEventAdapter.getExceptionMessages().contains(saxException.getMessage())) {
          eventHandler.add(new SaxAlert(new SourcePosition(input),
                                        Severity.ERROR, saxException));
        }
      }
    } finally {
      inputStream.close();
View Full Code Here

     */
    private SourcePosition getSourcePosition() {
      // Lines and columns start at 1. A value of 0 means we don't know, so in
      // that case just use the whole file as the position.
      if ((lineNumber > 0) && (columnNumber > 0)) {
        return new SourcePosition(input, lineNumber, columnNumber);
      } else {
        return new SourcePosition(input);
      }
    }
View Full Code Here

    } catch (UnsupportedExternalEntityException e) {
      alertSetBuilder.add(new UnsupportedExternalEntityError(
                              e.getSourcePosition(), e.getEntity()));
    }

    return new ParseTree(new SourcePosition(input), alertSetBuilder.buildAndClear(),
                         eventHandler.getParsedRoots());
  }
View Full Code Here

    for (String legalExpr : LEGAL_EXPRESSIONS) {
      compile(prefix + CharEscapers.xmlEscaper().escape(legalExpr) + suffix);
      assertNoUnexpectedAlerts();
    }

    SourcePosition errorPos = pos(errorLine, errorColumn);

    for (IllegalOperatorExpression illegalOp : ILLEGAL_OPERATORS) {
      compile(prefix + CharEscapers.xmlEscaper().escape(illegalOp.getExpression()) + suffix);
      for (OutputLanguage outputLanguage : illegalOp.getOutputLanguages()) {
        assertAlert(new IllegalOperatorError(errorPos, outputLanguage.getDisplay(),
View Full Code Here

      assertNoUnexpectedAlerts();
    }

    for (String illegalName : ILLEGAL_VAR_NAMES) {
      compile(prefix + CharEscapers.xmlEscaper().escape(illegalName) + suffix);
      SourcePosition errorPos = pos(2, 1);
      assertAlert(new IllegalVariableNameError(errorPos, illegalName));
      assertNoUnexpectedAlerts();
    }

    for (Map.Entry<String, Collection<OutputLanguage>> illegalName :
             ILLEGAL_OUTPUT_LANGUAGE_NAMES.entrySet()) {
      compile(prefix + CharEscapers.xmlEscaper().escape(illegalName.getKey()) + suffix);
      SourcePosition errorPos = pos(2, 1);
      for (OutputLanguage outputLanguage : illegalName.getValue()) {
        assertAlert(new IllegalNameError(errorPos, outputLanguage.getDisplay(),
                                         illegalName.getKey()));
      }
      assertNoUnexpectedAlerts();
View Full Code Here

TOP

Related Classes of com.google.gxp.compiler.alerts.SourcePosition

Copyright © 2018 www.massapicom. 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.