[ruby-cvs:69133] mame:r61952 (trunk): ext/ripper: Introduce a simple DSL for ripper.y code generation

mame at ruby-lang.org mame at ruby-lang.org
Fri Jan 19 19:48:08 JST 2018


mame	2018-01-19 19:48:08 +0900 (Fri, 19 Jan 2018)

  New Revision: 61952

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61952

  Log:
    ext/ripper: Introduce a simple DSL for ripper.y code generation
    
    Currently, parse.y actions are hard to read and write because the code
    has double meaning (for core parser and for ripper).  I think that, if
    it is easy to write ripper's code shortly and simply, the double meaning
    trick is not needed.
    
    For the sake, this change adds a simple DSL for ripper's code.  For
    example, in parse.y, we can write:
    
        /*% ripper: stmts_add(stmts_new, void_stmt) %*/
    
    instead of:
    
        $$ = dispatch2(stmts_add, dispatch0(stmts_new),
                       dispatch0(void_stmt));

  Added files:
    trunk/ext/ripper/tools/dsl.rb
  Modified files:
    trunk/ext/ripper/depend
    trunk/ext/ripper/tools/generate.rb
    trunk/ext/ripper/tools/preproc.rb
    trunk/parse.y


More information about the ruby-cvs mailing list