Package com.google.gwt.dev.js.JsParserException

Examples of com.google.gwt.dev.js.JsParserException.SourceDetail


          moduleURL.toExternalForm()), jsPgm.getScope(), r);
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Error reading script source", e);
      throw new UnableToCompleteException();
    } catch (JsParserException e) {
      SourceDetail dtl = e.getSourceDetail();
      if (dtl != null) {
        StringBuffer sb = new StringBuffer();
        sb.append(moduleURL.toExternalForm());
        sb.append("(");
        sb.append(dtl.getLine());
        sb.append(", ");
        sb.append(dtl.getLineOffset());
        sb.append("): ");
        sb.append(e.getMessage());
        logger.log(TreeLogger.ERROR, sb.toString(), e);
      } else {
        logger.log(TreeLogger.ERROR, "Error parsing JavaScript source", e);
View Full Code Here


      return (JsFunction) ((JsExprStmt) stmts.get(0)).getExpression();
    } catch (IOException e) {
      // Should never happen.
      throw new RuntimeException(e);
    } catch (JsParserException e) {
      SourceDetail dtl = e.getSourceDetail();
      if (dtl != null) {
        StringBuilder sb = new StringBuilder();
        sb.append(location);
        sb.append("(");
        sb.append(dtl.getLine());
        sb.append(", ");
        sb.append(dtl.getLineOffset());
        sb.append("): ");
        sb.append(e.getMessage());
        logger.log(TreeLogger.ERROR, sb.toString(), e);
        return null;
      } else {
View Full Code Here

          moduleURL.toExternalForm()), jsPgm.getScope(), r);
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Error reading script source", e);
      throw new UnableToCompleteException();
    } catch (JsParserException e) {
      SourceDetail dtl = e.getSourceDetail();
      if (dtl != null) {
        StringBuffer sb = new StringBuffer();
        sb.append(moduleURL.toExternalForm());
        sb.append("(");
        sb.append(dtl.getLine());
        sb.append(", ");
        sb.append(dtl.getLineOffset());
        sb.append("): ");
        sb.append(e.getMessage());
        logger.log(TreeLogger.ERROR, sb.toString(), e);
      } else {
        logger.log(TreeLogger.ERROR, "Error parsing JavaScript source", e);
View Full Code Here

          } catch (JsParserException e) {
            /*
             * count the number of characters to the problem (from the start of
             * the JSNI code)
             */
            SourceDetail detail = e.getSourceDetail();
            int line = detail.getLine();
            char[] chars = jsniCode.toCharArray();
            int i = 0, n = chars.length;
            while (line > 0) {
              // CHECKSTYLE_OFF
              switch (chars[i]) {
                case '\r':
                  // if skip an extra character if this is a CR/LF
                  if (i + 1 < n && chars[i + 1] == '\n') {
                    ++i;
                  }
                  // intentional fall-through
                case '\n':
                  --line;
                  // intentional fall-through
                default:
                  ++i;
              }
              // CHECKSTYLE_ON
            }

            // TODO: check this
            // Map into the original source stream;
            i += startPos + detail.getLineOffset();
            info = new SourceInfo(i, i,
                info.getStartLine() + detail.getLine(), info.getFileName());
            GenerateJavaAST.reportJsniError(info, methodDeclaration,
                e.getMessage());
          }
        }

