home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Programming / Jikes / Source / src / javaprs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-24  |  2.8 KB  |  93 lines

  1. // $Id: javaprs.h,v 1.16 2001/01/05 09:13:20 mdejong Exp $
  2. // This software is subject to the terms of the IBM Jikes Compiler
  3. // License Agreement available at the following URL:
  4. // http://www.ibm.com/research/jikes.
  5. // Copyright (C) 1996, 1998, International Business Machines Corporation
  6. // and others.  All Rights Reserved.
  7. // You must accept the terms of that agreement to use this software.
  8. //
  9. #ifndef javaprs_INCLUDED
  10. #define javaprs_INCLUDED
  11.  
  12. #define SCOPE_REPAIR
  13. #define DEFERRED_RECOVERY
  14. #define FULL_DIAGNOSIS
  15. #define SPACE_TABLES
  16.  
  17. #ifdef    HAVE_JIKES_NAMESPACE
  18. namespace Jikes {    // Open namespace Jikes block
  19. #endif
  20.  
  21. class LexStream;
  22.  
  23. class javaprs_table
  24. {
  25. public:
  26.     static int original_state(int state) { return -base_check[state]; }
  27.     static int asi(int state) { return asb[original_state(state)]; }
  28.     static int nasi(int state) { return nasb[original_state(state)]; }
  29.     static int in_symbol(int state) { return in_symb[original_state(state)]; }
  30.  
  31.     static const unsigned char  rhs[];
  32.     static const   signed short check_table[];
  33.     static const   signed short *base_check;
  34.     static const unsigned short lhs[];
  35.     static const unsigned short *base_action;
  36.     static const unsigned char  term_check[];
  37.     static const unsigned short term_action[];
  38.  
  39.     static const unsigned short asb[];
  40.     static const unsigned char  asr[];
  41.     static const unsigned short nasb[];
  42.     static const unsigned short nasr[];
  43.     static const unsigned short name_start[];
  44.     static const unsigned char  name_length[];
  45.     static const          char  string_buffer[];
  46.     static const unsigned short terminal_index[];
  47.     static const unsigned short non_terminal_index[];
  48.     static const unsigned short scope_prefix[];
  49.     static const unsigned short scope_suffix[];
  50.     static const unsigned short scope_lhs[];
  51.     static const unsigned char  scope_la[];
  52.     static const unsigned char  scope_state_set[];
  53.     static const unsigned short scope_rhs[];
  54.     static const unsigned short scope_state[];
  55.     static const unsigned short in_symb[];
  56.  
  57.     static int nt_action(int state, int sym)
  58.     {
  59.         return base_action[state + sym];
  60.     }
  61.  
  62.     static int t_action(int act, int sym, LexStream *stream)
  63.     {
  64.         act = base_action[act];
  65.         int i = act + sym;
  66.  
  67.         act = term_action[term_check[i] == sym ? i : act];
  68.  
  69.         if (act > LA_STATE_OFFSET)
  70.         {
  71.             for (TokenObject tok = stream -> Peek();
  72.                  ;
  73.                  tok = stream -> Next(tok))
  74.             {
  75.                act -= LA_STATE_OFFSET;
  76.                sym = stream -> Kind(tok);
  77.                i = act + sym;
  78.                act = term_action[term_check[i] == sym ? i : act];
  79.                if (act <= LA_STATE_OFFSET)
  80.                    break;
  81.             } 
  82.         }
  83.  
  84.         return act;
  85.     }
  86. };
  87.  
  88. #ifdef    HAVE_JIKES_NAMESPACE
  89. }            // Close namespace Jikes block
  90. #endif
  91.  
  92. #endif /* javaprs_INCLUDED */
  93.