亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? lr_parser.java

?? java語法解釋器生成器
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
				    package java_cup.runtime;import java.util.Stack;/** This class implements a skeleton table driven LR parser.  In general, *  LR parsers are a form of bottom up shift-reduce parsers.  Shift-reduce *  parsers act by shifting input onto a parse stack until the Symbols  *  matching the right hand side of a production appear on the top of the  *  stack.  Once this occurs, a reduce is performed.  This involves removing *  the Symbols corresponding to the right hand side of the production *  (the so called "handle") and replacing them with the non-terminal from *  the left hand side of the production.  <p> * *  To control the decision of whether to shift or reduce at any given point,  *  the parser uses a state machine (the "viable prefix recognition machine"  *  built by the parser generator).  The current state of the machine is placed *  on top of the parse stack (stored as part of a Symbol object representing *  a terminal or non terminal).  The parse action table is consulted  *  (using the current state and the current lookahead Symbol as indexes) to  *  determine whether to shift or to reduce.  When the parser shifts, it  *  changes to a new state by pushing a new Symbol (containing a new state)  *  onto the stack.  When the parser reduces, it pops the handle (right hand  *  side of a production) off the stack.  This leaves the parser in the state  *  it was in before any of those Symbols were matched.  Next the reduce-goto  *  table is consulted (using the new state and current lookahead Symbol as  *  indexes) to determine a new state to go to.  The parser then shifts to  *  this goto state by pushing the left hand side Symbol of the production  *  (also containing the new state) onto the stack.<p> * *  This class actually provides four LR parsers.  The methods parse() and  *  debug_parse() provide two versions of the main parser (the only difference  *  being that debug_parse() emits debugging trace messages as it parses).   *  In addition to these main parsers, the error recovery mechanism uses two  *  more.  One of these is used to simulate "parsing ahead" in the input  *  without carrying out actions (to verify that a potential error recovery  *  has worked), and the other is used to parse through buffered "parse ahead"  *  input in order to execute all actions and re-synchronize the actual parser  *  configuration.<p> * *  This is an abstract class which is normally filled out by a subclass *  generated by the JavaCup parser generator.  In addition to supplying *  the actual parse tables, generated code also supplies methods which  *  invoke various pieces of user supplied code, provide access to certain *  special Symbols (e.g., EOF and error), etc.  Specifically, the following *  abstract methods are normally supplied by generated code: *  <dl compact> *  <dt> short[][] production_table() *  <dd> Provides a reference to the production table (indicating the index of *       the left hand side non terminal and the length of the right hand side *       for each production in the grammar). *  <dt> short[][] action_table() *  <dd> Provides a reference to the parse action table. *  <dt> short[][] reduce_table() *  <dd> Provides a reference to the reduce-goto table. *  <dt> int start_state()       *  <dd> Indicates the index of the start state. *  <dt> int start_production()  *  <dd> Indicates the index of the starting production. *  <dt> int EOF_sym()  *  <dd> Indicates the index of the EOF Symbol. *  <dt> int error_sym()  *  <dd> Indicates the index of the error Symbol. *  <dt> Symbol do_action()  *  <dd> Executes a piece of user supplied action code.  This always comes at  *       the point of a reduce in the parse, so this code also allocates and  *       fills in the left hand side non terminal Symbol object that is to be  *       pushed onto the stack for the reduce. *  <dt> void init_actions() *  <dd> Code to initialize a special object that encapsulates user supplied *       actions (this object is used by do_action() to actually carry out the  *       actions). *  </dl> *   *  In addition to these routines that <i>must</i> be supplied by the  *  generated subclass there are also a series of routines that <i>may</i>  *  be supplied.  These include: *  <dl> *  <dt> Symbol scan() *  <dd> Used to get the next input Symbol from the scanner. *  <dt> Scanner getScanner() *  <dd> Used to provide a scanner for the default implementation of *       scan(). *  <dt> int error_sync_size() *  <dd> This determines how many Symbols past the point of an error  *       must be parsed without error in order to consider a recovery to  *       be valid.  This defaults to 3.  Values less than 2 are not  *       recommended. *  <dt> void report_error(String message, Object info) *  <dd> This method is called to report an error.  The default implementation *       simply prints a message to System.err and where the error occurred. *       This method is often replaced in order to provide a more sophisticated *       error reporting mechanism. *  <dt> void report_fatal_error(String message, Object info) *  <dd> This method is called when a fatal error that cannot be recovered from *       is encountered.  In the default implementation, it calls  *       report_error() to emit a message, then throws an exception. *  <dt> void syntax_error(Symbol cur_token) *  <dd> This method is called as soon as syntax error is detected (but *       before recovery is attempted).  In the default implementation it  *       invokes: report_error("Syntax error", null); *  <dt> void unrecovered_syntax_error(Symbol cur_token) *  <dd> This method is called if syntax error recovery fails.  In the default *       implementation it invokes:<br>  *         report_fatal_error("Couldn't repair and continue parse", null); *  </dl> * * @see     java_cup.runtime.Symbol * @see     java_cup.runtime.Symbol * @see     java_cup.runtime.virtual_parse_stack * @version last updated: 7/3/96 * @author  Frank Flannery */public abstract class lr_parser {    /*-----------------------------------------------------------*/    /*--- Constructor(s) ----------------------------------------*/    /*-----------------------------------------------------------*/    /**      * Simple constructor.      */    public lr_parser() {    }        /**      * Constructor that sets the default scanner. [CSA/davidm]      */    public lr_parser(Scanner s) {        this(s,new DefaultSymbolFactory()); // TUM 20060327 old cup v10 Symbols as default    }    /**      * Constructor that sets the default scanner and a SymbolFactory     */    public lr_parser(Scanner s, SymbolFactory symfac) {        this(); // in case default constructor someday does something        symbolFactory = symfac;        setScanner(s);    }    public SymbolFactory symbolFactory;// = new DefaultSymbolFactory();    /**     * Whenever creation of a new Symbol is necessary, one should use this factory.     */    public SymbolFactory getSymbolFactory(){        return symbolFactory;    }  /*-----------------------------------------------------------*/  /*--- (Access to) Static (Class) Variables ------------------*/  /*-----------------------------------------------------------*/  /** The default number of Symbols after an error we much match to consider    *  it recovered from.    */  protected final static int _error_sync_size = 3;  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** The number of Symbols after an error we much match to consider it    *  recovered from.    */  protected int error_sync_size() {return _error_sync_size; }  /*-----------------------------------------------------------*/  /*--- (Access to) Instance Variables ------------------------*/  /*-----------------------------------------------------------*/  /** Table of production information (supplied by generated subclass).   *  This table contains one entry per production and is indexed by    *  the negative-encoded values (reduce actions) in the action_table.     *  Each entry has two parts, the index of the non-terminal on the    *  left hand side of the production, and the number of Symbols    *  on the right hand side.    */  public abstract short[][] production_table();  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** The action table (supplied by generated subclass).  This table is   *  indexed by state and terminal number indicating what action is to   *  be taken when the parser is in the given state (i.e., the given state    *  is on top of the stack) and the given terminal is next on the input.     *  States are indexed using the first dimension, however, the entries for    *  a given state are compacted and stored in adjacent index, value pairs    *  which are searched for rather than accessed directly (see get_action()).     *  The actions stored in the table will be either shifts, reduces, or    *  errors.  Shifts are encoded as positive values (one greater than the    *  state shifted to).  Reduces are encoded as negative values (one less    *  than the production reduced by).  Error entries are denoted by zero.    *    * @see java_cup.runtime.lr_parser#get_action   */  public abstract short[][] action_table();  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** The reduce-goto table (supplied by generated subclass).  This   *  table is indexed by state and non-terminal number and contains   *  state numbers.  States are indexed using the first dimension, however,   *  the entries for a given state are compacted and stored in adjacent   *  index, value pairs which are searched for rather than accessed    *  directly (see get_reduce()).  When a reduce occurs, the handle    *  (corresponding to the RHS of the matched production) is popped off    *  the stack.  The new top of stack indicates a state.  This table is    *  then indexed by that state and the LHS of the reducing production to    *  indicate where to "shift" to.    *   * @see java_cup.runtime.lr_parser#get_reduce   */  public abstract short[][] reduce_table();  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** The index of the start state (supplied by generated subclass). */  public abstract int start_state();  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** The index of the start production (supplied by generated subclass). */  public abstract int start_production();  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** The index of the end of file terminal Symbol (supplied by generated    *  subclass).    */  public abstract int EOF_sym();  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** The index of the special error Symbol (supplied by generated subclass). */  public abstract int error_sym();  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** Internal flag to indicate when parser should quit. */  protected boolean _done_parsing = false;  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** This method is called to indicate that the parser should quit.  This is    *  normally called by an accept action, but can be used to cancel parsing    *  early in other circumstances if desired.    */  public void done_parsing()    {      _done_parsing = true;    }  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /* Global parse state shared by parse(), error recovery, and    * debugging routines */  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** Indication of the index for top of stack (for use by actions). */  protected int tos;  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** The current lookahead Symbol. */  protected Symbol cur_token;  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** The parse stack itself. */  protected Stack stack = new Stack();  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** Direct reference to the production table. */   protected short[][] production_tab;  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** Direct reference to the action table. */  protected short[][] action_tab;  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** Direct reference to the reduce-goto table. */  protected short[][] reduce_tab;  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** This is the scanner object used by the default implementation   *  of scan() to get Symbols.  To avoid name conflicts with existing   *  code, this field is private. [CSA/davidm] */  private Scanner _scanner;  /**   * Simple accessor method to set the default scanner.   */  public void setScanner(Scanner s) { _scanner = s; }  /**   * Simple accessor method to get the default scanner.   */  public Scanner getScanner() { return _scanner; }  /*-----------------------------------------------------------*/  /*--- General Methods ---------------------------------------*/  /*-----------------------------------------------------------*/  /** Perform a bit of user supplied action code (supplied by generated    *  subclass).  Actions are indexed by an internal action number assigned   *  at parser generation time.   *   * @param act_num   the internal index of the action to be performed.   * @param parser    the parser object we are acting for.   * @param stack     the parse stack of that object.   * @param top       the index of the top element of the parse stack.   */  public abstract Symbol do_action(    int       act_num,     lr_parser parser,     Stack     stack,     int       top)     throws java.lang.Exception;  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** User code for initialization inside the parser.  Typically this    *  initializes the scanner.  This is called before the parser requests   *  the first Symbol.  Here this is just a placeholder for subclasses that    *  might need this and we perform no action.   This method is normally   *  overridden by the generated code using this contents of the "init with"   *  clause as its body.   */  public void user_init() throws java.lang.Exception { }  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** Initialize the action object.  This is called before the parser does   *  any parse actions. This is filled in by generated code to create   *  an object that encapsulates all action code.    */   protected abstract void init_actions() throws java.lang.Exception;  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** Get the next Symbol from the input (supplied by generated subclass).   *  Once end of file has been reached, all subsequent calls to scan    *  should return an EOF Symbol (which is Symbol number 0).  By default   *  this method returns getScanner().next_token(); this implementation   *  can be overriden by the generated parser using the code declared in   *  the "scan with" clause.  Do not recycle objects; every call to   *  scan() should return a fresh object.   */  public Symbol scan() throws java.lang.Exception {    Symbol sym = getScanner().next_token();    return (sym!=null) ? sym : getSymbolFactory().newSymbol("END_OF_FILE",EOF_sym());  }  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** Report a fatal error.  This method takes a  message string and an    *  additional object (to be used by specializations implemented in    *  subclasses).  Here in the base class a very simple implementation    *  is provided which reports the error then throws an exception.    *   * @param message an error message.   * @param info    an extra object reserved for use by specialized subclasses.   */  public void report_fatal_error(    String   message,     Object   info)    throws java.lang.Exception    {      /* stop parsing (not really necessary since we throw an exception, but) */      done_parsing();      /* use the normal error message reporting to put out the message */      report_error(message, info);      /* throw an exception */      throw new Exception("Can't recover from previous error(s)");    }  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** Report a non fatal error (or warning).  This method takes a message    *  string and an additional object (to be used by specializations    *  implemented in subclasses).  Here in the base class a very simple    *  implementation is provided which simply prints the message to    *  System.err.    *   * @param message an error message.   * @param info    an extra object reserved for use by specialized subclasses.   */  public void report_error(String message, Object info)    {      System.err.print(message);      System.err.flush();      if (info instanceof Symbol)	if (((Symbol)info).left != -1)	System.err.println(" at character " + ((Symbol)info).left + 			   " of input");	else System.err.println("");      else System.err.println("");    }  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** This method is called when a syntax error has been detected and recovery    *  is about to be invoked.  Here in the base class we just emit a    *  "Syntax error" error message.     *   * @param cur_token the current lookahead Symbol.   */  public void syntax_error(Symbol cur_token)    {      report_error("Syntax error", cur_token);    }  /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/  /** This method is called if it is determined that syntax error recovery    *  has been unsuccessful.  Here in the base class we report a fatal error.    *

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲图片欧美一区| 欧美色中文字幕| 91网页版在线| 欧美刺激午夜性久久久久久久| 国产精品电影院| 国产在线精品不卡| 欧美一级生活片| 亚洲综合在线观看视频| 成人性生交大片免费看中文| 日韩欧美三级在线| 天堂资源在线中文精品| 97久久精品人人澡人人爽| 久久奇米777| 久久精品国产网站| 欧美一区二区三区免费视频| 亚洲无人区一区| 欧美图区在线视频| 一区二区三区色| 91丝袜高跟美女视频| 国产精品国产自产拍高清av王其| 国产精品亚洲一区二区三区在线 | 91国产免费看| 国产精品乱码人人做人人爱| 国产在线观看一区二区| 欧美精品一区二区久久久| 日本欧美一区二区| 日韩亚洲国产中文字幕欧美| 日av在线不卡| 精品少妇一区二区三区视频免付费 | 国内精品嫩模私拍在线| 日韩精品一区二区三区四区视频| 天天操天天色综合| 日韩视频一区二区三区在线播放| 亚洲午夜激情网站| 欧美日韩免费观看一区三区| 亚洲一区二区三区四区在线| 欧美老肥妇做.爰bbww视频| 日韩精品一卡二卡三卡四卡无卡| 精品久久国产97色综合| 麻豆视频一区二区| 久久精品一区四区| 99久久精品国产观看| 一区二区三区在线高清| 欧美亚洲国产一区二区三区| 日韩福利视频网| 精品国一区二区三区| 国产麻豆成人传媒免费观看| 亚洲国产高清不卡| 在线一区二区三区| 亚洲国产综合色| 精品国产污网站| 成人av集中营| 日韩精品一二三四| 国产丝袜欧美中文另类| 色偷偷久久一区二区三区| 日韩国产欧美视频| 中文字幕av资源一区| 在线观看www91| 国产一区二区三区久久悠悠色av| 国产精品毛片久久久久久| 欧美日韩中文字幕一区| 国模无码大尺度一区二区三区| 中文字幕一区日韩精品欧美| 欧美手机在线视频| 国产成人精品免费在线| 亚洲一区二区三区四区中文字幕 | 国产精品狼人久久影院观看方式| 欧美在线观看视频一区二区 | 国产精品久久久久久久第一福利| 在线观看日韩av先锋影音电影院| 美女爽到高潮91| 亚洲手机成人高清视频| 91精品国产综合久久福利软件| 成人高清视频在线| 人人狠狠综合久久亚洲| 亚洲人成网站在线| 久久久久免费观看| 欧美日韩精品一区二区| av色综合久久天堂av综合| 偷拍日韩校园综合在线| 国产精品污www在线观看| 欧美一级精品大片| 色狠狠av一区二区三区| 丰满白嫩尤物一区二区| 久久99久久久久| 亚洲国产欧美在线人成| 国产精品三级视频| 精品日韩在线观看| 在线播放国产精品二区一二区四区| 风间由美一区二区三区在线观看 | 亚洲综合免费观看高清在线观看| 久久亚洲精品国产精品紫薇| 91精品婷婷国产综合久久性色| 色综合久久久网| 99精品视频在线免费观看| 国产精品99久久不卡二区| 免费国产亚洲视频| 亚洲成av人在线观看| 亚洲久草在线视频| 中文字幕亚洲在| 国产偷国产偷精品高清尤物| 精品国产一区二区三区忘忧草| 欧美久久久久久久久中文字幕| 在线观看不卡一区| 欧美在线你懂得| 欧美日韩黄色一区二区| 欧美日韩国产一级| 欧美精品三级在线观看| 69堂成人精品免费视频| 欧美日本在线视频| 欧美精品九九99久久| 欧美精三区欧美精三区| 欧美精品欧美精品系列| 在线成人小视频| 欧美一区二区三区在线观看| 欧美一级欧美三级在线观看| 91精品婷婷国产综合久久 | 欧美韩国一区二区| 日本一区二区成人在线| 中文字幕欧美国产| 亚洲人成影院在线观看| 一区二区三区高清| 丝袜美腿亚洲一区| 麻豆精品在线播放| 久草这里只有精品视频| 国产夫妻精品视频| 91亚洲男人天堂| 欧美精品一二三区| 精品国产免费视频| 国产欧美精品一区二区色综合| 国产精品无遮挡| 有坂深雪av一区二区精品| 午夜a成v人精品| 久久不见久久见免费视频7| 国产99久久久精品| 在线观看视频91| 欧美tickling网站挠脚心| 久久久亚洲精品石原莉奈| 国产精品黄色在线观看| 亚洲国产乱码最新视频 | 欧美性大战久久久久久久蜜臀| 欧美一区二区三区人| 国产日产欧美一区| 亚洲人成亚洲人成在线观看图片| 丝袜亚洲精品中文字幕一区| 国产成人夜色高潮福利影视| 91久久精品一区二区三区| 精品国产髙清在线看国产毛片| 欧美国产激情一区二区三区蜜月| 最新热久久免费视频| 日韩国产欧美三级| 99国产精品视频免费观看| 欧美日本一区二区三区四区| 国产欧美日韩卡一| 性做久久久久久久久| 国产jizzjizz一区二区| 在线91免费看| 中文字幕中文字幕在线一区| 日韩成人免费看| 一本大道av伊人久久综合| 久久综合色天天久久综合图片| 一区二区三区不卡视频在线观看 | 欧美日本一区二区三区四区| 国产日韩欧美精品综合| 日本视频一区二区| 欧美在线制服丝袜| 国产精品污www在线观看| 老司机精品视频导航| 色欧美片视频在线观看在线视频| 欧美精品一区二区三区蜜桃| 亚洲成人激情自拍| 91亚洲大成网污www| 久久久91精品国产一区二区精品 | 国产三级久久久| 美腿丝袜在线亚洲一区| 91成人免费网站| 亚洲欧美中日韩| 国产精品99久| 久久久久久亚洲综合| 蜜桃精品视频在线观看| 欧美视频在线不卡| 亚洲免费成人av| 91在线一区二区| 国产精品视频一二三区| 国产成人av资源| 国产三区在线成人av| 加勒比av一区二区| 26uuu精品一区二区三区四区在线| 亚洲va欧美va天堂v国产综合| 色素色在线综合| 亚洲欧美日韩在线不卡| 99国产精品久久久久久久久久久| 日本一区二区不卡视频| 盗摄精品av一区二区三区| 欧美极品美女视频| 国产成人8x视频一区二区| 日本一区二区三区dvd视频在线| 国产成人av一区| 国产精品视频一二| 色噜噜狠狠色综合中国|