Package wycs.io.WyalFileLexer

Examples of wycs.io.WyalFileLexer.Token


    }
    return (byte) val;
  }

  private Attribute.Source sourceAttr(int start, int end) {
    Token t1 = tokens.get(start);
    Token t2 = tokens.get(end);
    // FIXME: problem here with the line numbering ?
    return new Attribute.Source(t1.start, t2.end(), 0);
  }
View Full Code Here


        filename.length() - 7);
    WyalFile wf = new WyalFile(pkg.append(name), filename);

    skipWhiteSpace();
    while (index < tokens.size()) {
      Token lookahead = tokens.get(index);
      if (lookahead.kind == Import) {
        parseImportDeclaration(wf);
      } else {
        checkNotEof();
        lookahead = tokens.get(index);
View Full Code Here

    int start = index;

    match(Import);

    // First, parse "from" usage (if applicable)
    Token token = tryAndMatch(true, Identifier, Star);
    if (token == null) {
      syntaxError("expected identifier or '*' here", token);
    }
    String name = token.text;
    // NOTE: we don't specify "from" as a keyword because this prevents it
    // from being used as a variable identifier.
    Token lookahead;
    if ((lookahead = tryAndMatchOnLine(Identifier)) != null) {
      // Ok, this must be "from"
      if (!lookahead.text.equals("from")) {
        syntaxError("expected \"from\" here", lookahead);
      }
View Full Code Here

    ArrayList<Expr> requires = new ArrayList<Expr>();
    Expr ensures = null;
    // FIXME: following should be a list!
    SyntacticType throwws = new SyntacticType.Void();

    Token lookahead;
    while ((lookahead = tryAndMatch(true, Requires, Ensures, Throws)) != null) {
      switch (lookahead.kind) {
      case Requires: {
        Expr condition;
        if (tryAndMatch(true, Colon) != null) {
View Full Code Here

      while (eventuallyMatch(RightAngle) == null) {
        if (!firstTime) {
          match(Comma);
        }
        firstTime = false;
        Token id = match(Identifier);
        String generic = id.text;
        if (generics.contains(generic)) {
          syntaxError("duplicate generic variable", id);
        }
        generics.add(generic);
View Full Code Here

  protected void parseAssumeDeclaration(WyalFile wf) {
    int start = index;
    match(Assume);

    // Attempt to parse the message
    Token token = tryAndMatch(true, String);
    String msg = token == null ? null : token.text;

    // Determine whether block or expression
    HashSet<String> generics = new HashSet<String>();
    HashSet<String> environment = new HashSet<String>();
View Full Code Here

  protected void parseAssertDeclaration(WyalFile wf) {
    int start = index;
    match(Assert);

    // Attempt to parse the message
    Token token = tryAndMatch(true, StringValue);
    String msg = token == null ? null : token.text;

    // Determine whether block or expression
    HashSet<String> generics = new HashSet<String>();
    HashSet<String> environment = new HashSet<String>();
View Full Code Here

   * @return
   */
  private Indent getIndent() {
    skipEmptyLines();
    if (index < tokens.size()) {
      Token token = tokens.get(index);
      if (token.kind == Indent) {
        return new Indent(token.text, token.start);
      }
      return null;
    }
View Full Code Here

  private Expr parseStatement(WyalFile wf, HashSet<String> generics,
      HashSet<String> environment, Indent indent) {
    int start = index;
    checkNotEof();

    Token lookahead = tryAndMatch(false, If, Case, Exists, Forall);

    if (lookahead != null && lookahead.kind == If) {
      return parseIfThenStatement(wf, generics, environment, indent);
    } else if (lookahead != null && lookahead.kind == Case) {
      return parseCaseStatement(wf, generics, environment, indent);
View Full Code Here

      HashSet<String> environment, Indent indent) {
    int start = index;

    Expr condition = null;
    Indent nextIndent;
    Token lookahead;

    do {
      match(Colon);
      matchEndLine();
      Expr term = parseBlock(wf, generics, environment, indent);
View Full Code Here

TOP

Related Classes of wycs.io.WyalFileLexer.Token

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.