tgl.compiler
クラス Parser

java.lang.Object
  上位を拡張 java_cup.runtime.lr_parser
      上位を拡張 tgl.compiler.Parser

public class Parser
extends java_cup.runtime.lr_parser

CUP v0.11a beta 20060608 generated parser.

バージョン:
Fri Mar 27 20:08:02 JST 2009

フィールドの概要
protected static short[][] _action_table
          Parse-action table.
protected static short[][] _production_table
          Production table.
protected static short[][] _reduce_table
          reduce_goto table.
protected  CUP$Parser$actions action_obj
          Instance of action encapsulation class.
 
クラス java_cup.runtime.lr_parser から継承されたフィールド
_done_parsing, _error_sync_size, action_tab, cur_token, lookahead, lookahead_pos, production_tab, reduce_tab, stack, symbolFactory, tos
 
コンストラクタの概要
Parser()
          Default constructor.
Parser(Lexer lexer, CompileErrorHandler errorHandler)
           
Parser(java_cup.runtime.Scanner s)
          Constructor which sets the default scanner.
Parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf)
          Constructor which sets the default scanner.
 
メソッドの概要
 short[][] action_table()
          Access to parse-action table.
 java_cup.runtime.Symbol do_action(int act_num, java_cup.runtime.lr_parser parser, java.util.Stack stack, int top)
          Invoke a user supplied parse action.
 int EOF_sym()
          EOF Symbol index.
 int error_sym()
          error Symbol index.
(package private)  CompileErrorHandler getErrorHandler()
          構文解析と意味解析のエラーを処理するエラーハンドラのインスタンスを返す。
(package private)  SymbolTable getSymbolTable()
          コンパイラが使う記号表のインスタンスオブジェクトを取り出す。
protected  void init_actions()
          Action encapsulation object initializer.
 short[][] production_table()
          Access to production table.
 short[][] reduce_table()
          Access to reduce_goto table.
 void report_fatal_error(java.lang.String message, java.lang.Object info)
          致命的なエラーを報告する。
 int start_production()
          Indicates start production.
 int start_state()
          Indicates start state.
 void unrecovered_syntax_error(java_cup.runtime.Symbol cur_token)
          構文解析器が復帰不可能な構文エラーを検出したときに呼び出される。
 
クラス java_cup.runtime.lr_parser から継承されたメソッド
advance_lookahead, cur_err_token, debug_message, debug_parse, debug_reduce, debug_shift, debug_stack, done_parsing, dump_stack, error_recovery, error_sync_size, find_recovery_config, get_action, get_reduce, getScanner, getSymbolFactory, parse_lookahead, parse, read_lookahead, report_error, restart_lookahead, scan, setScanner, shift_under_error, syntax_error, try_parse_ahead, unpackFromStrings, user_init
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

_production_table

protected static final short[][] _production_table
Production table.


_action_table

protected static final short[][] _action_table
Parse-action table.


_reduce_table

protected static final short[][] _reduce_table
reduce_goto table.


action_obj

protected CUP$Parser$actions action_obj
Instance of action encapsulation class.

コンストラクタの詳細

Parser

public Parser()
Default constructor.


Parser

public Parser(java_cup.runtime.Scanner s)
Constructor which sets the default scanner.


Parser

public Parser(java_cup.runtime.Scanner s,
              java_cup.runtime.SymbolFactory sf)
Constructor which sets the default scanner.


Parser

public Parser(Lexer lexer,
              CompileErrorHandler errorHandler)
       throws java.lang.Exception
例外:
java.lang.Exception
メソッドの詳細

production_table

public short[][] production_table()
Access to production table.

定義:
クラス java_cup.runtime.lr_parser 内の production_table

action_table

public short[][] action_table()
Access to parse-action table.

定義:
クラス java_cup.runtime.lr_parser 内の action_table

reduce_table

public short[][] reduce_table()
Access to reduce_goto table.

定義:
クラス java_cup.runtime.lr_parser 内の reduce_table

init_actions

protected void init_actions()
Action encapsulation object initializer.

定義:
クラス java_cup.runtime.lr_parser 内の init_actions

do_action

public java_cup.runtime.Symbol do_action(int act_num,
                                         java_cup.runtime.lr_parser parser,
                                         java.util.Stack stack,
                                         int top)
                                  throws java.lang.Exception
Invoke a user supplied parse action.

定義:
クラス java_cup.runtime.lr_parser 内の do_action
例外:
java.lang.Exception

start_state

public int start_state()
Indicates start state.

定義:
クラス java_cup.runtime.lr_parser 内の start_state

start_production

public int start_production()
Indicates start production.

定義:
クラス java_cup.runtime.lr_parser 内の start_production

EOF_sym

public int EOF_sym()
EOF Symbol index.

定義:
クラス java_cup.runtime.lr_parser 内の EOF_sym

error_sym

public int error_sym()
error Symbol index.

定義:
クラス java_cup.runtime.lr_parser 内の error_sym

getErrorHandler

CompileErrorHandler getErrorHandler()
構文解析と意味解析のエラーを処理するエラーハンドラのインスタンスを返す。

戻り値:
エラーハンドラのインスタンス

getSymbolTable

SymbolTable getSymbolTable()
コンパイラが使う記号表のインスタンスオブジェクトを取り出す。

戻り値:
記号表のインスタンス

report_fatal_error

public void report_fatal_error(java.lang.String message,
                               java.lang.Object info)
                        throws java.lang.Exception
致命的なエラーを報告する。このメソッドは cup が提供しているメソッドをオーバーライド したもの。通常の report_fatal_error は、 report_error を呼びエラーを報告してから、 done_parsing を呼び構文解析器を終了させ、最後に例外 Exception を発生させる (report_error と done_parsing は cup が提供するメソッド)。ここでは、Exception の 代わりに CompileException を発生させるためだけに、メソッドをオーバーライドしている。

オーバーライド:
クラス java_cup.runtime.lr_parser 内の report_fatal_error
例外:
java.lang.Exception

unrecovered_syntax_error

public void unrecovered_syntax_error(java_cup.runtime.Symbol cur_token)
                              throws java.lang.Exception
構文解析器が復帰不可能な構文エラーを検出したときに呼び出される。このメソッドは cup が提供しているメソッドをオーバーライドしたもの。ここでは、意味解析でのエラー と同様に扱うために、構文エラーを表すクラス SyntaxError のインスタンスの error メソッドを呼び出すことで、エラーハンドラのクラス CompileErrorHandler のインスタンスに 処理を委譲している。

オーバーライド:
クラス java_cup.runtime.lr_parser 内の unrecovered_syntax_error
例外:
java.lang.Exception