Package org.eclipse.dltk.compiler.problem

Examples of org.eclipse.dltk.compiler.problem.DefaultProblem


          ISourceModule module, String message, String pkgName) {
    final CodeModel model = getCodeModel(module);
    if (model == null) {
      return;
    }
    reporter.reportProblem(new DefaultProblem(message, RutaProblems.UNKNOWN_REQUIRED_PACKAGE,
            new String[] { pkgName }, ProblemSeverities.Error, pkg.sourceStart(), pkg.sourceEnd(),
            model.getLineNumber(pkg.sourceStart(), pkg.sourceEnd())));
  }
View Full Code Here


        messages[0] = re.toString();
      }
      DLTKToken convert = this.converter.convert(re.token);
      // reporter.handle(CompilerOptions.OFFSET, messages, messages,
      // st, et);
      DefaultProblem defaultProblem = new DefaultProblem("", messages[0], 0, new String[] {},
              ProblemSeverities.Error, st, et, re.token.getLine());
      if (!problems.contains(defaultProblem)) {
        reporter.reportProblem(defaultProblem);
        problems.add(defaultProblem);
        System.out.println(messages[0] + " ### line " + re.token.getLine());
View Full Code Here

    String msg = errorPrefix + m + " : " + tokenText;
    reportProblem(line, msg, st, et);
  }

  private void reportProblem(int line, String msg, int st, int et) {
    DefaultProblem defaultProblem = createDefaultProblem(msg, st, et, line);
    if (!problems.contains(defaultProblem)) {
      reporter.reportProblem(defaultProblem);
      problems.add(defaultProblem);
    }
  }
View Full Code Here

    }
  }

  private DefaultProblem createDefaultProblem(String m, int st, int et, int line) {
    // TODO handle filename
    return new DefaultProblem("", m, 0, new String[] {}, ProblemSeverities.Error, st, et, line);
  }
