Package CSharpProcessor.Lexer

Examples of CSharpProcessor.Lexer.LapgSymbol


    lapg_m = new LapgSymbol[1024];
    lapg_head = 0;
    int lapg_symbols_ok = 4;

    lapg_m[0] = new LapgSymbol();
    lapg_m[0].state = 0;
    lapg_n = lexer.next();

    while( lapg_m[lapg_head].state != 730 ) {
      int lapg_i = lapg_next( lapg_m[lapg_head].state, lapg_n.lexem );

      if( lapg_i >= 0 ) {
        reduce(lapg_i);
      } else if( lapg_i == -1 ) {
        shift(lexer);
        lapg_symbols_ok++;
      }

      if( lapg_i == -2 || lapg_m[lapg_head].state == -1 ) {
        if (lapg_n.lexem == 0) {
          break;
        }
        while (lapg_head >= 0 && lapg_state_sym( lapg_m[lapg_head].state, 2 ) == -1) {
          lapg_m[lapg_head] = null; // TODO dispose?
          lapg_head--;
        }
        if (lapg_head >= 0) {
          lapg_m[++lapg_head] = new LapgSymbol();
          lapg_m[lapg_head].lexem = 2;
          lapg_m[lapg_head].sym = null;
          lapg_m[lapg_head].state = lapg_state_sym( lapg_m[lapg_head-1].state, 2 );
          lapg_m[lapg_head].pos = lapg_n.pos; // TODO endpos?
          if( lapg_symbols_ok >= 4 ) {
            error( MessageFormat.format( "syntax error before line {0}", lapg_n.pos.line ) );
          }
          if( lapg_symbols_ok <= 1 ) {
            lapg_n = lexer.next();
          }
          lapg_symbols_ok = 0;
          continue;
        } else {
          lapg_head = 0;
          lapg_m[0] = new LapgSymbol();
          lapg_m[0].state = 0;
        }
        break;
      }
    }
View Full Code Here


    }
  }

  @SuppressWarnings("unchecked")
  private void reduce(int rule) {
    LapgSymbol lapg_gg = new LapgSymbol();
    lapg_gg.sym = (lapg_rlen[rule]!=0)?lapg_m[lapg_head+1-lapg_rlen[rule]].sym:null;
    lapg_gg.lexem = lapg_rlex[rule];
    lapg_gg.state = 0;
    if( DEBUG_SYNTAX ) {
      System.out.println( "reduce to " + lapg_syms[lapg_rlex[rule]] );
View Full Code Here

TOP

Related Classes of CSharpProcessor.Lexer.LapgSymbol

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.