[前][次][番号順一覧][スレッド一覧]

ruby-changes:26999

From: zzak <ko1@a...>
Date: Tue, 5 Feb 2013 10:10:35 +0900 (JST)
Subject: [ruby-changes:26999] zzak:r39051 (trunk): * lib/racc/parser.rb: Update #do_parse and #yyparse from upstream

zzak	2013-02-05 10:01:14 +0900 (Tue, 05 Feb 2013)

  New Revision: 39051

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39051

  Log:
    * lib/racc/parser.rb: Update #do_parse and #yyparse from upstream
      See [Github tenderlove/racc@7d954b5]

  Modified files:
    trunk/ChangeLog
    trunk/lib/racc/parser.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39050)
+++ ChangeLog	(revision 39051)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Feb  5 10:00:00 2013  Zachary Scott  <zachary@z...>
+
+	* 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@z...>
 
 	* lib/racc: Merge Racc documentation downstream, add grammar ref file
Index: lib/racc/parser.rb
===================================================================
--- lib/racc/parser.rb	(revision 39050)
+++ lib/racc/parser.rb	(revision 39051)
@@ -239,15 +239,24 @@ module Racc https://github.com/ruby/ruby/blob/trunk/lib/racc/parser.rb#L239
       @racc_error_status = 0
     end
 
-    ###
-    ### do_parse
-    ###
-
-    class_eval %{
+    # The entry point of the parser. This method is used with #next_token.
+    # If Racc wants to get token (and its value), calls next_token.
+    #
+    # Example:
+    #     def parse
+    #       @q = [[1,1],
+    #             [2,2],
+    #             [3,3],
+    #             [false, '$']]
+    #       do_parse
+    #     end
+    #
+    #     def next_token
+    #       @q.shift
+    #     end
     def do_parse
-      #{Racc_Main_Parsing_Routine}(_racc_setup(), false)
+      __send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
     end
-    }
 
     # The method to fetch next token.
     # If you use #do_parse method, you must implement #next_token.
@@ -301,15 +310,14 @@ module Racc https://github.com/ruby/ruby/blob/trunk/lib/racc/parser.rb#L310
       }
     end
 
-    ###
-    ### yyparse
-    ###
-
-    class_eval %{
+    # Another entry point for the parser.
+    # If you use this method, you must implement RECEIVER#METHOD_ID method.
+    #
+    # RECEIVER#METHOD_ID is a method to get next token.
+    # It must 'yield' the token, which format is [TOKEN-SYMBOL, VALUE].
     def yyparse(recv, mid)
-      #{Racc_YY_Parse_Method}(recv, mid, _racc_setup(), true)
+      __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
     end
-    }
 
     def _racc_yyparse_rb(recv, mid, arg, c_debug)
       action_table, action_check, action_default, action_pointer,

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]