View Full Code Here

      int st = converter.convert(ec.token.getLine(), ec.token.getCharPositionInLine());
      String sm = ec.token.getText();
      int et = st + ec.token.getText().length();
      if (st == -1)
        return;
      DefaultProblem defaultProblem = new DefaultProblem("", messages[0], 0, new String[] {},
              ProblemSeverities.Error, st, et, ec.token.getLine());
      if (!problems.contains(defaultProblem)) {
        reporter.reportProblem(defaultProblem);
        problems.add(defaultProblem);
        System.out.println(messages[0] + " ### line " + ec.token.getLine());
      }
    } else if (re instanceof MismatchedTokenException) {
      MismatchedTokenException ec = (MismatchedTokenException) re;
      if (message == null || ec.token.getText() == null) {
        m = ec.toString();
      } else {
        m = "mismatched input: " + message + " : " + ec.token.getText();
      }
      // if (message == null) {
      // message = "mismatched input "
      // + this.parser.getTokenErrorDisplay(ec.token);
      // // return;
      // }
      String[] messages = { m }; // "Syntax Error:" + message, message,
      // ec.token.getText() };
      // this.converter.convert(ec.token).getColumn() - 1;
      // String sm = ec.token.getText();
      // st + ((sm != null) ? sm.length() : 1);
      // TODO martin: "rewrite converter"
      int st = converter.convert(ec.token.getLine(), ec.token.getCharPositionInLine());
      // String sm = ec.token.getText();
      int et = st;
      if (ec.token.getText() != null) {
        et = ec.token.getText().length() + st;
        if (et >= this.converter.length()) {
          et = this.converter.length() - 1;
          st -= 2;
        }
      } else {
        st = ((CommonToken) token).getStartIndex();
        et = ((CommonToken) token).getStopIndex();
      }
      // reporter.handle(CompilerOptions.OFFSET, messages, messages,
      // st, et);
      DefaultProblem defaultProblem = new DefaultProblem("", messages[0], 0, new String[] {},
              ProblemSeverities.Error, st, et, ec.line);
      if (!problems.contains(defaultProblem)) {
        reporter.reportProblem(defaultProblem);
        problems.add(defaultProblem);
        System.out.println(messages[0] + " ### line " + ec.line);
      }
    } else if (re instanceof FailedPredicateException) {
      String[] messages = { "Syntax Error:" + message, message };
      if (message == null) {
        messages[0] = re.toString();
      }
      DLTKToken convert = this.converter.convert(re.token);
      int st = convert.getColumn();
      int et = convert.getColumn() + convert.getText().length();
      // reporter.handle(CompilerOptions.OFFSET, messages, messages,
      // st, et);
      DefaultProblem defaultProblem = new DefaultProblem("", "Type not defined in this script: "
              + convert.getText(), 0, new String[] {}, ProblemSeverities.Warning, st, et,
              re.token.getLine());
      if (!problems.contains(defaultProblem)) {
        reporter.reportProblem(defaultProblem);
        problems.add(defaultProblem);
        System.out.println(messages[0] + " ### line " + re.token.getLine());
      }
    } else {
      String[] messages = { "Syntax Error:" + message, message };
      if (message == null) {
        messages[0] = re.toString();
      }
      DLTKToken convert = this.converter.convert(re.token);
      int st = convert.getColumn();
      int et = convert.getColumn() + convert.getText().length();
      // reporter.handle(CompilerOptions.OFFSET, messages, messages,
      // st, et);
      DefaultProblem defaultProblem = new DefaultProblem("", messages[0], 0, new String[] {},
              ProblemSeverities.Error, st, et, re.token.getLine());
      if (!problems.contains(defaultProblem)) {
        reporter.reportProblem(defaultProblem);
        problems.add(defaultProblem);
        System.out.println(messages[0] + " ### line " + re.token.getLine());
View Full Code Here

    return null; // Use default
  }
 
  protected void handleCompletionFailure(String errorMessage, final int position) {
    requestor.completionFailure(
      new DefaultProblem(errorMessage, null, null, ProblemSeverity.ERROR, position, position, 0));
  }
View Full Code Here

  protected static void reportErrors(IProblemReporter reporter, ParsedModule parsedModule) {
    if(reporter == null || parsedModule == null) {
      return;
    }
    for (ParserError parserError : parsedModule.errors) {
      reporter.reportProblem(new DefaultProblem(
        parserError.getUserMessage(),
        DefaultProblemIdentifier.decode(org.eclipse.dltk.compiler.problem.IProblem.Syntax),
        NOSTRINGS,
        ProblemSeverities.Error,
        parserError.getStartPos(),
View Full Code Here

          ISourceModule module, String message, String pkgName) {
    final CodeModel model = getCodeModel(module);
    if (model == null) {
      return;
    }
    reporter.reportProblem(new DefaultProblem(message, RutaProblems.UNKNOWN_REQUIRED_PACKAGE,
            new String[] { pkgName }, ProblemSeverities.Error, pkg.sourceStart(), pkg.sourceEnd(),
            model.getLineNumber(pkg.sourceStart(), pkg.sourceEnd())));
  }
View Full Code Here

        messages[0] = re.toString();
      }
      DLTKToken convert = this.converter.convert(re.token);
      // reporter.handle(CompilerOptions.OFFSET, messages, messages,
      // st, et);
      DefaultProblem defaultProblem = new DefaultProblem("", messages[0], 0, new String[] {},
              ProblemSeverities.Error, st, et, re.token.getLine());
      if (!problems.contains(defaultProblem)) {
        reporter.reportProblem(defaultProblem);
        problems.add(defaultProblem);
        System.out.println(messages[0] + " ### line " + re.token.getLine());
View Full Code Here

    String msg = errorPrefix + m + " : " + tokenText;
    reportProblem(line, msg, st, et);
  }

  private void reportProblem(int line, String msg, int st, int et) {
    DefaultProblem defaultProblem = createDefaultProblem(msg, st, et, line);
    if (!problems.contains(defaultProblem)) {
      reporter.reportProblem(defaultProblem);
      problems.add(defaultProblem);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.compiler.problem.DefaultProblem

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.