1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/racc/parser.rb: Update #do_parse and #yyparse from upstream

See [Github tenderlove/racc@7d954b5]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
zzak 2013-02-05 01:01:14 +00:00
parent 941ea3713f
commit c50b328829
2 changed files with 27 additions and 14 deletions

View file

@ -1,3 +1,8 @@
Tue Feb 5 10:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
* lib/racc/parser.rb: Update #do_parse and #yyparse from upstream
See [Github tenderlove/racc@7d954b5]
Tue Feb 5 09:55:00 2013 Zachary Scott <zachary@zacharyscott.net> Tue Feb 5 09:55:00 2013 Zachary Scott <zachary@zacharyscott.net>
* lib/racc: Merge Racc documentation downstream, add grammar ref file * lib/racc: Merge Racc documentation downstream, add grammar ref file

View file

@ -239,15 +239,24 @@ module Racc
@racc_error_status = 0 @racc_error_status = 0
end end
### # The entry point of the parser. This method is used with #next_token.
### do_parse # If Racc wants to get token (and its value), calls next_token.
### #
# Example:
class_eval %{ # def parse
# @q = [[1,1],
# [2,2],
# [3,3],
# [false, '$']]
# do_parse
# end
#
# def next_token
# @q.shift
# end
def do_parse def do_parse
#{Racc_Main_Parsing_Routine}(_racc_setup(), false) __send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
end end
}
# The method to fetch next token. # The method to fetch next token.
# If you use #do_parse method, you must implement #next_token. # If you use #do_parse method, you must implement #next_token.
@ -301,15 +310,14 @@ module Racc
} }
end end
### # Another entry point for the parser.
### yyparse # If you use this method, you must implement RECEIVER#METHOD_ID method.
### #
# RECEIVER#METHOD_ID is a method to get next token.
class_eval %{ # It must 'yield' the token, which format is [TOKEN-SYMBOL, VALUE].
def yyparse(recv, mid) def yyparse(recv, mid)
#{Racc_YY_Parse_Method}(recv, mid, _racc_setup(), true) __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
end end
}
def _racc_yyparse_rb(recv, mid, arg, c_debug) def _racc_yyparse_rb(recv, mid, arg, c_debug)
action_table, action_check, action_default, action_pointer, action_table, action_check, action_default, action_pointer,