Package wyc.io.WhileyFileLexer

Examples of wyc.io.WhileyFileLexer.Token


   */
  private Expr.LVal parseLValTerm(WhileyFile wf, HashSet<String> environment) {
    checkNotEof();
    int start = index;
    // First, attempt to disambiguate the easy forms:
    Token lookahead = tokens.get(index);
    switch (lookahead.kind) {
    case Identifier:
      match(Identifier);
      return new Expr.AssignedVariable(lookahead.text, sourceAttr(start,
          index - 1));
View Full Code Here


  private Expr parseLogicalExpression(WhileyFile wf,
      HashSet<String> environment, boolean terminated) {
    checkNotEof();
    int start = index;
    Expr lhs = parseAndOrExpression(wf, environment, terminated);
    Token lookahead = tryAndMatch(terminated,  LogicalImplication, LogicalIff);
    if (lookahead != null) {
      switch (lookahead.kind) {

      case LogicalImplication: {
        Expr rhs = parseUnitExpression(wf, environment, terminated);
View Full Code Here

  private Expr parseAndOrExpression(WhileyFile wf,
      HashSet<String> environment, boolean terminated) {
    checkNotEof();
    int start = index;
    Expr lhs = parseBitwiseOrExpression(wf, environment, terminated);
    Token lookahead = tryAndMatch(terminated, LogicalAnd, LogicalOr);
    if (lookahead != null) {
      Expr.BOp bop;
      switch (lookahead.kind) {
      case LogicalAnd:
        bop = Expr.BOp.AND;
View Full Code Here

   * @return
   */
  private Expr parseConditionExpression(WhileyFile wf,
      HashSet<String> environment, boolean terminated) {
    int start = index;
    Token lookahead;

    // First, attempt to parse quantifiers (e.g. some, all, no, etc)
    if ((lookahead = tryAndMatch(terminated, Some, No, All)) != null) {
      return parseQuantifierExpression(lookahead, wf, environment,
          terminated);
View Full Code Here

    do {
      if (!firstTime) {
        match(Comma);
      }
      firstTime = false;
      Token id = match(Identifier);
      if (environment.contains(id.text)) {
        // It is already defined which is a syntax error
        syntaxError("variable already declared", id);
      }
      match(In);
View Full Code Here

  private Expr parseShiftExpression(WhileyFile wf,
      HashSet<String> environment, boolean terminated) {
    int start = index;
    Expr lhs = parseAdditiveExpression(wf, environment, terminated);

    Token lookahead;
    while ((lookahead = tryAndMatch(terminated, LeftAngleLeftAngle,
        RightAngleRightAngle)) != null) {
      Expr rhs = parseAdditiveExpression(wf, environment, terminated);
      Expr.BOp bop = null;
      switch (lookahead.kind) {
View Full Code Here

  private Expr parseAdditiveExpression(WhileyFile wf,
      HashSet<String> environment, boolean terminated) {
    int start = index;
    Expr lhs = parseMultiplicativeExpression(wf, environment, terminated);

    Token lookahead;
    while ((lookahead = tryAndMatch(terminated, Plus, Minus)) != null) {
      Expr.BOp bop;
      switch (lookahead.kind) {
      case Plus:
        bop = Expr.BOp.ADD;
View Full Code Here

  private Expr parseMultiplicativeExpression(WhileyFile wf,
      HashSet<String> environment, boolean terminated) {
    int start = index;
    Expr lhs = parseAccessExpression(wf, environment, terminated);

    Token lookahead = tryAndMatch(terminated, Star, RightSlash, Percent);
    if (lookahead != null) {
      Expr.BOp bop;
      switch (lookahead.kind) {
      case Star:
        bop = Expr.BOp.MUL;
View Full Code Here

   */
  private Expr parseAccessExpression(WhileyFile wf,
      HashSet<String> environment, boolean terminated) {
    int start = index;
    Expr lhs = parseTermExpression(wf, environment, terminated);
    Token token;

    while ((token = tryAndMatchOnLine(LeftSquare)) != null
        || (token = tryAndMatch(terminated, Dot, MinusGreater)) != null) {
      switch (token.kind) {
      case LeftSquare:
View Full Code Here

  private Expr parseTermExpression(WhileyFile wf,
      HashSet<String> environment, boolean terminated) {
    checkNotEof();

    int start = index;
    Token token = tokens.get(index);

    switch (token.kind) {
    case LeftBrace:
      return parseBracketedExpression(wf, environment, terminated);
    case New:
View Full Code Here

TOP

Related Classes of wyc.io.WhileyFileLexer.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.