ruby/test/prism/fixtures/seattlerb
..
BEGIN.txt
README.rdoc
TestRubyParserShared.txt
__ENCODING__.txt
alias_gvar_backref.txt
alias_resword.txt
and_multi.txt
aref_args_assocs.txt
aref_args_lit_assocs.txt
args_kw_block.txt
array_line_breaks.txt
array_lits_trailing_calls.txt
assoc__bare.txt
assoc_label.txt
attr_asgn_colon_id.txt
attrasgn_array_arg.txt
attrasgn_array_lhs.txt
attrasgn_primary_dot_constant.txt
backticks_interpolation_line.txt
bang_eq.txt
bdot2.txt
bdot3.txt
begin_ensure_no_bodies.txt
begin_rescue_else_ensure_bodies.txt
begin_rescue_else_ensure_no_bodies.txt
begin_rescue_ensure_no_bodies.txt
block_arg__bare.txt
block_arg_kwsplat.txt
block_arg_opt_arg_block.txt
block_arg_opt_splat.txt
block_arg_opt_splat_arg_block_omfg.txt
block_arg_optional.txt
block_arg_scope.txt
block_arg_scope2.txt
block_arg_splat_arg.txt
block_args_kwargs.txt
block_args_no_kwargs.txt
block_args_opt1.txt
block_args_opt2.txt
block_args_opt2_2.txt
block_args_opt3.txt
block_break.txt
block_call_defn_call_block_call.txt
block_call_dot_op2_brace_block.txt
block_call_dot_op2_cmd_args_do_block.txt
block_call_operation_colon.txt
block_call_operation_dot.txt
block_call_paren_call_block_call.txt
block_command_operation_colon.txt
block_command_operation_dot.txt
block_decomp_anon_splat_arg.txt
block_decomp_arg_splat.txt
block_decomp_arg_splat_arg.txt
block_decomp_splat.txt
block_kw.txt
block_kw__required.txt
block_kwarg_lvar.txt
block_kwarg_lvar_multiple.txt
block_next.txt
block_opt_arg.txt
block_opt_splat.txt
block_opt_splat_arg_block_omfg.txt
block_optarg.txt
block_paren_splat.txt
block_reg_optarg.txt
block_return.txt
block_scope.txt
block_splat_reg.txt
bug169.txt
bug179.txt
bug190.txt
bug191.txt
bug202.txt
bug236.txt
bug290.txt
bug_187.txt
bug_215.txt
bug_249.txt
bug_and.txt
bug_args__19.txt
bug_args_masgn.txt
bug_args_masgn2.txt
bug_args_masgn_outer_parens__19.txt
bug_call_arglist_parens.txt
bug_case_when_regexp.txt
bug_comma.txt
bug_cond_pct.txt
bug_hash_args.txt
bug_hash_args_trailing_comma.txt
bug_hash_interp_array.txt
bug_masgn_right.txt
bug_not_parens.txt
bug_op_asgn_rescue.txt
call_and.txt
call_arg_assoc.txt
call_arg_assoc_kwsplat.txt
call_arg_kwsplat.txt
call_args_assoc_quoted.txt
call_args_assoc_trailing_comma.txt
call_args_command.txt
call_array_arg.txt
call_array_block_call.txt
call_array_lambda_block_call.txt
call_array_lit_inline_hash.txt
call_assoc.txt
call_assoc_new.txt
call_assoc_new_if_multiline.txt
call_assoc_trailing_comma.txt
call_bang_command_call.txt
call_bang_squiggle.txt
call_begin_call_block_call.txt
call_block_arg_named.txt
call_carat.txt
call_colon2.txt
call_colon_parens.txt
call_div.txt
call_dot_parens.txt
call_env.txt
call_eq3.txt
call_gt.txt
call_kwsplat.txt
call_leading_dots.txt
call_leading_dots_comment.txt
call_lt.txt
call_lte.txt
call_not.txt
call_pipe.txt
call_rshift.txt
call_self_brackets.txt
call_spaceship.txt
call_stabby_do_end_with_block.txt
call_stabby_with_braces_block.txt
call_star.txt
call_star2.txt
call_trailing_comma.txt
call_trailing_dots.txt
call_unary_bang.txt
case_in.txt
case_in_31.txt
case_in_37.txt
case_in_42.txt
case_in_42_2.txt
case_in_47.txt
case_in_67.txt
case_in_86.txt
case_in_86_2.txt
case_in_array_pat_const.txt
case_in_array_pat_const2.txt
case_in_array_pat_paren_assign.txt
case_in_const.txt
case_in_else.txt
case_in_find.txt
case_in_find_array.txt
case_in_hash_pat.txt
case_in_hash_pat_assign.txt
case_in_hash_pat_paren_assign.txt
case_in_hash_pat_paren_true.txt
case_in_hash_pat_rest.txt
case_in_hash_pat_rest_solo.txt
case_in_if_unless_post_mod.txt
case_in_multiple.txt
case_in_or.txt
class_comments.txt
cond_unary_minus.txt
const_2_op_asgn_or2.txt
const_3_op_asgn_or.txt
const_op_asgn_and1.txt
const_op_asgn_and2.txt
const_op_asgn_or.txt
dasgn_icky2.txt
defined_eh_parens.txt
defn_arg_asplat_arg.txt
defn_arg_forward_args.txt
defn_args_forward_args.txt
defn_comments.txt
defn_endless_command.txt
defn_endless_command_rescue.txt
defn_forward_args.txt
defn_forward_args__no_parens.txt
defn_kwarg_env.txt
defn_kwarg_kwarg.txt
defn_kwarg_kwsplat.txt
defn_kwarg_kwsplat_anon.txt
defn_kwarg_lvar.txt
defn_kwarg_no_parens.txt
defn_kwarg_val.txt
defn_no_kwargs.txt
defn_oneliner.txt
defn_oneliner_eq2.txt
defn_oneliner_noargs.txt
defn_oneliner_noargs_parentheses.txt
defn_oneliner_rescue.txt
defn_opt_last_arg.txt
defn_opt_reg.txt
defn_opt_splat_arg.txt
defn_powarg.txt
defn_reg_opt_reg.txt
defn_splat_arg.txt
defn_unary_not.txt
defns_reserved.txt
defs_as_arg_with_do_block_inside.txt
defs_comments.txt
defs_endless_command.txt
defs_endless_command_rescue.txt
defs_kwarg.txt
defs_oneliner.txt
defs_oneliner_eq2.txt
defs_oneliner_rescue.txt
difficult0_.txt
difficult1_line_numbers.txt
difficult1_line_numbers2.txt
difficult2_.txt
difficult3_.txt
difficult3_2.txt
difficult3_3.txt
difficult3_4.txt
difficult3_5.txt
difficult3__6.txt
difficult3__7.txt
difficult3__8.txt
difficult3__9.txt
difficult3__10.txt
difficult3__11.txt
difficult3__12.txt
difficult4__leading_dots.txt
difficult4__leading_dots2.txt
difficult6_.txt
difficult6__7.txt
difficult6__8.txt
difficult7_.txt
do_bug.txt
do_lambda.txt
dot2_nil__26.txt
dot3_nil__26.txt
dstr_evstr.txt
dstr_evstr_empty_end.txt
dstr_lex_state.txt
dstr_str.txt
dsym_esc_to_sym.txt
dsym_to_sym.txt
eq_begin_line_numbers.txt
eq_begin_why_wont_people_use_their_spacebar.txt
evstr_evstr.txt
evstr_str.txt
expr_not_bang.txt
f_kw.txt
f_kw__required.txt
flip2_env_lvar.txt
float_with_if_modifier.txt
heredoc__backslash_dos_format.txt
heredoc_backslash_nl.txt
heredoc_bad_hex_escape.txt
heredoc_bad_oct_escape.txt
heredoc_comma_arg.txt
heredoc_lineno.txt
heredoc_nested.txt
heredoc_squiggly.txt
heredoc_squiggly_blank_line_plus_interpolation.txt
heredoc_squiggly_blank_lines.txt
heredoc_squiggly_empty.txt
heredoc_squiggly_interp.txt
heredoc_squiggly_no_indent.txt
heredoc_squiggly_tabs.txt
heredoc_squiggly_tabs_extra.txt
heredoc_squiggly_visually_blank_lines.txt
heredoc_trailing_slash_continued_call.txt
heredoc_unicode.txt
heredoc_with_carriage_return_escapes.txt
heredoc_with_carriage_return_escapes_windows.txt
heredoc_with_extra_carriage_horrible_mix.txt
heredoc_with_extra_carriage_returns.txt
heredoc_with_extra_carriage_returns_windows.txt
heredoc_with_interpolation_and_carriage_return_escapes.txt
heredoc_with_interpolation_and_carriage_return_escapes_windows.txt
heredoc_with_not_global_interpolation.txt
heredoc_with_only_carriage_returns.txt
heredoc_with_only_carriage_returns_windows.txt
if_elsif.txt
if_symbol.txt
in_expr_no_case.txt
index_0.txt
index_0_opasgn.txt
integer_with_if_modifier.txt
interpolated_symbol_array_line_breaks.txt
interpolated_word_array_line_breaks.txt
iter_args_1.txt
iter_args_2__19.txt
iter_args_3.txt
iter_args_4.txt
iter_args_5.txt
iter_args_6.txt
iter_args_7_1.txt
iter_args_7_2.txt
iter_args_8_1.txt
iter_args_8_2.txt
iter_args_9_1.txt
iter_args_9_2.txt
iter_args_10_1.txt
iter_args_10_2.txt
iter_args_11_1.txt
iter_args_11_2.txt
iter_kwarg.txt
iter_kwarg_kwsplat.txt
label_vs_string.txt
lambda_do_vs_brace.txt
lasgn_arg_rescue_arg.txt
lasgn_call_bracket_rescue_arg.txt
lasgn_call_nobracket_rescue_arg.txt
lasgn_command.txt
lasgn_env.txt
lasgn_ivar_env.txt
lasgn_lasgn_command_call.txt
lasgn_middle_splat.txt
magic_encoding_comment.txt
masgn_anon_splat_arg.txt
masgn_arg_colon_arg.txt
masgn_arg_ident.txt
masgn_arg_splat_arg.txt
masgn_colon2.txt
masgn_colon3.txt
masgn_command_call.txt
masgn_double_paren.txt
masgn_lhs_splat.txt
masgn_paren.txt
masgn_splat_arg.txt
masgn_splat_arg_arg.txt
masgn_star.txt
masgn_var_star_var.txt
messy_op_asgn_lineno.txt
method_call_assoc_trailing_comma.txt
method_call_trailing_comma.txt
mlhs_back_anonsplat.txt
mlhs_back_splat.txt
mlhs_front_anonsplat.txt
mlhs_front_splat.txt
mlhs_keyword.txt
mlhs_mid_anonsplat.txt
mlhs_mid_splat.txt
mlhs_rescue.txt
module_comments.txt
multiline_hash_declaration.txt
non_interpolated_symbol_array_line_breaks.txt
non_interpolated_word_array_line_breaks.txt
op_asgn_command_call.txt
op_asgn_dot_ident_command_call.txt
op_asgn_index_command_call.txt
op_asgn_primary_colon_const_command_call.txt
op_asgn_primary_colon_identifier1.txt
op_asgn_primary_colon_identifier_command_call.txt
op_asgn_val_dot_ident_command_call.txt
parse_def_special_name.txt
parse_if_not_canonical.txt
parse_if_not_noncanonical.txt
parse_line_block.txt
parse_line_block_inline_comment.txt
parse_line_block_inline_comment_leading_newlines.txt
parse_line_block_inline_multiline_comment.txt
parse_line_call_ivar_arg_no_parens_line_break.txt
parse_line_call_ivar_line_break_paren.txt
parse_line_call_no_args.txt
parse_line_defn_complex.txt
parse_line_defn_no_parens.txt
parse_line_defn_no_parens_args.txt
parse_line_dot2.txt
parse_line_dot2_open.txt
parse_line_dot3.txt
parse_line_dot3_open.txt
parse_line_dstr_escaped_newline.txt
parse_line_dstr_soft_newline.txt
parse_line_evstr_after_break.txt
parse_line_hash_lit.txt
parse_line_heredoc.txt
parse_line_heredoc_evstr.txt
parse_line_heredoc_hardnewline.txt
parse_line_heredoc_regexp_chars.txt
parse_line_iter_call_no_parens.txt
parse_line_iter_call_parens.txt
parse_line_multiline_str.txt
parse_line_multiline_str_literal_n.txt
parse_line_newlines.txt
parse_line_op_asgn.txt
parse_line_postexe.txt
parse_line_preexe.txt
parse_line_rescue.txt
parse_line_return.txt
parse_line_str_with_newline_escape.txt
parse_line_to_ary.txt
parse_line_trailing_newlines.txt
parse_opt_call_args_assocs_comma.txt
parse_opt_call_args_lit_comma.txt
parse_pattern_019.txt
parse_pattern_044.txt
parse_pattern_051.txt
parse_pattern_058.txt
parse_pattern_058_2.txt
parse_pattern_069.txt
parse_pattern_076.txt
parse_until_not_canonical.txt
parse_until_not_noncanonical.txt
parse_while_not_canonical.txt
parse_while_not_noncanonical.txt
pctW_lineno.txt
pct_Q_backslash_nl.txt
pct_nl.txt
pct_w_heredoc_interp_nested.txt
pipe_semicolon.txt
pipe_space.txt
qWords_space.txt
qsymbols.txt
qsymbols_empty.txt
qsymbols_empty_space.txt
qsymbols_interp.txt
quoted_symbol_hash_arg.txt
quoted_symbol_keys.txt
qw_escape.txt
qw_escape_term.txt
qwords_empty.txt
read_escape_unicode_curlies.txt
read_escape_unicode_h4.txt
regexp.txt
regexp_esc_C_slash.txt
regexp_esc_u.txt
regexp_escape_extended.txt
regexp_unicode_curlies.txt
required_kwarg_no_value.txt
rescue_do_end_ensure_result.txt
rescue_do_end_no_raise.txt
rescue_do_end_raised.txt
rescue_do_end_rescued.txt
rescue_in_block.txt
rescue_parens.txt
return_call_assocs.txt
rhs_asgn.txt
ruby21_numbers.txt
safe_attrasgn.txt
safe_attrasgn_constant.txt
safe_call.txt
safe_call_after_newline.txt
safe_call_dot_parens.txt
safe_call_newline.txt
safe_call_operator.txt
safe_call_rhs_newline.txt
safe_calls.txt
safe_op_asgn.txt
safe_op_asgn2.txt
slashy_newlines_within_string.txt
stabby_arg_no_paren.txt
stabby_arg_opt_splat_arg_block_omfg.txt
stabby_block_iter_call.txt
stabby_block_iter_call_no_target_with_arg.txt
stabby_block_kw.txt
stabby_block_kw__required.txt
stabby_proc_scope.txt
str_backslashes.txt
str_double_double_escaped_newline.txt
str_double_escaped_newline.txt
str_double_newline.txt
str_evstr.txt
str_evstr_escape.txt
str_heredoc_interp.txt
str_interp_ternary_or_label.txt
str_lit_concat_bad_encodings.txt
str_newline_hash_line_number.txt
str_pct_Q_nested.txt
str_pct_nested_nested.txt
str_pct_q.txt
str_single_double_escaped_newline.txt
str_single_escaped_newline.txt
str_single_newline.txt
str_str.txt
str_str_str.txt
super_arg.txt
symbol_empty.txt
symbol_list.txt
symbols.txt
symbols_empty.txt
symbols_empty_space.txt
symbols_interp.txt
thingy.txt
uminus_float.txt
unary_minus.txt
unary_plus.txt
unary_plus_on_literal.txt
unary_tilde.txt
utf8_bom.txt
when_splat.txt
words_interp.txt
yield_arg.txt
yield_call_assocs.txt
yield_empty_parens.txt