View Full Code Here

      stmts = jsParser.parse(jsPgm.getScope(), r, startLineNumber);
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Error reading script source", e);
      throw new UnableToCompleteException();
    } catch (JsParserException e) {
      SourceDetail dtl = e.getSourceDetail();
      if (dtl != null) {
        StringBuffer sb = new StringBuffer();
        sb.append(moduleURL.toExternalForm());
        sb.append("(");
        sb.append(dtl.getLine());
        sb.append(", ");
        sb.append(dtl.getLineOffset());
        sb.append("): ");
        sb.append(e.getMessage());
        logger.log(TreeLogger.ERROR, sb.toString(), e);
      } else {
        logger.log(TreeLogger.ERROR, "Error parsing JavaScript source", e);
View Full Code Here

      return (JsFunction) ((JsExprStmt) stmts.get(0)).getExpression();
    } catch (IOException e) {
      // Should never happen.
      throw new RuntimeException(e);
    } catch (JsParserException e) {
      SourceDetail dtl = e.getSourceDetail();
      if (dtl != null) {
        StringBuilder sb = new StringBuilder();
        sb.append(location);
        sb.append("(");
        sb.append(dtl.getLine());
        sb.append(", ");
        sb.append(dtl.getLineOffset());
        sb.append("): ");
        sb.append(e.getMessage());
        logger.log(TreeLogger.ERROR, sb.toString(), e);
        return null;
      } else {
View Full Code Here

      } catch (JsParserException e) {
        /*
         * count the number of characters to the problem (from the start of the
         * JSNI code)
         */
        SourceDetail detail = e.getSourceDetail();
        int line = detail.getLine();
        char[] chars = jsniCode.toCharArray();
        int i = 0, n = chars.length;
        while (line > 0) {
          // CHECKSTYLE_OFF
          switch (chars[i]) {
            case '\r':
              // if skip an extra character if this is a CR/LF
              if (i + 1 < n && chars[i + 1] == '\n') {
                ++i;
              }
              // intentional fall-through
            case '\n':
              --line;
              // intentional fall-through
            default:
              ++i;
          }
          // CHECKSTYLE_ON
        }

        // TODO: check this
        // Map into the original source stream;
        i += startPos + detail.getLineOffset();
        info = new SourceInfo(i, i, info.getStartLine() + detail.getLine(),
            info.getFileName());
        GenerateJavaAST.reportJsniError(info, methodDeclaration, e.getMessage());
      }
    }
View Full Code Here

          moduleURL.toExternalForm()), jsPgm.getScope(), r);
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Error reading script source", e);
      throw new UnableToCompleteException();
    } catch (JsParserException e) {
      SourceDetail dtl = e.getSourceDetail();
      if (dtl != null) {
        StringBuffer sb = new StringBuffer();
        sb.append(moduleURL.toExternalForm());
        sb.append("(");
        sb.append(dtl.getLine());
        sb.append(", ");
        sb.append(dtl.getLineOffset());
        sb.append("): ");
        sb.append(e.getMessage());
        logger.log(TreeLogger.ERROR, sb.toString(), e);
      } else {
        logger.log(TreeLogger.ERROR, "Error parsing JavaScript source", e);
View Full Code Here

      stmts = jsParser.parse(jsPgm.getScope(), r, startLineNumber);
    } catch (IOException e) {
      logger.log(TreeLogger.ERROR, "Error reading script source", e);
      throw new UnableToCompleteException();
    } catch (JsParserException e) {
      SourceDetail dtl = e.getSourceDetail();
      if (dtl != null) {
        StringBuffer sb = new StringBuffer();
        sb.append(moduleURL.toExternalForm());
        sb.append("(");
        sb.append(dtl.getLine());
        sb.append(", ");
        sb.append(dtl.getLineOffset());
        sb.append("): ");
        sb.append(e.getMessage());
        logger.log(TreeLogger.ERROR, sb.toString(), e);
      } else {
        logger.log(TreeLogger.ERROR, "Error parsing JavaScript source", e);
View Full Code Here

      return (JsFunction) ((JsExprStmt) stmts.get(0)).getExpression();
    } catch (IOException e) {
      // Should never happen.
      throw new RuntimeException(e);
    } catch (JsParserException e) {
      SourceDetail dtl = e.getSourceDetail();
      if (dtl != null) {
        StringBuilder sb = new StringBuilder();
        sb.append(location);
        sb.append("(");
        sb.append(dtl.getLine());
        sb.append(", ");
        sb.append(dtl.getLineOffset());
        sb.append("): ");
        sb.append(e.getMessage());
        logger.log(TreeLogger.ERROR, sb.toString(), e);
        return null;
      } else {
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.js.JsParserException.SourceDetail

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.