Package org.eclipse.dltk.compiler.problem

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


    }
  }

  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

  }

  public boolean visit(ArrayVariableReference s) throws Exception {
    if (isURLParemeterVariable(s) && !hasSafeCallInParent) {
      context.getProblemReporter().reportProblem(
        new DefaultProblem(
          context.getFile().getName(),
          "Unsafe use of " + s.getName() + ": possible XSS attack",
          IProblem.Unclassified,
          new String[0],
          ProblemSeverities.Warning,
View Full Code Here

    return program.getErrors();
  }

  protected void reportError(IProblemReporter problemReporter,
      String fileName, int start, int end, int lineNumber, String message) {
    DefaultProblem problem = new DefaultProblem(fileName, message,
        IProblem.Syntax, new String[0], ProblemSeverities.Error, start,
        end, lineNumber);
    problemReporter.reportProblem(problem);
  }
View Full Code Here

    int end = start+e.token.getText().length();
   
    // retrieve severity from preferences
    ProblemSeverity severity = SymfonyCorePreferences.getAnnotationSeverity();
   
    IProblem problem = new DefaultProblem(filename, message, IProblem.Syntax,
        new String[0], severity, start+1, end+1, lineNo);
   
   
    context.getProblemReporter().reportProblem(problem);
View Full Code Here

            */
            //IProblem newProblem = new DefaultProblem(filename, message, DefaultProblemIdentifier.NULL, new String[0], ProblemSeverities.Error, start+1, end+1, lineNo, start);

            ProblemSeverity severity = SymfonyCorePreferences.getAnnotationSeverity();

            IProblem problem = new DefaultProblem(filename, message, IProblem.ImportRelated,
                    new String[0], severity, sourcePosition.startOffset + 1, sourcePosition.endOffset + 1, lineNo);

            context.getProblemReporter().reportProblem(problem);
        }
    }
View Full Code Here

        ProblemSeverity severity = TwigCorePreferences.getSyntaxErrorSeverity();

        if (severity == null || severity == ProblemSeverity.IGNORE)
            return;

        IProblem problem = new DefaultProblem(filename, message,
                IProblem.Syntax, new String[0], severity, offset, offset + 1,
                line);

        reporter.reportProblem(problem);
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.