README.rdoc

= ruby_parser

home :: https://github.com/seattlerb/ruby_parser
bugs :: https://github.com/seattlerb/ruby_parser/issues
rdoc :: http://docs.seattlerb.org/ruby_parser

== DESCRIPTION:

ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
racc--which does by default use a C extension). It outputs
s-expressions which can be manipulated and converted back to ruby via
the ruby2ruby gem.

As an example:

    def conditional1 arg1
      return 1 if arg1 == 0
      return 0
    end

becomes:

    s(:defn, :conditional1, s(:args, :arg1),
      s(:if,
        s(:call, s(:lvar, :arg1), :==, s(:lit, 0)),
        s(:return, s(:lit, 1)),
        nil),
      s(:return, s(:lit, 0)))

Tested against 801,039 files from the latest of all rubygems (as of 2013-05):

* 1.8 parser is at 99.9739% accuracy, 3.651 sigma
* 1.9 parser is at 99.9940% accuracy, 4.013 sigma
* 2.0 parser is at 99.9939% accuracy, 4.008 sigma
* 2.6 parser is at 99.9972% accuracy, 4.191 sigma
* 3.0 parser has a 100% parse rate.
  * Tested against 2,672,412 unique ruby files across 167k gems.
  * As do all the others now, basically.

== FEATURES/PROBLEMS:

