Package org.rascalmpl.interpreter.staticErrors

Examples of org.rascalmpl.interpreter.staticErrors.SyntaxError


          .getParameters();
      params = new Type[formals.size()];
      int i = 0;
      for (org.rascalmpl.ast.Type formal : formals) {
        if (!formal.isVariable()) {
          throw new SyntaxError(
              "Declaration of parameterized type with type instance "
                  + formal + " is not allowed", formal.getLocation());
        }
        TypeVar var = formal.getTypeVar()
        Type bound = var.hasBound() ? var.getBound().typeOf(env, true, eval) : tf
View Full Code Here


        if (!argTypes[3].isSubtypeOf(intTuple)) {
          throw new UnexpectedType(intTuple, argTypes[3], ctx.getCurrentAST());
        }
      }
      else if (actuals.length != 2) {
        throw new SyntaxError("location constructor", ctx.getCurrentAST().getLocation());
      }
    }
    else {
      throw new SyntaxError("location constructor", ctx.getCurrentAST().getLocation());
    }
   

    int iLength = Integer.parseInt(actuals[1].toString());
    int iOffset = Integer.parseInt(actuals[0].toString());
View Full Code Here

   
    try {
      String RegExpAsString = interpolate(ctx);
      pat = Pattern.compile(RegExpAsString);
    } catch (PatternSyntaxException e){
      throw new SyntaxError(e.getMessage(), ctx.getCurrentAST().getLocation());
    }
  }
View Full Code Here

    }

    @Override
    public Result<IValue> interpret(IEvaluator<Result<IValue>> __eval) {

      throw new SyntaxError(
          "regular expression. They are only allowed in a pattern (left of <- and := or in a case statement).",
          this.getLocation());

    }
View Full Code Here

    public IMatchingResult buildMatcher(IEvaluatorContext eval) {
      String subjectPat = this.getString();
      List<InterpolationElement> resultRegExp = new LinkedList<InterpolationElement>();

      if (subjectPat.charAt(0) != '/') {
        throw new SyntaxError("Malformed Regular expression: "
            + subjectPat, this.getLocation());
      }

      int start = 1;
      int end = subjectPat.length() - 1;

      while (end > 0 && subjectPat.charAt(end) != '/') {
        end--;
      }
      String modifiers = subjectPat.substring(end + 1);

      if (subjectPat.charAt(end) != '/') {
        throw new SyntaxError("Regular expression does not end with /",
            this.getLocation());
      }

      if (modifiers.length() > 0) {
        resultRegExp.add(new StaticInterpolationElement("(?" + modifiers + ")"));
View Full Code Here

    }

    @Override
    public IBooleanResult buildBacktracker(IEvaluatorContext __eval) {

      throw new SyntaxError("expression", this.getLocation());

    }
View Full Code Here

          else if (lastPattern instanceof LiteralPattern || lastPattern instanceof TypedVariablePattern){
            start = 0;
            end = subjectString.length();
          }
          else {
            throw new SyntaxError("Illegal pattern " + lastPattern + " in string visit", eval.getCurrentAST().getLocation());
          }
         
          // Create replacementString when this is the first replacement
          if (replacementString == null) {
            replacementString = new StringBuffer();
View Full Code Here

      super(node, concrete);
    }
   
    @Override
    public Result<IValue> interpret(IEvaluator<Result<IValue>> eval) {
      throw new SyntaxError("concrete syntax fragment", (ISourceLocation) getAnnotations().get("parseError"));
    }
View Full Code Here

      throw new SyntaxError("concrete syntax fragment", (ISourceLocation) getAnnotations().get("parseError"));
    }
   
    @Override
    public IMatchingResult buildMatcher(IEvaluatorContext eval) {
      throw new SyntaxError("concrete syntax fragment", (ISourceLocation) getAnnotations().get("parseError"));
    }
View Full Code Here

TOP

Related Classes of org.rascalmpl.interpreter.staticErrors.SyntaxError

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.