- do_parse
-
Parse entry point. This method is used with
next_token. If Racc want to get token
(and its value), call next_token.
# example
---- inner
def parse
@q = [[1,1],
[2,2],
[3,3],
[false, '$']]
do_parse
end
def next_token
@q.shift
end
- next_token [abstract]
-
token getter method. If you use 'do_parse' method, you must also
implement this method. The format of return value is
[TOKEN-SYMBOL, VALUE]. token-symbol is represented by Ruby's symbol
as default. For example, :IDENT for 'IDENT' in Racc. ";" (String) for ';'.
Last symbol (EOF) must be false.
- yyparse( recv, mid )
-
parse entry point (2). If you use this method, you must also implement
recv#mid method.
recv#mid is token getter method.
It must 'yield's token, which format is [TOKEN-SYMBOL, VALUE].
- on_error( err_tok, err_val, _values )
-
called when parse error is found.
err_tok is an internal token number which makes error.
err_val is its value.
_values is a stack of symbol values. DO NOT EDIT this object.
This method raises ParseError as default.
If you override this method and
make not raise exceptions, parser enters into "error recovering" mode.
- yyerror
-
If this method is called, racc enters error recovering mode.
- yyerrok
-
leave error recovering mode.
- yyaccept
-
return from parse routine (return value is Symbol-Value-Stack[0]).