* Pure ruby, no compiles.
* Includes preceding comment data for defn/defs/class/module nodes!
* Incredibly simple interface.
* Output is 100% equivalent to ParseTree.
  * Can utilize PT's SexpProcessor and UnifiedRuby for language processing.
* Known Issue: Speed is now pretty good, but can always improve:
  * RP parses a corpus of 3702 files in 125s (avg 108 Kb/s)
  * MRI+PT parsed the same in 67.38s (avg 200.89 Kb/s)
* Known Issue: Code is much better, but still has a long way to go.
* Known Issue: Totally awesome.
* Known Issue: line number values can be slightly off. Parsing LR sucks.

== SYNOPSIS:

  RubyParser.new.parse "1+1"
  # => s(:call, s(:lit, 1), :+, s(:lit, 1))

You can also use Ruby19Parser, Ruby18Parser, or RubyParser.for_current_ruby:

  RubyParser.for_current_ruby.parse "1+1"
  # => s(:call, s(:lit, 1), :+, s(:lit, 1))

== DEVELOPER NOTES:

To add a new version:

* New parser should be generated from lib/ruby[3]_parser.yy.
* Extend lib/ruby[3]_parser.yy with new class name.
* Add new version number to V2/V3 in Rakefile for rule creation.
* Add new `ruby_parse "x.y.z"` line to Rakefile for rake compare (line ~300).
* Require generated parser in lib/ruby_parser.rb.
* Add new V## = ::Ruby##Parser; end to ruby_parser.rb (bottom of file).
* Add empty TestRubyParserShared##Plus module and TestRubyParserV## to test/test_ruby_parser.rb.
* Extend Manifest.txt with generated file names.
* Add new version number to sexp_processor's pt_testcase.rb in all_versions

Until all of these are done, you won't have a clean test run.

== REQUIREMENTS:

* ruby. woot.
* sexp_processor for Sexp and SexpProcessor classes, and testing.
* racc full package for parser development (compiling .y to .rb).

== INSTALL:

* sudo gem install ruby_parser

== LICENSE:

(The MIT License)

Copyright (c) Ryan Davis, seattle.rb

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.