Package java_cup.runtime

Examples of java_cup.runtime.Symbol


  private Symbol sym(int sym) {
    return new Symbol(sym);
  }

  private Symbol sym(int sym, Object val) {
    return new Symbol(sym, val);
  }
View Full Code Here


  private boolean zzEOFDone;

  /* user code: */

  private Symbol sym(int sym) {
    return new Symbol(sym);
  }
View Full Code Here

  private Symbol sym(int sym) {
    return new Symbol(sym);
  }

  private Symbol sym(int sym, Object val) {
    return new Symbol(sym, val);
  }
View Full Code Here

    }
  }

  private void outputSymbol(InputStream input) throws IOException {
    Lexer lexer = new Lexer(input);
    Symbol sym = null;
    while ((sym = lexer.next_token()).sym != Syms.EOF) {
      System.out.println(sym.sym);
    }
  }
View Full Code Here

    advance();
  }

      /* advance past the closer and build a return Symbol */
      advance(); advance();
      return new Symbol(sym.CODE_STRING, result.toString());
    }
View Full Code Here

      result_str = result.toString();
      keyword_num = (Integer)keywords.get(result_str);

      /* if we found something, return that keyword */
      if (keyword_num != null)
  return new Symbol(keyword_num.intValue());

      /* otherwise build and return an id Symbol with an attached string */
      return new Symbol(sym.ID, result_str);
    }
View Full Code Here

   *  routine, prints a message on System.out indicating what the Symbol is,
   *  then returns it.
   */
  public static Symbol debug_next_token() throws java.io.IOException
    {
      Symbol result = real_next_token();
      System.out.println("# next_Symbol() => " + result.sym);
      return result;
    }
View Full Code Here

    sym_num = find_single_char(next_char);
    if (sym_num != -1)
      {
        /* found one -- advance past it and return a Symbol for it */
        advance();
        return new Symbol(sym_num);
      }

    /* look for : or ::= */
    if (next_char == ':')
      {
        /* if we don't have a second ':' return COLON */
        if (next_char2 != ':')
    {
      advance();
      return new Symbol(sym.COLON);
    }

        /* move forward and look for the '=' */
        advance();
        if (next_char2 == '=')
    {
      advance(); advance();
      return new Symbol(sym.COLON_COLON_EQUALS);
    }
        else
    {
      /* return just the colon (already consumed) */
      return new Symbol(sym.COLON);
    }
      }

    /* find a "%prec" string and return it.  otherwise, a '%' was found,
       which has no right being in the specification otherwise */
    if (next_char == '%') {
      advance();
      if ((next_char == 'p') && (next_char2 == 'r') && (next_char3 == 'e') &&
    (next_char4 == 'c')) {
        advance();
        advance();
        advance();
        advance();
        return new Symbol(sym.PERCENT_PREC);
      } else {
        emit_error("Found extraneous percent sign");
      }
    }

    /* look for a comment */
    if (next_char == '/' && (next_char2 == '*' || next_char2 == '/'))
      {
        /* swallow then continue the scan */
        swallow_comment();
        continue;
      }

    /* look for start of code string */
    if (next_char == '{' && next_char2 == ':')
      return do_code_string();

    /* look for an id or keyword */
    if (id_start_char(next_char)) return do_id();

    /* look for EOF */
    if (next_char == EOF_CHAR) return new Symbol(sym.EOF);

    /* if we get here, we have an unrecognized character */
    emit_warn("Unrecognized character '" +
      new Character((char)next_char) + "'(" + next_char +
      ") -- ignored");
View Full Code Here

  /* user code: */
StringBuilder builder;

private Symbol symbol(int type) {
    return new Symbol(type, yyline, yycolumn);
}
View Full Code Here

private Symbol symbol(int type) {
    return new Symbol(type, yyline, yycolumn);
}

private Symbol symbol(int type, Object value) {
    return new Symbol(type, yyline, yycolumn, value);
}
View Full Code Here

TOP

Related Classes of java_cup.runtime.Symbol

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.