brakeman 5.1.1 → 5.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +22 -1
  3. data/README.md +1 -1
  4. data/bundle/load.rb +5 -5
  5. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/CHANGELOG.md +8 -0
  6. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/FAQ.md +0 -0
  7. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/Gemfile +0 -0
  8. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/MIT-LICENSE +0 -0
  9. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/README.md +19 -13
  10. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/REFERENCE.md +10 -3
  11. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/TODO +0 -0
  12. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/haml.gemspec +0 -0
  13. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/attribute_builder.rb +55 -0
  14. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/attribute_compiler.rb +4 -2
  15. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/attribute_parser.rb +0 -0
  16. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/buffer.rb +0 -56
  17. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/compiler.rb +0 -0
  18. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/engine.rb +0 -0
  19. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/error.rb +0 -0
  20. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/escapable.rb +0 -0
  21. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/exec.rb +0 -0
  22. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/filters.rb +0 -0
  23. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/generator.rb +0 -0
  24. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/action_view_extensions.rb +0 -0
  25. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/action_view_mods.rb +0 -0
  26. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/action_view_xss_mods.rb +0 -0
  27. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/safe_erubi_template.rb +0 -0
  28. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/safe_erubis_template.rb +0 -0
  29. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/xss_mods.rb +0 -0
  30. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers.rb +0 -0
  31. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/options.rb +0 -0
  32. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/parser.rb +0 -0
  33. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/plugin.rb +18 -1
  34. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/railtie.rb +5 -0
  35. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/sass_rails_filter.rb +0 -0
  36. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/template/options.rb +0 -0
  37. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/template.rb +0 -0
  38. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/temple_engine.rb +2 -1
  39. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/temple_line_counter.rb +0 -0
  40. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/util.rb +0 -0
  41. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/version.rb +1 -1
  42. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml.rb +0 -0
  43. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/yard/default/fulldoc/html/css/common.sass +0 -0
  44. data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/yard/default/layout/html/footer.erb +0 -0
  45. data/bundle/ruby/2.7.0/gems/{parallel-1.20.1 → parallel-1.21.0}/MIT-LICENSE.txt +0 -0
  46. data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel/processor_count.rb +45 -0
  47. data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel/version.rb +4 -0
  48. data/bundle/ruby/2.7.0/gems/{parallel-1.20.1 → parallel-1.21.0}/lib/parallel.rb +52 -43
  49. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/History.rdoc +88 -0
  50. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/Manifest.txt +3 -0
  51. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/README.rdoc +1 -0
  52. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/compare/normalize.rb +6 -1
  53. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/debugging.md +0 -0
  54. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/gauntlet.md +106 -0
  55. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/rp_extensions.rb +15 -36
  56. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/rp_stringscanner.rb +33 -0
  57. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby20_parser.rb +7128 -0
  58. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby20_parser.y +335 -252
  59. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby21_parser.rb +7182 -0
  60. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby21_parser.y +330 -249
  61. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby22_parser.rb +7228 -0
  62. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby22_parser.y +334 -251
  63. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby23_parser.rb +7237 -0
  64. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0/lib/ruby26_parser.y → ruby_parser-3.18.1/lib/ruby23_parser.y} +336 -276
  65. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby24_parser.rb +7268 -0
  66. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby24_parser.y +334 -251
  67. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby25_parser.rb +7268 -0
  68. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0/lib/ruby30_parser.y → ruby_parser-3.18.1/lib/ruby25_parser.y} +335 -304
  69. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby26_parser.rb +7287 -0
  70. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0/lib/ruby27_parser.y → ruby_parser-3.18.1/lib/ruby26_parser.y} +334 -288
  71. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby27_parser.rb +8517 -0
  72. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0/lib/ruby_parser.yy → ruby_parser-3.18.1/lib/ruby27_parser.y} +906 -380
  73. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby30_parser.rb +8751 -0
  74. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby30_parser.y +3472 -0
  75. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby3_parser.yy +3476 -0
  76. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby_lexer.rb +261 -609
  77. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby_lexer.rex +27 -20
  78. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby_lexer.rex.rb +59 -23
  79. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby_lexer_strings.rb +638 -0
  80. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby_parser.rb +0 -0
  81. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby_parser.yy +3487 -0
  82. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby_parser_extras.rb +296 -115
  83. data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/tools/munge.rb +34 -6
  84. data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/tools/ripper.rb +44 -0
  85. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/History.rdoc +15 -0
  86. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/Manifest.txt +0 -0
  87. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/README.rdoc +0 -0
  88. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/composite_sexp_processor.rb +0 -0
  89. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/pt_testcase.rb +7 -2
  90. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/sexp.rb +19 -9
  91. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/sexp_matcher.rb +0 -0
  92. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/sexp_processor.rb +1 -1
  93. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/strict_sexp.rb +25 -3
  94. data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/unique.rb +0 -0
  95. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/CHANGELOG.md +4 -0
  96. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/MIT-LICENSE.txt +0 -0
  97. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/README.md +1 -1
  98. data/bundle/ruby/2.7.0/gems/unicode-display_width-1.8.0/data/display_width.marshal.gz +0 -0
  99. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/lib/unicode/display_width/constants.rb +2 -2
  100. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/lib/unicode/display_width/index.rb +0 -0
  101. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/lib/unicode/display_width/no_string_ext.rb +0 -0
  102. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/lib/unicode/display_width/string_ext.rb +0 -0
  103. data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/lib/unicode/display_width.rb +0 -0
  104. data/lib/brakeman/app_tree.rb +1 -1
  105. data/lib/brakeman/checks/base_check.rb +10 -0
  106. data/lib/brakeman/checks/check_eol_rails.rb +23 -0
  107. data/lib/brakeman/checks/check_eol_ruby.rb +26 -0
  108. data/lib/brakeman/checks/check_json_parsing.rb +1 -1
  109. data/lib/brakeman/checks/check_sql.rb +3 -2
  110. data/lib/brakeman/checks/check_symbol_dos.rb +1 -1
  111. data/lib/brakeman/checks/eol_check.rb +47 -0
  112. data/lib/brakeman/options.rb +8 -0
  113. data/lib/brakeman/processors/alias_processor.rb +7 -1
  114. data/lib/brakeman/processors/gem_processor.rb +3 -0
  115. data/lib/brakeman/processors/haml_template_processor.rb +9 -0
  116. data/lib/brakeman/processors/lib/call_conversion_helper.rb +2 -0
  117. data/lib/brakeman/processors/lib/rails3_route_processor.rb +2 -0
  118. data/lib/brakeman/processors/model_processor.rb +1 -0
  119. data/lib/brakeman/report/ignore/config.rb +1 -1
  120. data/lib/brakeman/report/report_csv.rb +1 -1
  121. data/lib/brakeman/report/report_sarif.rb +1 -1
  122. data/lib/brakeman/report/report_text.rb +1 -1
  123. data/lib/brakeman/scanner.rb +15 -13
  124. data/lib/brakeman/tracker/config.rb +8 -1
  125. data/lib/brakeman/version.rb +1 -1
  126. data/lib/brakeman/warning_codes.rb +4 -0
  127. data/lib/brakeman.rb +2 -2
  128. data/lib/ruby_parser/bm_sexp.rb +11 -1
  129. metadata +105 -99
  130. data/bundle/ruby/2.7.0/gems/parallel-1.20.1/lib/parallel/processor_count.rb +0 -42
  131. data/bundle/ruby/2.7.0/gems/parallel-1.20.1/lib/parallel/version.rb +0 -3
  132. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/rp_stringscanner.rb +0 -64
  133. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby20_parser.rb +0 -7075
  134. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby21_parser.rb +0 -7148
  135. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby22_parser.rb +0 -7185
  136. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby23_parser.rb +0 -7199
  137. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby23_parser.y +0 -2643
  138. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby24_parser.rb +0 -7219
  139. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby25_parser.rb +0 -7218
  140. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby25_parser.y +0 -2651
  141. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby26_parser.rb +0 -7240
  142. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby27_parser.rb +0 -7358
  143. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby30_parser.rb +0 -7358
  144. data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/tools/ripper.rb +0 -39
  145. data/bundle/ruby/2.7.0/gems/unicode-display_width-1.7.0/data/display_width.marshal.gz +0 -0
@@ -1,2643 +0,0 @@
1
- # -*- racc -*-
2
-
3
- class Ruby23Parser
4
-
5
- token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
6
- kTHEN kELSIF kELSE kCASE kWHEN kWHILE kUNTIL kFOR kBREAK kNEXT
7
- kREDO kRETRY kIN kDO kDO_COND kDO_BLOCK kDO_LAMBDA kRETURN kYIELD kSUPER
8
- kSELF kNIL kTRUE kFALSE kAND kOR kNOT kIF_MOD kUNLESS_MOD kWHILE_MOD
9
- kUNTIL_MOD kRESCUE_MOD kALIAS kDEFINED klBEGIN klEND k__LINE__
10
- k__FILE__ k__ENCODING__ tIDENTIFIER tFID tGVAR tIVAR tCONSTANT
11
- tLABEL tCVAR tNTH_REF tBACK_REF tSTRING_CONTENT tINTEGER tFLOAT
12
- tREGEXP_END tUPLUS tUMINUS tUMINUS_NUM tPOW tCMP tEQ tEQQ tNEQ
13
- tGEQ tLEQ tANDOP tOROP tMATCH tNMATCH tDOT tDOT2 tDOT3 tAREF
14
- tASET tLSHFT tRSHFT tCOLON2 tCOLON3 tOP_ASGN tASSOC tLPAREN
15
- tLPAREN2 tRPAREN tLPAREN_ARG tLBRACK tLBRACK2 tRBRACK tLBRACE
16
- tLBRACE_ARG tSTAR tSTAR2 tAMPER tAMPER2 tTILDE tPERCENT tDIVIDE
17
- tPLUS tMINUS tLT tGT tPIPE tBANG tCARET tLCURLY tRCURLY
18
- tBACK_REF2 tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG
19
- tWORDS_BEG tQWORDS_BEG tSTRING_DBEG tSTRING_DVAR tSTRING_END
20
- tSTRING tSYMBOL tNL tEH tCOLON tCOMMA tSPACE tSEMI tLAMBDA
21
- tLAMBEG tDSTAR tCHAR tSYMBOLS_BEG tQSYMBOLS_BEG tSTRING_DEND tUBANG
22
- tRATIONAL tIMAGINARY
23
- tLABEL_END
24
- tLONELY
25
-
26
- preclow
27
- nonassoc tLOWEST
28
- nonassoc tLBRACE_ARG
29
- nonassoc kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
30
- left kOR kAND
31
- right kNOT
32
- nonassoc kDEFINED
33
- right tEQL tOP_ASGN
34
- left kRESCUE_MOD
35
- right tEH tCOLON
36
- nonassoc tDOT2 tDOT3 tBDOT2 tBDOT3
37
- left tOROP
38
- left tANDOP
39
- nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
40
- left tGT tGEQ tLT tLEQ
41
- left tPIPE tCARET
42
- left tAMPER2
43
- left tLSHFT tRSHFT
44
- left tPLUS tMINUS
45
- left tSTAR2 tDIVIDE tPERCENT # TODO: tSTAR2 -> tMULT
46
- right tUMINUS_NUM tUMINUS
47
- right tPOW
48
- right tBANG tTILDE tUPLUS
49
- prechigh
50
-
51
- rule
52
-
53
- program: {
54
- self.lexer.lex_state = EXPR_BEG
55
- }
56
- top_compstmt
57
- {
58
- result = new_compstmt val
59
-
60
- lexer.cond.pop # local_pop
61
- lexer.cmdarg.pop
62
- }
63
-
64
- top_compstmt: top_stmts opt_terms
65
- {
66
- stmt, _ = val
67
- result = stmt
68
- }
69
-
70
- top_stmts: none
71
- | top_stmt
72
- | top_stmts terms top_stmt
73
- {
74
- result = self.block_append val[0], val[2]
75
- }
76
- | error top_stmt
77
-
78
- top_stmt: stmt
79
- | klBEGIN
80
- {
81
- if (self.in_def || self.in_single > 0) then
82
- debug20 1
83
- yyerror "BEGIN in method"
84
- end
85
- self.env.extend
86
- }
87
- begin_block
88
- {
89
- (_, lineno), _, iter = val
90
- iter.line lineno
91
-
92
- (_, preexe,) = iter
93
- preexe.line lineno
94
-
95
- result = iter
96
- }
97
-
98
- begin_block: tLCURLY { result = lexer.lineno } top_compstmt tRCURLY
99
- {
100
- _, line, stmt, _ = val
101
- result = new_iter s(:preexe).line(line), 0, stmt
102
- }
103
-
104
- bodystmt: compstmt opt_rescue k_else
105
- {
106
- res = _values[-2]
107
- yyerror "else without rescue is useless" unless res
108
- }
109
- compstmt
110
- opt_ensure
111
- {
112
- body, resc, _, _, els, ens = val
113
-
114
- result = new_body [body, resc, els, ens]
115
- }
116
- | compstmt opt_rescue opt_ensure
117
- {
118
- body, resc, ens = val
119
-
120
- result = new_body [body, resc, nil, ens]
121
- }
122
-
123
- compstmt: stmts opt_terms
124
- {
125
- result = new_compstmt val
126
- }
127
-
128
- stmts: none
129
- | stmt_or_begin # TODO: newline_node ?
130
- | stmts terms stmt_or_begin
131
- {
132
- result = self.block_append val[0], val[2]
133
- }
134
- | error stmt
135
- {
136
- result = val[1]
137
- debug20 2, val, result
138
- }
139
-
140
- stmt_or_begin: stmt
141
- | klBEGIN
142
- {
143
- yyerror "BEGIN is permitted only at toplevel"
144
- }
145
-
146
- stmt: kALIAS fitem
147
- {
148
- lexer.lex_state = EXPR_FNAME
149
- }
150
- fitem
151
- {
152
- (_, line), lhs, _, rhs = val
153
- result = s(:alias, lhs, rhs).line(line).line line
154
- }
155
- | kALIAS tGVAR tGVAR
156
- {
157
- (_, line), lhs, rhs = val
158
- result = s(:valias, lhs.to_sym, rhs.to_sym).line line
159
- }
160
- | kALIAS tGVAR tBACK_REF
161
- {
162
- (_, line), lhs, rhs = val
163
- result = s(:valias, lhs.to_sym, :"$#{rhs}").line line
164
- }
165
- | kALIAS tGVAR tNTH_REF
166
- {
167
- yyerror "can't make alias for the number variables"
168
- }
169
- | kUNDEF undef_list
170
- {
171
- result = val[1]
172
- }
173
- | stmt kIF_MOD expr_value
174
- {
175
- t, _, c = val
176
- result = new_if c, t, nil
177
- }
178
- | stmt kUNLESS_MOD expr_value
179
- {
180
- f, _, c = val
181
- result = new_if c, nil, f
182
- }
183
- | stmt kWHILE_MOD expr_value
184
- {
185
- e, _, c = val
186
- result = new_while e, c, true
187
- }
188
- | stmt kUNTIL_MOD expr_value
189
- {
190
- e, _, c = val
191
- result = new_until e, c, true
192
- }
193
- | stmt kRESCUE_MOD stmt
194
- {
195
- body, _, resbody = val
196
-
197
- resbody = new_resbody s(:array).line(resbody.line), resbody
198
- result = new_rescue body, resbody
199
- }
200
- | klEND tLCURLY compstmt tRCURLY
201
- {
202
- (_, line), _, stmt, _ = val
203
-
204
- if (self.in_def || self.in_single > 0) then
205
- debug20 3
206
- yyerror "END in method; use at_exit"
207
- end
208
-
209
- result = new_iter s(:postexe).line(line), 0, stmt
210
- }
211
- | command_asgn
212
- | mlhs tEQL command_call
213
- {
214
- result = new_masgn val[0], val[2], :wrap
215
- }
216
- | lhs tEQL mrhs
217
- {
218
- lhs, _, rhs = val
219
- result = new_assign lhs, s(:svalue, rhs).line(rhs.line)
220
- }
221
- | mlhs tEQL mrhs_arg
222
- {
223
- result = new_masgn val[0], val[2]
224
- }
225
- | expr
226
-
227
- command_asgn: lhs tEQL command_rhs
228
- {
229
- result = new_assign val[0], val[2]
230
- }
231
- # | lhs tEQL command_asgn
232
- # {
233
- # result = new_assign val[0], val[2]
234
- # }
235
- | var_lhs tOP_ASGN command_rhs
236
- {
237
- result = new_op_asgn val
238
- }
239
- | primary_value tLBRACK2 opt_call_args rbracket tOP_ASGN command_rhs
240
- {
241
- result = new_op_asgn1 val
242
- }
243
- | primary_value call_op tIDENTIFIER tOP_ASGN command_rhs
244
- {
245
- prim, _, id, opasgn, rhs = val
246
- result = s(:op_asgn, prim, rhs, id.to_sym, opasgn.to_sym)
247
- if val[1] == '&.'
248
- result.sexp_type = :safe_op_asgn
249
- end
250
- result.line = val[0].line
251
- }
252
- | primary_value call_op tCONSTANT tOP_ASGN command_rhs
253
- {
254
- result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
255
- if val[1] == '&.'
256
- result.sexp_type = :safe_op_asgn
257
- end
258
- result.line = val[0].line
259
- }
260
- | primary_value tCOLON2 tCONSTANT tOP_ASGN command_rhs
261
- {
262
- lhs1, _, lhs2, op, rhs = val
263
-
264
- result = s(:op_asgn, lhs1, rhs, lhs2.to_sym, op.to_sym)
265
- }
266
- | primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs
267
- {
268
- lhs1, _, lhs2, op, rhs = val
269
-
270
- result = s(:op_asgn, lhs1, rhs, lhs2.to_sym, op.to_sym)
271
- }
272
- | backref tOP_ASGN command_rhs
273
- {
274
- self.backref_assign_error val[0]
275
- }
276
-
277
- command_rhs: command_call =tOP_ASGN
278
- {
279
- expr, = val
280
- result = value_expr expr
281
- }
282
- | command_asgn
283
-
284
- expr: command_call
285
- | expr kAND expr
286
- {
287
- lhs, _, rhs = val
288
- result = logical_op :and, lhs, rhs
289
- }
290
- | expr kOR expr
291
- {
292
- lhs, _, rhs = val
293
- result = logical_op :or, lhs, rhs
294
- }
295
- | kNOT opt_nl expr
296
- {
297
- (_, line), _, expr = val
298
- result = new_call(expr, :"!").line line
299
- # REFACTOR: call_uni_op
300
- }
301
- | tBANG command_call
302
- {
303
- _, cmd = val
304
- result = new_call(cmd, :"!").line cmd.line
305
- # TODO: fix line number to tBANG... but causes BAD shift/reduce conflict
306
- # REFACTOR: call_uni_op -- see parse26.y
307
- }
308
- | arg
309
-
310
- expr_value: expr
311
- {
312
- result = value_expr(val[0])
313
- }
314
-
315
- expr_value_do: {
316
- lexer.cond.push true
317
- }
318
- expr_value do
319
- {
320
- lexer.cond.pop
321
- }
322
- {
323
- _, expr, _, _ = val
324
- result = expr
325
- }
326
-
327
- command_call: command
328
- | block_command
329
-
330
- block_command: block_call
331
- | block_call call_op2 operation2 command_args
332
- {
333
- blk, _, msg, args = val
334
- result = new_call(blk, msg.to_sym, args).line blk.line
335
- }
336
-
337
- cmd_brace_block: tLBRACE_ARG
338
- {
339
- # self.env.extend(:dynamic)
340
- result = self.lexer.lineno
341
- }
342
- brace_body tRCURLY
343
- {
344
- _, line, body, _ = val
345
-
346
- result = body
347
- result.line = line
348
-
349
- # self.env.unextend
350
- }
351
-
352
- fcall: operation
353
- {
354
- msg, = val
355
- result = new_call(nil, msg.to_sym).line lexer.lineno
356
- }
357
-
358
- command: fcall command_args =tLOWEST
359
- {
360
- call, args = val
361
- result = call.concat args.sexp_body
362
- }
363
- | fcall command_args cmd_brace_block
364
- {
365
- call, args, block = val
366
-
367
- result = call.concat args.sexp_body
368
-
369
- if block then
370
- block_dup_check result, block
371
-
372
- result, operation = block, result
373
- result.insert 1, operation
374
- end
375
- }
376
- | primary_value call_op operation2 command_args =tLOWEST
377
- {
378
- lhs, callop, op, args = val
379
- result = new_call lhs, op.to_sym, args, callop
380
- }
381
- | primary_value call_op operation2 command_args cmd_brace_block
382
- {
383
- recv, _, msg, args, block = val
384
- call = new_call recv, msg.to_sym, args, val[1]
385
-
386
- block_dup_check call, block
387
-
388
- block.insert 1, call
389
- result = block
390
- }
391
- | primary_value tCOLON2 operation2 command_args =tLOWEST
392
- {
393
- result = new_call val[0], val[2].to_sym, val[3]
394
- }
395
- | primary_value tCOLON2 operation2 command_args cmd_brace_block
396
- {
397
- recv, _, msg, args, block = val
398
- call = new_call recv, msg.to_sym, args
399
-
400
- block_dup_check call, block
401
-
402
- block.insert 1, call
403
- result = block
404
- }
405
- | kSUPER command_args
406
- {
407
- result = new_super val[1]
408
- }
409
- | kYIELD command_args
410
- {
411
- (_, line), args = val
412
- result = new_yield args
413
- result.line line # TODO: push to new_yield
414
- }
415
- | k_return call_args
416
- {
417
- line = val[0].last
418
- result = s(:return, ret_args(val[1])).line(line)
419
- }
420
- | kBREAK call_args
421
- {
422
- (_, line), args = val
423
- result = s(:break, ret_args(args)).line line
424
- }
425
- | kNEXT call_args
426
- {
427
- line = val[0].last
428
- result = s(:next, ret_args(val[1])).line(line)
429
- }
430
-
431
- mlhs: mlhs_basic
432
- | tLPAREN mlhs_inner rparen
433
- {
434
- result = val[1]
435
- }
436
-
437
- mlhs_inner: mlhs_basic
438
- | tLPAREN mlhs_inner rparen
439
- {
440
- _, arg, _ = val
441
- l = arg.line
442
-
443
- result = s(:masgn, s(:array, arg).line(l)).line l
444
- }
445
-
446
- mlhs_basic: mlhs_head
447
- {
448
- head, = val
449
- result = s(:masgn, head).line head.line
450
- }
451
- | mlhs_head mlhs_item
452
- {
453
- lhs, rhs = val
454
- result = s(:masgn, lhs << rhs.compact).line lhs.line
455
- }
456
- | mlhs_head tSTAR mlhs_node
457
- {
458
- head, _, tail = val
459
- head << s(:splat, tail).line(tail.line)
460
- result = s(:masgn, head).line head.line
461
- }
462
- | mlhs_head tSTAR mlhs_node tCOMMA mlhs_post
463
- {
464
- ary1, _, splat, _, ary2 = val
465
-
466
- result = list_append ary1, s(:splat, splat).line(splat.line)
467
- result.concat ary2.sexp_body
468
- result = s(:masgn, result).line result.line
469
- }
470
- | mlhs_head tSTAR
471
- {
472
- head, _ = val
473
- l = head.line
474
- result = s(:masgn, head << s(:splat).line(l)).line l
475
- }
476
- | mlhs_head tSTAR tCOMMA mlhs_post
477
- {
478
- head, _, _, post = val
479
- ary = list_append head, s(:splat).line(head.line)
480
- ary.concat post.sexp_body
481
- result = s(:masgn, ary).line ary.line
482
- }
483
- | tSTAR mlhs_node
484
- {
485
- _, node = val
486
- l = node.line
487
- splat = s(:splat, node).line l
488
- ary = s(:array, splat).line l
489
- result = s(:masgn, ary).line l
490
- }
491
- | tSTAR mlhs_node tCOMMA mlhs_post
492
- {
493
- _, node, _, post = val
494
-
495
- splat = s(:splat, node).line node.line
496
- ary = s(:array, splat).line splat.line
497
- ary.concat post.sexp_body
498
- result = s(:masgn, ary).line ary.line
499
- }
500
- | tSTAR
501
- {
502
- l = lexer.lineno
503
- result = s(:masgn, s(:array, s(:splat).line(l)).line(l)).line l
504
- }
505
- | tSTAR tCOMMA mlhs_post
506
- {
507
- _, _, post = val
508
- l = post.line
509
-
510
- splat = s(:splat).line l
511
- ary = s(:array, splat, *post.sexp_body).line l
512
- result = s(:masgn, ary).line l
513
- }
514
-
515
- mlhs_item: mlhs_node
516
- | tLPAREN mlhs_inner rparen
517
- {
518
- result = val[1]
519
- }
520
-
521
- mlhs_head: mlhs_item tCOMMA
522
- {
523
- lhs, _ = val
524
- result = s(:array, lhs).line lhs.line
525
- }
526
- | mlhs_head mlhs_item tCOMMA
527
- {
528
- result = val[0] << val[1].compact
529
- }
530
-
531
- mlhs_post: mlhs_item
532
- {
533
- item, = val
534
- result = s(:array, item).line item.line
535
- }
536
- | mlhs_post tCOMMA mlhs_item
537
- {
538
- result = list_append val[0], val[2]
539
- }
540
-
541
- mlhs_node: user_variable
542
- {
543
- result = self.assignable val[0]
544
- }
545
- | keyword_variable
546
- {
547
- result = self.assignable val[0]
548
- }
549
- | primary_value tLBRACK2 opt_call_args rbracket
550
- {
551
- result = self.aryset val[0], val[2]
552
- }
553
- | primary_value call_op tIDENTIFIER
554
- {
555
- result = new_attrasgn val[0], val[2], val[1]
556
- }
557
- | primary_value tCOLON2 tIDENTIFIER
558
- {
559
- recv, _, id = val
560
- result = new_attrasgn recv, id
561
- }
562
- | primary_value call_op tCONSTANT
563
- {
564
- result = new_attrasgn val[0], val[2], val[1]
565
- }
566
- | primary_value tCOLON2 tCONSTANT
567
- {
568
- if (self.in_def || self.in_single > 0) then
569
- debug20 7
570
- yyerror "dynamic constant assignment"
571
- end
572
-
573
- expr, _, id = val
574
- l = expr.line
575
-
576
- result = s(:const, s(:colon2, expr, id.to_sym).line(l), nil).line l
577
- }
578
- | tCOLON3 tCONSTANT
579
- {
580
- if (self.in_def || self.in_single > 0) then
581
- debug20 8
582
- yyerror "dynamic constant assignment"
583
- end
584
-
585
- _, id = val
586
- l = lexer.lineno
587
-
588
- result = s(:const, nil, s(:colon3, id.to_sym).line(l)).line l
589
- }
590
- | backref
591
- {
592
- self.backref_assign_error val[0]
593
- }
594
-
595
- lhs: user_variable
596
- {
597
- line = lexer.lineno
598
- result = self.assignable val[0]
599
- result.line = line
600
- }
601
- | keyword_variable
602
- {
603
- line = lexer.lineno
604
- result = self.assignable val[0]
605
- result.line = line
606
- debug20 9, val, result
607
- }
608
- | primary_value tLBRACK2 opt_call_args rbracket
609
- {
610
- lhs, _, args, _ = val
611
- result = self.aryset lhs, args
612
- }
613
- | primary_value call_op tIDENTIFIER # REFACTOR
614
- {
615
- lhs, op, id = val
616
- result = new_attrasgn lhs, id, op
617
- }
618
- | primary_value tCOLON2 tIDENTIFIER
619
- {
620
- lhs, _, id = val
621
- result = new_attrasgn lhs, id
622
- }
623
- | primary_value call_op tCONSTANT # REFACTOR?
624
- {
625
- result = new_attrasgn val[0], val[2], val[1]
626
- }
627
- | primary_value tCOLON2 tCONSTANT
628
- {
629
- expr, _, id = val
630
-
631
- if (self.in_def || self.in_single > 0) then
632
- debug20 10
633
- yyerror "dynamic constant assignment"
634
- end
635
-
636
- l = expr.line
637
- result = s(:const, s(:colon2, expr, id.to_sym).line(l)).line l
638
- }
639
- | tCOLON3 tCONSTANT
640
- {
641
- _, id = val
642
-
643
- if (self.in_def || self.in_single > 0) then
644
- debug20 11
645
- yyerror "dynamic constant assignment"
646
- end
647
-
648
- l = lexer.lineno
649
- result = s(:const, s(:colon3, id.to_sym).line(l)).line l
650
- }
651
- | backref
652
- {
653
- self.backref_assign_error val[0]
654
- }
655
-
656
- cname: tIDENTIFIER
657
- {
658
- yyerror "class/module name must be CONSTANT"
659
- }
660
- | tCONSTANT
661
-
662
- cpath: tCOLON3 cname
663
- {
664
- _, name = val
665
- result = s(:colon3, name.to_sym).line lexer.lineno
666
- }
667
- | cname
668
- {
669
- result = val[0].to_sym
670
- }
671
- | primary_value tCOLON2 cname
672
- {
673
- pval, _, name = val
674
-
675
- result = s(:colon2, pval, name.to_sym)
676
- result.line pval.line
677
- }
678
-
679
- fname: tIDENTIFIER | tCONSTANT | tFID
680
- | op
681
- {
682
- lexer.lex_state = EXPR_END
683
- result = val[0]
684
- }
685
-
686
- | reswords
687
- {
688
- (sym, _line), = val
689
- lexer.lex_state = EXPR_END
690
- result = sym
691
- }
692
-
693
- fsym: fname | symbol
694
-
695
- fitem: fsym
696
- {
697
- id, = val
698
- result = s(:lit, id.to_sym).line lexer.lineno
699
- }
700
- | dsym
701
-
702
- undef_list: fitem
703
- {
704
- result = new_undef val[0]
705
- }
706
- |
707
- undef_list tCOMMA
708
- {
709
- lexer.lex_state = EXPR_FNAME
710
- }
711
- fitem
712
- {
713
- result = new_undef val[0], val[3]
714
- }
715
-
716
- op: tPIPE | tCARET | tAMPER2 | tCMP | tEQ | tEQQ
717
- | tMATCH | tNMATCH | tGT | tGEQ | tLT | tLEQ
718
- | tNEQ | tLSHFT | tRSHFT | tPLUS | tMINUS | tSTAR2
719
- | tSTAR | tDIVIDE | tPERCENT | tPOW | tDSTAR | tBANG | tTILDE
720
- | tUPLUS | tUMINUS | tAREF | tASET | tBACK_REF2
721
- # TODO: tUBANG dead?
722
- | tUBANG
723
-
724
- reswords: k__LINE__ | k__FILE__ | k__ENCODING__ | klBEGIN | klEND
725
- | kALIAS | kAND | kBEGIN | kBREAK | kCASE
726
- | kCLASS | kDEF | kDEFINED | kDO | kELSE
727
- | kELSIF | kEND | kENSURE | kFALSE | kFOR
728
- | kIN | kMODULE | kNEXT | kNIL | kNOT
729
- | kOR | kREDO | kRESCUE | kRETRY | kRETURN
730
- | kSELF | kSUPER | kTHEN | kTRUE | kUNDEF
731
- | kWHEN | kYIELD | kIF | kUNLESS | kWHILE
732
- | kUNTIL
733
-
734
- arg: lhs tEQL arg_rhs
735
- {
736
- result = new_assign val[0], val[2]
737
- }
738
- | var_lhs tOP_ASGN arg_rhs
739
- {
740
- result = new_op_asgn val
741
- }
742
- | primary_value tLBRACK2 opt_call_args rbracket tOP_ASGN arg_rhs
743
- {
744
- result = new_op_asgn1 val
745
- }
746
- | primary_value call_op tIDENTIFIER tOP_ASGN arg_rhs
747
- {
748
- result = new_op_asgn2 val
749
- }
750
- | primary_value call_op tCONSTANT tOP_ASGN arg_rhs
751
- {
752
- result = new_op_asgn2 val
753
- }
754
- | primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
755
- {
756
- lhs, _, id, op, rhs = val
757
-
758
- result = s(:op_asgn, lhs, rhs, id.to_sym, op.to_sym).line lhs.line
759
- }
760
- | primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
761
- {
762
- lhs1, _, lhs2, op, rhs = val
763
-
764
- lhs = s(:colon2, lhs1, lhs2.to_sym).line lhs1.line
765
- result = new_const_op_asgn [lhs, op, rhs]
766
- }
767
- | tCOLON3 tCONSTANT
768
- {
769
- result = self.lexer.lineno
770
- }
771
- tOP_ASGN arg_rhs
772
- {
773
- _, lhs, line, op, rhs = val
774
-
775
- lhs = s(:colon3, lhs.to_sym).line line
776
- result = new_const_op_asgn [lhs, op, rhs]
777
- }
778
- | backref tOP_ASGN arg_rhs
779
- {
780
- # TODO: lhs = var_field val[0]
781
- asgn = new_op_asgn val
782
- result = self.backref_assign_error asgn
783
- }
784
- | arg tDOT2 arg
785
- {
786
- v1, v2 = val[0], val[2]
787
- if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
788
- result = s(:lit, (v1.last)..(v2.last)).line v1.line
789
- else
790
- result = s(:dot2, v1, v2).line v1.line
791
- end
792
- }
793
- | arg tDOT3 arg
794
- {
795
- v1, v2 = val[0], val[2]
796
- if v1.node_type == :lit and v2.node_type == :lit and Integer === v1.last and Integer === v2.last then
797
- result = s(:lit, (v1.last)...(v2.last)).line v1.line
798
- else
799
- result = s(:dot3, v1, v2).line v1.line
800
- end
801
- }
802
-
803
-
804
- | arg tPLUS arg
805
- {
806
- result = new_call val[0], :+, argl(val[2])
807
- }
808
- | arg tMINUS arg
809
- {
810
- result = new_call val[0], :-, argl(val[2])
811
- }
812
- | arg tSTAR2 arg # TODO: rename
813
- {
814
- result = new_call val[0], :*, argl(val[2])
815
- }
816
- | arg tDIVIDE arg
817
- {
818
- result = new_call val[0], :"/", argl(val[2])
819
- }
820
- | arg tPERCENT arg
821
- {
822
- result = new_call val[0], :"%", argl(val[2])
823
- }
824
- | arg tPOW arg
825
- {
826
- result = new_call val[0], :**, argl(val[2])
827
- }
828
- | tUMINUS_NUM simple_numeric tPOW arg
829
- {
830
- lit = s(:lit, val[1]).line lexer.lineno
831
- result = new_call(new_call(lit, :"**", argl(val[3])), :"-@")
832
-
833
- }
834
- | tUPLUS arg
835
- {
836
- result = new_call val[1], :"+@"
837
- }
838
- | tUMINUS arg
839
- {
840
- result = new_call val[1], :"-@"
841
- }
842
- | arg tPIPE arg
843
- {
844
- result = new_call val[0], :"|", argl(val[2])
845
- }
846
- | arg tCARET arg
847
- {
848
- result = new_call val[0], :"^", argl(val[2])
849
- }
850
- | arg tAMPER2 arg
851
- {
852
- result = new_call val[0], :"&", argl(val[2])
853
- }
854
- | arg tCMP arg
855
- {
856
- result = new_call val[0], :"<=>", argl(val[2])
857
- }
858
- | rel_expr =tCMP
859
- | arg tEQ arg
860
- {
861
- result = new_call val[0], :"==", argl(val[2])
862
- }
863
- | arg tEQQ arg
864
- {
865
- result = new_call val[0], :"===", argl(val[2])
866
- }
867
- | arg tNEQ arg
868
- {
869
- result = new_call val[0], :"!=", argl(val[2])
870
- }
871
- | arg tMATCH arg
872
- {
873
- lhs, _, rhs = val
874
- result = new_match lhs, rhs
875
- }
876
- | arg tNMATCH arg
877
- {
878
- lhs, _, rhs = val
879
- result = s(:not, new_match(lhs, rhs)).line lhs.line
880
- }
881
- | tBANG arg
882
- {
883
- _, arg = val
884
- result = new_call arg, :"!"
885
- result.line arg.line
886
- }
887
- | tTILDE arg
888
- {
889
- result = new_call value_expr(val[1]), :"~"
890
- }
891
- | arg tLSHFT arg
892
- {
893
- val[0] = value_expr val[0]
894
- val[2] = value_expr val[2]
895
- result = new_call val[0], :"\<\<", argl(val[2])
896
- }
897
- | arg tRSHFT arg
898
- {
899
- val[0] = value_expr val[0]
900
- val[2] = value_expr val[2]
901
- result = new_call val[0], :">>", argl(val[2])
902
- }
903
- | arg tANDOP arg
904
- {
905
- result = logical_op :and, val[0], val[2]
906
- }
907
- | arg tOROP arg
908
- {
909
- result = logical_op :or, val[0], val[2]
910
- }
911
- | kDEFINED opt_nl arg
912
- {
913
- (_, line), _, arg = val
914
- result = s(:defined, arg).line line
915
- }
916
- | arg tEH arg opt_nl tCOLON arg
917
- {
918
- c, _, t, _, _, f = val
919
- result = s(:if, c, t, f).line c.line
920
- }
921
- | primary
922
-
923
- relop: tGT
924
- | tLT
925
- | tGEQ
926
- | tLEQ
927
-
928
- rel_expr: arg relop arg =tGT
929
- {
930
- lhs, op, rhs = val
931
- result = new_call lhs, op.to_sym, argl(rhs)
932
- }
933
- | rel_expr relop arg =tGT
934
- {
935
- lhs, op, rhs = val
936
- warn "comparison '%s' after comparison", op
937
- result = new_call lhs, op.to_sym, argl(rhs)
938
- }
939
-
940
- arg_value: arg
941
- {
942
- result = value_expr(val[0])
943
- }
944
-
945
- aref_args: none
946
- | args trailer
947
- {
948
- result = args [val[0]]
949
- }
950
- | args tCOMMA assocs trailer
951
- {
952
- result = args [val[0], array_to_hash(val[2])]
953
- }
954
- | assocs trailer
955
- {
956
- result = args [array_to_hash(val[0])]
957
- }
958
-
959
- arg_rhs: arg =tOP_ASGN
960
- | arg kRESCUE_MOD arg
961
- {
962
- body, (_, line), resbody = val
963
- body = value_expr body
964
- resbody = remove_begin resbody
965
-
966
- ary = s(:array).line line
967
- result = new_rescue(body, new_resbody(ary, resbody))
968
- }
969
-
970
- paren_args: tLPAREN2 opt_call_args rparen
971
- {
972
- _, args, _ = val
973
- result = args
974
- }
975
-
976
- opt_paren_args: none
977
- | paren_args
978
-
979
- opt_call_args: none
980
- | call_args
981
- | args tCOMMA
982
- {
983
- result = args val
984
- }
985
- | args tCOMMA assocs tCOMMA
986
- {
987
- result = args [val[0], array_to_hash(val[2])]
988
- }
989
- | assocs tCOMMA
990
- {
991
- result = args [array_to_hash(val[0])]
992
- }
993
-
994
- call_args: command
995
- {
996
- warning "parenthesize argument(s) for future version"
997
- result = call_args val
998
- }
999
- | args opt_block_arg
1000
- {
1001
- result = call_args val
1002
- }
1003
- | assocs opt_block_arg
1004
- {
1005
- result = call_args [array_to_hash(val[0]), val[1]]
1006
- }
1007
- | args tCOMMA assocs opt_block_arg
1008
- {
1009
- result = call_args [val[0], array_to_hash(val[2]), val[3]]
1010
- }
1011
- | block_arg
1012
- {
1013
- result = call_args val
1014
- }
1015
-
1016
- command_args: {
1017
- # parse26.y line 2200
1018
-
1019
- # If call_args starts with a open paren '(' or
1020
- # '[', look-ahead reading of the letters calls
1021
- # CMDARG_PUSH(0), but the push must be done
1022
- # after CMDARG_PUSH(1). So this code makes them
1023
- # consistent by first cancelling the premature
1024
- # CMDARG_PUSH(0), doing CMDARG_PUSH(1), and
1025
- # finally redoing CMDARG_PUSH(0).
1026
-
1027
- result = yychar = self.last_token_type.first
1028
- lookahead = [:tLPAREN, :tLPAREN_ARG, :tLPAREN2, :tLBRACK, :tLBRACK2].include?(yychar)
1029
- lexer.cmdarg.pop if lookahead
1030
- lexer.cmdarg.push true
1031
- lexer.cmdarg.push false if lookahead
1032
- }
1033
- call_args
1034
- {
1035
- yychar, args = val
1036
-
1037
- # call_args can be followed by tLBRACE_ARG (that
1038
- # does CMDARG_PUSH(0) in the lexer) but the push
1039
- # must be done after CMDARG_POP() in the parser.
1040
- # So this code does CMDARG_POP() to pop 0 pushed
1041
- # by tLBRACE_ARG, CMDARG_POP() to pop 1 pushed
1042
- # by command_args, and CMDARG_PUSH(0) to restore
1043
- # back the flag set by tLBRACE_ARG.
1044
-
1045
- lookahead = [:tLBRACE_ARG].include?(yychar)
1046
- lexer.cmdarg.pop if lookahead
1047
- lexer.cmdarg.pop
1048
- lexer.cmdarg.push false if lookahead
1049
- result = args
1050
- }
1051
-
1052
- block_arg: tAMPER arg_value
1053
- {
1054
- _, arg = val
1055
- result = s(:block_pass, arg).line arg.line
1056
- }
1057
-
1058
- opt_block_arg: tCOMMA block_arg
1059
- {
1060
- result = val[1]
1061
- }
1062
- | none
1063
-
1064
- args: arg_value
1065
- {
1066
- arg, = val
1067
- lineno = arg.line || lexer.lineno # HACK
1068
-
1069
- result = s(:array, arg).line lineno
1070
- }
1071
- | tSTAR arg_value
1072
- {
1073
- _, arg = val
1074
- result = s(:array, s(:splat, arg).line(arg.line)).line arg.line
1075
- }
1076
- | args tCOMMA arg_value
1077
- {
1078
- args, _, id = val
1079
- result = self.list_append args, id
1080
- }
1081
- | args tCOMMA tSTAR arg_value
1082
- {
1083
- # TODO: the line number from tSTAR has been dropped
1084
- args, _, _, id = val
1085
- line = lexer.lineno
1086
- result = self.list_append args, s(:splat, id).line(line)
1087
- }
1088
-
1089
- mrhs_arg: mrhs
1090
- {
1091
- result = new_masgn_arg val[0]
1092
- }
1093
- | arg_value
1094
- {
1095
- result = new_masgn_arg val[0], :wrap
1096
- }
1097
-
1098
- mrhs: args tCOMMA arg_value
1099
- {
1100
- result = val[0] << val[2]
1101
- }
1102
- | args tCOMMA tSTAR arg_value
1103
- {
1104
- # TODO: make all tXXXX terminals include lexer.lineno
1105
- arg, _, _, splat = val
1106
- result = self.arg_concat arg, splat
1107
- }
1108
- | tSTAR arg_value
1109
- {
1110
- _, arg = val
1111
- result = s(:splat, arg).line arg.line
1112
- }
1113
-
1114
- primary: literal
1115
- | strings
1116
- | xstring
1117
- | regexp
1118
- | words
1119
- | qwords
1120
- | symbols
1121
- | qsymbols
1122
- | var_ref
1123
- | backref
1124
- | tFID
1125
- {
1126
- msg, = val
1127
- result = new_call nil, msg.to_sym
1128
- }
1129
- | k_begin
1130
- {
1131
- lexer.cmdarg.push false
1132
- result = self.lexer.lineno
1133
- }
1134
- bodystmt k_end
1135
- {
1136
- lexer.cmdarg.pop
1137
- result = new_begin val
1138
- }
1139
- | tLPAREN_ARG
1140
- {
1141
- lexer.lex_state = EXPR_ENDARG
1142
- result = lexer.lineno
1143
- }
1144
- rparen
1145
- {
1146
- _, line, _ = val
1147
- result = s(:begin).line line
1148
- }
1149
- | tLPAREN_ARG
1150
- stmt
1151
- {
1152
- lexer.lex_state = EXPR_ENDARG
1153
- }
1154
- rparen
1155
- {
1156
- _, stmt, _, _, = val
1157
- # warning "(...) interpreted as grouped expression"
1158
- result = stmt
1159
- }
1160
- | tLPAREN compstmt tRPAREN
1161
- {
1162
- _, stmt, _ = val
1163
- result = stmt
1164
- result ||= s(:nil).line lexer.lineno
1165
- result.paren = true
1166
- }
1167
- | primary_value tCOLON2 tCONSTANT
1168
- {
1169
- expr, _, id = val
1170
-
1171
- result = s(:colon2, expr, id.to_sym).line expr.line
1172
- }
1173
- | tCOLON3 tCONSTANT
1174
- {
1175
- _, id = val
1176
-
1177
- result = s(:colon3, id.to_sym).line lexer.lineno
1178
- }
1179
- | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1180
- {
1181
- _, line, args, _ = val
1182
- result = args || s(:array)
1183
- result.sexp_type = :array # aref_args is :args
1184
- result.line line
1185
- }
1186
- | tLBRACE
1187
- {
1188
- result = self.lexer.lineno
1189
- }
1190
- assoc_list tRCURLY
1191
- {
1192
- result = new_hash val
1193
- }
1194
- | k_return
1195
- {
1196
- (_, line), = val
1197
- result = s(:return).line line
1198
- }
1199
- | kYIELD tLPAREN2 call_args rparen
1200
- {
1201
- result = new_yield val[2]
1202
- }
1203
- | kYIELD tLPAREN2 rparen
1204
- {
1205
- result = new_yield
1206
- }
1207
- | kYIELD
1208
- {
1209
- result = new_yield
1210
- }
1211
- | kDEFINED opt_nl tLPAREN2 expr rparen
1212
- {
1213
- (_, line), _, _, arg, _ = val
1214
-
1215
- result = s(:defined, arg).line line
1216
- }
1217
- | kNOT tLPAREN2 expr rparen
1218
- {
1219
- _, _, lhs, _ = val
1220
- result = new_call lhs, :"!"
1221
- }
1222
- | kNOT tLPAREN2 rparen
1223
- {
1224
- debug20 14, val, result
1225
- }
1226
- | fcall brace_block
1227
- {
1228
- call, iter = val
1229
-
1230
- iter.insert 1, call
1231
- result = iter
1232
- # FIX: probably not: call.line = iter.line
1233
- }
1234
- | method_call
1235
- | method_call brace_block
1236
- {
1237
- call, iter = val[0], val[1]
1238
- block_dup_check call, iter
1239
- iter.insert 1, call # FIX
1240
- result = iter
1241
- }
1242
- | tLAMBDA lambda
1243
- {
1244
- result = val[1] # TODO: fix lineno
1245
- }
1246
- | k_if expr_value then compstmt if_tail k_end
1247
- {
1248
- _, c, _, t, f, _ = val
1249
- result = new_if c, t, f
1250
- }
1251
- | k_unless expr_value then compstmt opt_else k_end
1252
- {
1253
- _, c, _, t, f, _ = val
1254
- result = new_if c, f, t
1255
- }
1256
- | k_while expr_value_do compstmt k_end
1257
- {
1258
- _, cond, body, _ = val
1259
- result = new_while body, cond, true
1260
- }
1261
- | k_until expr_value_do compstmt k_end
1262
- {
1263
- _, cond, body, _ = val
1264
- result = new_until body, cond, true
1265
- }
1266
- | k_case expr_value opt_terms case_body k_end
1267
- {
1268
- (_, line), expr, _, body, _ = val
1269
- result = new_case expr, body, line
1270
- }
1271
- | k_case opt_terms case_body k_end
1272
- {
1273
- (_, line), _, body, _ = val
1274
- result = new_case nil, body, line
1275
- }
1276
- | k_for for_var kIN expr_value_do compstmt k_end
1277
- {
1278
- _, var, _, iter, body, _ = val
1279
- result = new_for iter, var, body
1280
- }
1281
- | k_class
1282
- {
1283
- result = self.lexer.lineno
1284
- }
1285
- cpath superclass
1286
- {
1287
- self.comments.push self.lexer.comments
1288
- if (self.in_def || self.in_single > 0) then
1289
- yyerror "class definition in method body"
1290
- end
1291
- self.env.extend
1292
- }
1293
- bodystmt k_end
1294
- {
1295
- result = new_class val
1296
- self.env.unextend
1297
- self.lexer.comments # we don't care about comments in the body
1298
- }
1299
- | k_class tLSHFT
1300
- {
1301
- result = self.lexer.lineno
1302
- }
1303
- expr
1304
- {
1305
- result = self.in_def
1306
- self.in_def = false
1307
- }
1308
- term
1309
- {
1310
- result = self.in_single
1311
- self.in_single = 0
1312
- self.env.extend
1313
- }
1314
- bodystmt k_end
1315
- {
1316
- result = new_sclass val
1317
- self.env.unextend
1318
- self.lexer.comments # we don't care about comments in the body
1319
- }
1320
- | k_module
1321
- {
1322
- result = self.lexer.lineno
1323
- }
1324
- cpath
1325
- {
1326
- self.comments.push self.lexer.comments
1327
- yyerror "module definition in method body" if
1328
- self.in_def or self.in_single > 0
1329
-
1330
- self.env.extend
1331
- }
1332
- bodystmt k_end
1333
- {
1334
- result = new_module val
1335
- self.env.unextend
1336
- self.lexer.comments # we don't care about comments in the body
1337
- }
1338
- | k_def fname
1339
- {
1340
- result = self.in_def
1341
-
1342
- self.in_def = true # group = local_push
1343
- self.env.extend
1344
- lexer.cmdarg.push false
1345
- lexer.cond.push false
1346
-
1347
- self.comments.push self.lexer.comments
1348
- }
1349
- f_arglist bodystmt { result = lexer.lineno } k_end
1350
- {
1351
- in_def = val[2]
1352
-
1353
- result = new_defn val
1354
-
1355
- lexer.cond.pop # group = local_pop
1356
- lexer.cmdarg.pop
1357
- self.env.unextend
1358
- self.in_def = in_def
1359
-
1360
- self.lexer.comments # we don't care about comments in the body
1361
- }
1362
- | k_def singleton dot_or_colon
1363
- {
1364
- lexer.lex_state = EXPR_FNAME
1365
- }
1366
- fname
1367
- {
1368
- result = [self.in_def, lexer.lineno]
1369
-
1370
- self.in_single += 1 # TODO: remove?
1371
-
1372
- self.in_def = true # local_push
1373
- self.env.extend
1374
- lexer.cmdarg.push false
1375
- lexer.cond.push false
1376
-
1377
- lexer.lex_state = EXPR_ENDFN|EXPR_LABEL
1378
- self.comments.push self.lexer.comments
1379
- }
1380
- f_arglist bodystmt k_end
1381
- {
1382
- _, _recv, _, _, _name, (in_def, _lineno), _args, _body, _ = val
1383
-
1384
- result = new_defs val
1385
-
1386
- lexer.cond.pop # group = local_pop
1387
- lexer.cmdarg.pop
1388
- self.env.unextend
1389
- self.in_def = in_def
1390
-
1391
- self.in_single -= 1
1392
-
1393
- # TODO: restore cur_arg ? what's cur_arg?
1394
-
1395
- self.lexer.comments # we don't care about comments in the body
1396
- }
1397
- | kBREAK
1398
- {
1399
- (_, line), = val
1400
- result = s(:break).line line
1401
- }
1402
- | kNEXT
1403
- {
1404
- (_, line), = val
1405
- result = s(:next).line line
1406
- }
1407
- | kREDO
1408
- {
1409
- (_, line), = val
1410
- result = s(:redo).line line
1411
- }
1412
- | kRETRY
1413
- {
1414
- (_, line), = val
1415
- result = s(:retry).line line
1416
- }
1417
-
1418
- primary_value: primary
1419
- {
1420
- result = value_expr(val[0])
1421
- }
1422
-
1423
- # These are really stupid
1424
- k_begin: kBEGIN
1425
- k_if: kIF
1426
- k_unless: kUNLESS
1427
- k_while: kWHILE
1428
- k_until: kUNTIL
1429
- k_case: kCASE
1430
- k_for: kFOR
1431
- k_class: kCLASS
1432
- k_module: kMODULE
1433
- k_def: kDEF
1434
- k_do: kDO
1435
- k_do_block: kDO_BLOCK
1436
- k_rescue: kRESCUE
1437
- k_ensure: kENSURE
1438
- k_when: kWHEN
1439
- k_else: kELSE
1440
- k_elsif: kELSIF
1441
- k_end: kEND
1442
- k_return: kRETURN
1443
-
1444
- then: term
1445
- | kTHEN
1446
- | term kTHEN
1447
-
1448
- do: term
1449
- | kDO_COND
1450
-
1451
- if_tail: opt_else
1452
- | k_elsif expr_value then compstmt if_tail
1453
- {
1454
- (_, line), c, _, t, rest = val
1455
-
1456
- result = s(:if, c, t, rest).line line
1457
- }
1458
-
1459
- opt_else: none
1460
- | kELSE compstmt
1461
- {
1462
- result = val[1]
1463
- }
1464
-
1465
- for_var: lhs
1466
- | mlhs
1467
- {
1468
- val[0].delete_at 1 if val[0][1].nil? # HACK
1469
- }
1470
-
1471
- f_marg: f_norm_arg
1472
- | tLPAREN f_margs rparen
1473
- {
1474
- result = val[1]
1475
- }
1476
-
1477
- f_marg_list: f_marg
1478
- {
1479
- sym, = val
1480
-
1481
- result = s(:array, sym).line lexer.lineno
1482
- }
1483
- | f_marg_list tCOMMA f_marg
1484
- {
1485
- result = list_append val[0], val[2]
1486
- }
1487
-
1488
- f_margs: f_marg_list
1489
- {
1490
- args, = val
1491
-
1492
- result = block_var args
1493
- }
1494
- | f_marg_list tCOMMA tSTAR f_norm_arg
1495
- {
1496
- args, _, _, splat = val
1497
-
1498
- result = block_var args, "*#{splat}".to_sym
1499
- }
1500
- | f_marg_list tCOMMA tSTAR f_norm_arg tCOMMA f_marg_list
1501
- {
1502
- args, _, _, splat, _, args2 = val
1503
-
1504
- result = block_var args, "*#{splat}".to_sym, args2
1505
- }
1506
- | f_marg_list tCOMMA tSTAR
1507
- {
1508
- args, _, _ = val
1509
-
1510
- result = block_var args, :*
1511
- }
1512
- | f_marg_list tCOMMA tSTAR tCOMMA f_marg_list
1513
- {
1514
- args, _, _, _, args2 = val
1515
-
1516
- result = block_var args, :*, args2
1517
- }
1518
- | tSTAR f_norm_arg
1519
- {
1520
- _, splat = val
1521
-
1522
- result = block_var :"*#{splat}"
1523
- }
1524
- | tSTAR f_norm_arg tCOMMA f_marg_list
1525
- {
1526
- _, splat, _, args = val
1527
-
1528
- result = block_var :"*#{splat}", args
1529
- }
1530
- | tSTAR
1531
- {
1532
- result = block_var :*
1533
- }
1534
- | tSTAR tCOMMA f_marg_list
1535
- {
1536
- _, _, args = val
1537
-
1538
- result = block_var :*, args
1539
- }
1540
-
1541
- block_args_tail: f_block_kwarg tCOMMA f_kwrest opt_f_block_arg
1542
- {
1543
- result = call_args val
1544
- }
1545
- | f_block_kwarg opt_f_block_arg
1546
- {
1547
- result = call_args val
1548
- }
1549
- | f_kwrest opt_f_block_arg
1550
- {
1551
- result = call_args val
1552
- }
1553
- | f_block_arg
1554
- {
1555
- line = lexer.lineno
1556
- result = call_args val # TODO: push line down
1557
- result.line line
1558
- }
1559
-
1560
- opt_block_args_tail: tCOMMA block_args_tail
1561
- {
1562
- result = args val
1563
- }
1564
- | none
1565
-
1566
- block_param: f_arg tCOMMA f_block_optarg tCOMMA f_rest_arg opt_block_args_tail
1567
- {
1568
- result = args val
1569
- }
1570
- | f_arg tCOMMA f_block_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
1571
- {
1572
- result = args val
1573
- }
1574
- | f_arg tCOMMA f_block_optarg opt_block_args_tail
1575
- {
1576
- result = args val
1577
- }
1578
- | f_arg tCOMMA f_block_optarg tCOMMA f_arg opt_block_args_tail
1579
- {
1580
- result = args val
1581
- }
1582
- | f_arg tCOMMA f_rest_arg opt_block_args_tail
1583
- {
1584
- result = args val
1585
- }
1586
- | f_arg tCOMMA
1587
- {
1588
- result = args(val) << nil
1589
- }
1590
- | f_arg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
1591
- {
1592
- result = args val
1593
- }
1594
- | f_arg opt_block_args_tail
1595
- {
1596
- result = args val
1597
- }
1598
- | f_block_optarg tCOMMA f_rest_arg opt_block_args_tail
1599
- {
1600
- result = args val
1601
- }
1602
- | f_block_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
1603
- {
1604
- result = args val
1605
- }
1606
- | f_block_optarg opt_block_args_tail
1607
- {
1608
- result = args val
1609
- }
1610
- | f_block_optarg tCOMMA f_arg opt_block_args_tail
1611
- {
1612
- result = args val
1613
- }
1614
- | f_rest_arg opt_block_args_tail
1615
- {
1616
- result = args val
1617
- }
1618
- | f_rest_arg tCOMMA f_arg opt_block_args_tail
1619
- {
1620
- result = args val
1621
- }
1622
- | block_args_tail
1623
- {
1624
- result = args val
1625
- }
1626
-
1627
- opt_block_param: none { result = 0 }
1628
- | block_param_def
1629
- {
1630
- self.lexer.command_start = true
1631
- }
1632
-
1633
- block_param_def: tPIPE opt_bv_decl tPIPE
1634
- {
1635
- # TODO: current_arg = 0
1636
- result = args val
1637
- }
1638
- | tOROP
1639
- {
1640
- result = s(:args).line lexer.lineno
1641
- }
1642
- | tPIPE block_param opt_bv_decl tPIPE
1643
- {
1644
- # TODO: current_arg = 0
1645
- result = args val
1646
- }
1647
-
1648
- opt_bv_decl: opt_nl
1649
- | opt_nl tSEMI bv_decls opt_nl
1650
- {
1651
- result = args val
1652
- }
1653
-
1654
- bv_decls: bvar
1655
- {
1656
- result = args val
1657
- }
1658
- | bv_decls tCOMMA bvar
1659
- {
1660
- result = args val
1661
- }
1662
-
1663
- bvar: tIDENTIFIER
1664
- {
1665
- id, = val
1666
- line = lexer.lineno
1667
- result = s(:shadow, id.to_sym).line line
1668
- }
1669
- | f_bad_arg
1670
-
1671
- lambda: {
1672
- self.env.extend :dynamic
1673
- result = [lexer.lineno, lexer.lpar_beg]
1674
- lexer.paren_nest += 1
1675
- lexer.lpar_beg = lexer.paren_nest
1676
- }
1677
- f_larglist
1678
- {
1679
- lexer.cmdarg.push false
1680
- }
1681
- lambda_body
1682
- {
1683
- (line, lpar), args, _cmdarg, body = val
1684
- lexer.lpar_beg = lpar
1685
-
1686
- lexer.cmdarg.pop
1687
-
1688
- call = s(:lambda).line line
1689
- result = new_iter call, args, body
1690
- result.line = line
1691
- self.env.unextend # TODO: dynapush & dynapop
1692
- }
1693
-
1694
- f_larglist: tLPAREN2 f_args opt_bv_decl rparen
1695
- {
1696
- result = args val
1697
- }
1698
- | f_args
1699
- {
1700
- result = val[0]
1701
- result = 0 if result == s(:args)
1702
- }
1703
-
1704
- lambda_body: tLAMBEG compstmt tRCURLY
1705
- {
1706
- result = val[1]
1707
- }
1708
- | kDO_LAMBDA bodystmt kEND
1709
- {
1710
- result = val[1]
1711
- }
1712
-
1713
- do_block: k_do_block do_body kEND
1714
- {
1715
- (_, line), iter, _ = val
1716
- result = iter.line line
1717
- }
1718
-
1719
- block_call: command do_block
1720
- {
1721
- # TODO:
1722
- ## if (nd_type($1) == NODE_YIELD) {
1723
- ## compile_error(PARSER_ARG "block given to yield");
1724
-
1725
- syntax_error "Both block arg and actual block given." if
1726
- val[0].block_pass?
1727
-
1728
- val = invert_block_call val if inverted? val
1729
-
1730
- cmd, blk = val
1731
-
1732
- result = blk
1733
- result.insert 1, cmd
1734
- }
1735
- | block_call call_op2 operation2 opt_paren_args
1736
- {
1737
- result = new_call val[0], val[2].to_sym, val[3]
1738
- }
1739
- | block_call call_op2 operation2 opt_paren_args brace_block
1740
- {
1741
- iter1, _, name, args, iter2 = val
1742
-
1743
- call = new_call iter1, name.to_sym, args
1744
- iter2.insert 1, call
1745
-
1746
- result = iter2
1747
- }
1748
- | block_call call_op2 operation2 command_args do_block
1749
- {
1750
- iter1, _, name, args, iter2 = val
1751
-
1752
- call = new_call iter1, name.to_sym, args
1753
- iter2.insert 1, call
1754
-
1755
- result = iter2
1756
- }
1757
-
1758
- method_call: fcall
1759
- {
1760
- result = self.lexer.lineno
1761
- }
1762
- paren_args
1763
- {
1764
- call, lineno, args = val
1765
-
1766
- result = call.concat args.sexp_body if args
1767
- result.line lineno
1768
- }
1769
- | primary_value call_op operation2 opt_paren_args
1770
- {
1771
- result = new_call val[0], val[2].to_sym, val[3], val[1]
1772
- }
1773
- | primary_value tCOLON2 operation2 paren_args
1774
- {
1775
- result = new_call val[0], val[2].to_sym, val[3]
1776
- }
1777
- | primary_value tCOLON2 operation3
1778
- {
1779
- result = new_call val[0], val[2].to_sym
1780
- }
1781
- | primary_value call_op paren_args
1782
- {
1783
- result = new_call val[0], :call, val[2], val[1]
1784
- }
1785
- | primary_value tCOLON2 paren_args
1786
- {
1787
- result = new_call val[0], :call, val[2]
1788
- }
1789
- | kSUPER paren_args
1790
- {
1791
- result = new_super val[1]
1792
- }
1793
- | kSUPER
1794
- {
1795
- result = s(:zsuper).line lexer.lineno
1796
- }
1797
- | primary_value tLBRACK2 opt_call_args rbracket
1798
- {
1799
- result = new_aref val
1800
- }
1801
-
1802
- brace_block: tLCURLY
1803
- {
1804
- self.env.extend :dynamic
1805
- result = self.lexer.lineno
1806
- }
1807
- brace_body tRCURLY
1808
- {
1809
- _, line, body, _ = val
1810
-
1811
- result = body
1812
- result.line = line
1813
-
1814
- self.env.unextend
1815
- }
1816
- | k_do
1817
- {
1818
- self.env.extend :dynamic
1819
- result = self.lexer.lineno
1820
- }
1821
- do_body kEND
1822
- {
1823
- _, line, body, _ = val
1824
-
1825
- result = body
1826
- result.line = line
1827
-
1828
- self.env.unextend
1829
- }
1830
-
1831
- brace_body: { self.env.extend :dynamic; result = self.lexer.lineno }
1832
- { result = lexer.cmdarg.store(false) }
1833
- opt_block_param compstmt
1834
- {
1835
- line, cmdarg, param, cmpstmt = val
1836
-
1837
- result = new_brace_body param, cmpstmt, line
1838
- self.env.unextend
1839
- lexer.cmdarg.restore cmdarg
1840
- lexer.cmdarg.pop # because of: cmdarg_stack >> 1 ?
1841
- }
1842
-
1843
- do_body: { self.env.extend :dynamic; result = self.lexer.lineno }
1844
- { lexer.cmdarg.push false }
1845
- opt_block_param
1846
- compstmt
1847
- {
1848
- line, _cmdarg, param, cmpstmt = val
1849
-
1850
- result = new_do_body param, cmpstmt, line
1851
- lexer.cmdarg.pop
1852
- self.env.unextend
1853
- }
1854
-
1855
- case_body: k_when
1856
- {
1857
- result = self.lexer.lineno
1858
- }
1859
- args then compstmt cases
1860
- {
1861
- result = new_when(val[2], val[4])
1862
- result.line = val[1]
1863
- result << val[5] if val[5]
1864
- }
1865
-
1866
- cases: opt_else | case_body
1867
-
1868
- opt_rescue: k_rescue exc_list exc_var then compstmt opt_rescue
1869
- {
1870
- (_, line), klasses, var, _, body, rest = val
1871
-
1872
- klasses ||= s(:array)
1873
- klasses << new_assign(var, s(:gvar, :"$!").line(var.line)) if var
1874
- klasses.line line
1875
-
1876
- result = new_resbody(klasses, body)
1877
- result << rest if rest # UGH, rewritten above
1878
- }
1879
- |
1880
- {
1881
- result = nil
1882
- }
1883
-
1884
- exc_list: arg_value
1885
- {
1886
- arg, = val
1887
- result = s(:array, arg).line arg.line
1888
- }
1889
- | mrhs
1890
- | none
1891
-
1892
- exc_var: tASSOC lhs
1893
- {
1894
- result = val[1]
1895
- }
1896
- | none
1897
-
1898
- opt_ensure: k_ensure compstmt
1899
- {
1900
- (_, line), body = val
1901
-
1902
- result = body || s(:nil).line(line)
1903
- }
1904
- | none
1905
-
1906
- literal: numeric
1907
- {
1908
- line = lexer.lineno
1909
- result = s(:lit, val[0])
1910
- result.line = line
1911
- }
1912
- | symbol
1913
- {
1914
- line = lexer.lineno
1915
- result = s(:lit, val[0])
1916
- result.line = line
1917
- }
1918
- | dsym
1919
-
1920
- strings: string
1921
- {
1922
- str, = val
1923
- str = s(:dstr, str.value) if str.sexp_type == :evstr
1924
- result = str
1925
- }
1926
-
1927
- string: tCHAR
1928
- {
1929
- debug20 23, val, result
1930
- }
1931
- | string1
1932
- | string string1
1933
- {
1934
- result = self.literal_concat val[0], val[1]
1935
- }
1936
-
1937
- string1: tSTRING_BEG string_contents tSTRING_END
1938
- {
1939
- _, str, (_, func) = val
1940
-
1941
- str = dedent str if func =~ RubyLexer::STR_FUNC_ICNTNT
1942
-
1943
- result = str
1944
- }
1945
- | tSTRING
1946
- {
1947
- result = new_string val
1948
- }
1949
-
1950
- xstring: tXSTRING_BEG xstring_contents tSTRING_END
1951
- {
1952
- result = new_xstring val
1953
- # TODO: dedent?!?! SERIOUSLY?!?
1954
- }
1955
-
1956
- regexp: tREGEXP_BEG regexp_contents tREGEXP_END
1957
- {
1958
- result = new_regexp val
1959
- }
1960
-
1961
- words: tWORDS_BEG tSPACE tSTRING_END
1962
- {
1963
- result = s(:array).line lexer.lineno
1964
- }
1965
- | tWORDS_BEG word_list tSTRING_END
1966
- {
1967
- result = val[1]
1968
- }
1969
-
1970
- word_list: none
1971
- {
1972
- result = new_word_list
1973
- }
1974
- | word_list word tSPACE
1975
- {
1976
- result = val[0].dup << new_word_list_entry(val)
1977
- }
1978
-
1979
- word: string_content
1980
- | word string_content
1981
- {
1982
- result = self.literal_concat val[0], val[1]
1983
- }
1984
-
1985
- symbols: tSYMBOLS_BEG tSPACE tSTRING_END
1986
- {
1987
- result = s(:array).line lexer.lineno
1988
- }
1989
- | tSYMBOLS_BEG { result = lexer.lineno } symbol_list tSTRING_END
1990
- {
1991
- _, line, list, _, = val
1992
- list.line = line
1993
- result = list
1994
- }
1995
-
1996
- symbol_list: none
1997
- {
1998
- result = new_symbol_list.line lexer.lineno
1999
- }
2000
- | symbol_list word tSPACE
2001
- {
2002
- list, * = val
2003
- result = list.dup << new_symbol_list_entry(val)
2004
- }
2005
-
2006
- qwords: tQWORDS_BEG tSPACE tSTRING_END
2007
- {
2008
- result = s(:array).line lexer.lineno
2009
- }
2010
- | tQWORDS_BEG qword_list tSTRING_END
2011
- {
2012
- result = val[1]
2013
- }
2014
-
2015
- qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
2016
- {
2017
- result = s(:array).line lexer.lineno # FIX
2018
- }
2019
- | tQSYMBOLS_BEG qsym_list tSTRING_END
2020
- {
2021
- result = val[1]
2022
- }
2023
-
2024
- qword_list: none
2025
- {
2026
- result = new_qword_list
2027
- }
2028
- | qword_list tSTRING_CONTENT tSPACE
2029
- {
2030
- result = val[0].dup << new_qword_list_entry(val)
2031
- }
2032
-
2033
- qsym_list: none
2034
- {
2035
- result = new_qsym_list
2036
- }
2037
- | qsym_list tSTRING_CONTENT tSPACE
2038
- {
2039
- result = val[0].dup << new_qsym_list_entry(val)
2040
- }
2041
-
2042
- string_contents: none
2043
- {
2044
- result = s(:str, "").line lexer.lineno
2045
- }
2046
- | string_contents string_content
2047
- {
2048
- v1, v2 = val
2049
- result = literal_concat v1, v2
2050
- }
2051
-
2052
- xstring_contents: none
2053
- {
2054
- result = nil
2055
- }
2056
- | xstring_contents string_content
2057
- {
2058
- v1, v2 = val
2059
- result = literal_concat v1, v2
2060
- }
2061
-
2062
- regexp_contents: none
2063
- {
2064
- result = nil
2065
- }
2066
- | regexp_contents string_content
2067
- {
2068
- v1, v2 = val
2069
- result = literal_concat v1, v2
2070
- }
2071
-
2072
- string_content: tSTRING_CONTENT
2073
- {
2074
- result = new_string val
2075
- }
2076
- | tSTRING_DVAR
2077
- {
2078
- result = lexer.lex_strterm
2079
-
2080
- lexer.lex_strterm = nil
2081
- lexer.lex_state = EXPR_BEG
2082
- }
2083
- string_dvar
2084
- {
2085
- _, strterm, str = val
2086
- lexer.lex_strterm = strterm
2087
- result = s(:evstr, str).line str.line
2088
- }
2089
- | tSTRING_DBEG
2090
- {
2091
- result = [lexer.lex_strterm,
2092
- lexer.brace_nest,
2093
- lexer.string_nest, # TODO: remove
2094
- lexer.lex_state,
2095
- lexer.lineno,
2096
- ]
2097
-
2098
- lexer.cmdarg.push false
2099
- lexer.cond.push false
2100
-
2101
- lexer.lex_strterm = nil
2102
- lexer.brace_nest = 0
2103
- lexer.string_nest = 0
2104
-
2105
- lexer.lex_state = EXPR_BEG
2106
- }
2107
- compstmt
2108
- tSTRING_DEND
2109
- {
2110
- _, memo, stmt, _ = val
2111
-
2112
- lex_strterm, brace_nest, string_nest, oldlex_state, line = memo
2113
- # TODO: heredoc_indent
2114
-
2115
- lexer.lex_strterm = lex_strterm
2116
- lexer.brace_nest = brace_nest
2117
- lexer.string_nest = string_nest
2118
-
2119
- lexer.cmdarg.pop
2120
- lexer.cond.pop
2121
-
2122
- lexer.lex_state = oldlex_state
2123
-
2124
- case stmt
2125
- when Sexp then
2126
- case stmt.sexp_type
2127
- when :str, :dstr, :evstr then
2128
- result = stmt
2129
- else
2130
- result = s(:evstr, stmt).line line
2131
- end
2132
- when nil then
2133
- result = s(:evstr).line line
2134
- else
2135
- debug20 25
2136
- raise "unknown string body: #{stmt.inspect}"
2137
- end
2138
- }
2139
-
2140
- string_dvar: tGVAR { result = s(:gvar, val[0].to_sym).line lexer.lineno }
2141
- | tIVAR { result = s(:ivar, val[0].to_sym).line lexer.lineno }
2142
- | tCVAR { result = s(:cvar, val[0].to_sym).line lexer.lineno }
2143
- | backref
2144
-
2145
- symbol: tSYMBEG sym
2146
- {
2147
- lexer.lex_state = EXPR_END
2148
- result = val[1].to_sym
2149
- }
2150
- | tSYMBOL
2151
- {
2152
- result = val[0].to_sym
2153
- }
2154
-
2155
- sym: fname | tIVAR | tGVAR | tCVAR
2156
-
2157
- dsym: tSYMBEG xstring_contents tSTRING_END
2158
- {
2159
- _, result, _ = val
2160
-
2161
- lexer.lex_state = EXPR_END
2162
-
2163
- result ||= s(:str, "").line lexer.lineno
2164
-
2165
- case result.sexp_type
2166
- when :dstr then
2167
- result.sexp_type = :dsym
2168
- when :str then
2169
- result = s(:lit, result.last.to_sym).line result.line
2170
- when :evstr then
2171
- result = s(:dsym, "", result).line result.line
2172
- else
2173
- debug20 26, val, result
2174
- end
2175
- }
2176
-
2177
- numeric: simple_numeric
2178
- | tUMINUS_NUM simple_numeric
2179
- {
2180
- result = -val[1] # TODO: pt_testcase
2181
- }
2182
-
2183
- simple_numeric: tINTEGER
2184
- | tFLOAT
2185
- | tRATIONAL
2186
- | tIMAGINARY
2187
-
2188
- user_variable: tIDENTIFIER
2189
- | tIVAR
2190
- | tGVAR
2191
- | tCONSTANT
2192
- | tCVAR
2193
-
2194
- keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2195
- | kSELF { result = s(:self).line lexer.lineno }
2196
- | kTRUE { result = s(:true).line lexer.lineno }
2197
- | kFALSE { result = s(:false).line lexer.lineno }
2198
- | k__FILE__ { result = s(:str, self.file).line lexer.lineno }
2199
- | k__LINE__ { result = s(:lit, lexer.lineno).line lexer.lineno }
2200
- | k__ENCODING__
2201
- {
2202
- l = lexer.lineno
2203
- result =
2204
- if defined? Encoding then
2205
- s(:colon2, s(:const, :Encoding).line(l), :UTF_8).line l
2206
- else
2207
- s(:str, "Unsupported!").line l
2208
- end
2209
- }
2210
-
2211
- var_ref: user_variable
2212
- {
2213
- var = val[0]
2214
- result = Sexp === var ? var : self.gettable(var)
2215
- }
2216
- | keyword_variable
2217
- {
2218
- var = val[0]
2219
- result = Sexp === var ? var : self.gettable(var)
2220
- }
2221
-
2222
- var_lhs: user_variable
2223
- {
2224
- result = self.assignable val[0]
2225
- }
2226
- | keyword_variable
2227
- {
2228
- result = self.assignable val[0]
2229
- debug20 29, val, result
2230
- }
2231
-
2232
- backref: tNTH_REF { result = s(:nth_ref, val[0]).line lexer.lineno }
2233
- | tBACK_REF { result = s(:back_ref, val[0]).line lexer.lineno }
2234
-
2235
- superclass: tLT
2236
- {
2237
- lexer.lex_state = EXPR_BEG
2238
- lexer.command_start = true
2239
- }
2240
- expr_value term
2241
- {
2242
- result = val[2]
2243
- }
2244
- | none
2245
- {
2246
- result = nil
2247
- }
2248
-
2249
- f_arglist: tLPAREN2 f_args rparen
2250
- {
2251
- result = val[1]
2252
- self.lexer.lex_state = EXPR_BEG
2253
- self.lexer.command_start = true
2254
- }
2255
- | {
2256
- result = self.in_kwarg
2257
- self.in_kwarg = true
2258
- self.lexer.lex_state |= EXPR_LABEL
2259
- }
2260
- f_args term
2261
- {
2262
- kwarg, args, _ = val
2263
-
2264
- self.in_kwarg = kwarg
2265
- result = args
2266
- lexer.lex_state = EXPR_BEG
2267
- lexer.command_start = true
2268
- }
2269
-
2270
- args_tail: f_kwarg tCOMMA f_kwrest opt_f_block_arg
2271
- {
2272
- result = args val
2273
- }
2274
- | f_kwarg opt_f_block_arg
2275
- {
2276
- result = args val
2277
- }
2278
- | f_kwrest opt_f_block_arg
2279
- {
2280
- result = args val
2281
- }
2282
- | f_block_arg
2283
-
2284
- opt_args_tail: tCOMMA args_tail
2285
- {
2286
- result = val[1]
2287
- }
2288
- |
2289
- {
2290
- result = nil
2291
- }
2292
-
2293
- f_args: f_arg tCOMMA f_optarg tCOMMA f_rest_arg opt_args_tail
2294
- {
2295
- result = args val
2296
- }
2297
- | f_arg tCOMMA f_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_args_tail
2298
- {
2299
- result = args val
2300
- }
2301
- | f_arg tCOMMA f_optarg opt_args_tail
2302
- {
2303
- result = args val
2304
- }
2305
- | f_arg tCOMMA f_optarg tCOMMA f_arg opt_args_tail
2306
- {
2307
- result = args val
2308
- }
2309
- | f_arg tCOMMA f_rest_arg opt_args_tail
2310
- {
2311
- result = args val
2312
- }
2313
- | f_arg tCOMMA f_rest_arg tCOMMA f_arg opt_args_tail
2314
- {
2315
- result = args val
2316
- }
2317
- | f_arg opt_args_tail
2318
- {
2319
- result = args val
2320
- }
2321
- | f_optarg tCOMMA f_rest_arg opt_args_tail
2322
- {
2323
- result = args val
2324
- }
2325
- | f_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_args_tail
2326
- {
2327
- result = args val
2328
- }
2329
- | f_optarg opt_args_tail
2330
- {
2331
- result = args val
2332
- }
2333
- | f_optarg tCOMMA f_arg opt_args_tail
2334
- {
2335
- result = args val
2336
- }
2337
- | f_rest_arg opt_args_tail
2338
- {
2339
- result = args val
2340
- }
2341
- | f_rest_arg tCOMMA f_arg opt_args_tail
2342
- {
2343
- result = args val
2344
- }
2345
- | args_tail
2346
- {
2347
- result = args val
2348
- }
2349
- |
2350
- {
2351
- result = args val
2352
- }
2353
-
2354
- args_forward: tBDOT3
2355
-
2356
- f_bad_arg: tCONSTANT
2357
- {
2358
- yyerror "formal argument cannot be a constant"
2359
- }
2360
- | tIVAR
2361
- {
2362
- yyerror "formal argument cannot be an instance variable"
2363
- }
2364
- | tGVAR
2365
- {
2366
- yyerror "formal argument cannot be a global variable"
2367
- }
2368
- | tCVAR
2369
- {
2370
- yyerror "formal argument cannot be a class variable"
2371
- }
2372
-
2373
- f_norm_arg: f_bad_arg
2374
- | tIDENTIFIER
2375
- {
2376
- identifier = val[0].to_sym
2377
- self.env[identifier] = :lvar
2378
-
2379
- result = identifier
2380
- }
2381
-
2382
- f_arg_asgn: f_norm_arg
2383
-
2384
- f_arg_item: f_arg_asgn
2385
- | tLPAREN f_margs rparen
2386
- {
2387
- result = val[1]
2388
- }
2389
-
2390
- f_arg: f_arg_item
2391
- {
2392
- arg, = val
2393
-
2394
- case arg
2395
- when Symbol then
2396
- result = s(:args, arg).line lexer.lineno
2397
- when Sexp then
2398
- result = arg
2399
- else
2400
- debug20 32
2401
- raise "Unknown f_arg type: #{val.inspect}"
2402
- end
2403
- }
2404
- | f_arg tCOMMA f_arg_item
2405
- {
2406
- list, _, item = val
2407
-
2408
- if list.sexp_type == :args then
2409
- result = list
2410
- else
2411
- result = s(:args, list).line list.line
2412
- end
2413
-
2414
- result << item
2415
- }
2416
-
2417
- f_label: tLABEL
2418
-
2419
- f_kw: f_label arg_value
2420
- {
2421
- # TODO: new_kw_arg
2422
- (label, line), arg = val
2423
-
2424
- identifier = label.to_sym
2425
- self.env[identifier] = :lvar
2426
-
2427
- kwarg = s(:kwarg, identifier, arg).line line
2428
- result = s(:array, kwarg).line line
2429
- }
2430
- | f_label
2431
- {
2432
- (label, line), = val
2433
-
2434
- id = label.to_sym
2435
- self.env[id] = :lvar
2436
-
2437
- result = s(:array, s(:kwarg, id).line(line)).line line
2438
- }
2439
-
2440
- f_block_kw: f_label primary_value
2441
- {
2442
- # TODO: new_kw_arg
2443
- (label, line), expr = val
2444
- id = label.to_sym
2445
- self.env[id] = :lvar
2446
-
2447
- result = s(:array, s(:kwarg, id, expr).line(line)).line line
2448
- }
2449
- | f_label
2450
- {
2451
- # TODO: new_kw_arg
2452
- (label, line), = val
2453
- id = label.to_sym
2454
- self.env[id] = :lvar
2455
-
2456
- result = s(:array, s(:kwarg, id).line(line)).line line
2457
- }
2458
-
2459
- f_block_kwarg: f_block_kw
2460
- | f_block_kwarg tCOMMA f_block_kw
2461
- {
2462
- list, _, item = val
2463
- result = list << item.last
2464
- }
2465
-
2466
- f_kwarg: f_kw
2467
- | f_kwarg tCOMMA f_kw
2468
- {
2469
- result = args val
2470
- }
2471
-
2472
- kwrest_mark: tPOW
2473
- | tDSTAR
2474
-
2475
- f_kwrest: kwrest_mark tIDENTIFIER
2476
- {
2477
- name = val[1].to_sym
2478
- self.assignable name
2479
- result = :"**#{name}"
2480
- }
2481
- | kwrest_mark
2482
- {
2483
- result = :"**"
2484
- self.env[result] = :lvar
2485
- }
2486
-
2487
- f_opt: f_arg_asgn tEQL arg_value
2488
- {
2489
- result = self.assignable val[0], val[2]
2490
- # TODO: detect duplicate names
2491
- }
2492
-
2493
- f_block_opt: f_arg_asgn tEQL primary_value
2494
- {
2495
- result = self.assignable val[0], val[2]
2496
- }
2497
-
2498
- f_block_optarg: f_block_opt
2499
- {
2500
- optblk, = val
2501
- result = s(:block, optblk).line optblk.line
2502
- }
2503
- | f_block_optarg tCOMMA f_block_opt
2504
- {
2505
- optarg, _, optblk = val
2506
- result = optarg
2507
- result << optblk
2508
- }
2509
-
2510
- f_optarg: f_opt
2511
- {
2512
- opt, = val
2513
- result = s(:block, opt).line opt.line
2514
- }
2515
- | f_optarg tCOMMA f_opt
2516
- {
2517
- result = self.block_append val[0], val[2]
2518
- }
2519
-
2520
- restarg_mark: tSTAR2 | tSTAR
2521
-
2522
- f_rest_arg: restarg_mark tIDENTIFIER
2523
- {
2524
- # TODO: differs from parse.y - needs tests
2525
- name = val[1].to_sym
2526
- self.assignable name
2527
- result = :"*#{name}"
2528
- }
2529
- | restarg_mark
2530
- {
2531
- name = :"*"
2532
- self.env[name] = :lvar
2533
- result = name
2534
- }
2535
-
2536
- blkarg_mark: tAMPER2 | tAMPER
2537
-
2538
- f_block_arg: blkarg_mark tIDENTIFIER
2539
- {
2540
- identifier = val[1].to_sym
2541
-
2542
- self.env[identifier] = :lvar
2543
- result = "&#{identifier}".to_sym
2544
- }
2545
-
2546
- opt_f_block_arg: tCOMMA f_block_arg
2547
- {
2548
- result = val[1]
2549
- }
2550
- |
2551
- {
2552
- result = nil
2553
- }
2554
-
2555
- singleton: var_ref
2556
- | tLPAREN2
2557
- {
2558
- lexer.lex_state = EXPR_BEG
2559
- }
2560
- expr rparen
2561
- {
2562
- result = val[2]
2563
- yyerror "Can't define single method for literals." if
2564
- result.sexp_type == :lit
2565
- }
2566
-
2567
- assoc_list: none
2568
- {
2569
- result = s(:array).line lexer.lineno
2570
- }
2571
- | assocs trailer
2572
-
2573
- assocs: assoc
2574
- | assocs tCOMMA assoc
2575
- {
2576
- list = val[0].dup
2577
- more = val[2].sexp_body
2578
- list.push(*more) unless more.empty?
2579
- result = list
2580
- result.sexp_type = :hash
2581
- }
2582
-
2583
- assoc: arg_value tASSOC arg_value
2584
- {
2585
- v1, _, v2 = val
2586
- result = s(:array, v1, v2).line v1.line
2587
- }
2588
- | tLABEL arg_value
2589
- {
2590
- (label, line), arg = val
2591
-
2592
- lit = s(:lit, label.to_sym).line line
2593
- result = s(:array, lit, arg).line line
2594
- }
2595
- | tSTRING_BEG string_contents tLABEL_END arg_value
2596
- {
2597
- _, sym, _, value = val
2598
- sym.sexp_type = :dsym
2599
- result = s(:array, sym, value).line sym.line
2600
- }
2601
- | tDSTAR arg_value
2602
- {
2603
- _, arg = val
2604
- line = arg.line
2605
- result = s(:array, s(:kwsplat, arg).line(line)).line line
2606
- }
2607
-
2608
- operation: tIDENTIFIER | tCONSTANT | tFID
2609
- operation2: tIDENTIFIER | tCONSTANT | tFID | op
2610
- operation3: tIDENTIFIER | tFID | op
2611
- dot_or_colon: tDOT | tCOLON2
2612
- call_op: tDOT
2613
- | tLONELY # TODO: rename tANDDOT?
2614
-
2615
- call_op2: call_op
2616
- | tCOLON2
2617
-
2618
- opt_terms: | terms
2619
- opt_nl: | tNL
2620
- rparen: opt_nl tRPAREN
2621
- rbracket: opt_nl tRBRACK
2622
- trailer: | tNL | tCOMMA
2623
-
2624
- term: tSEMI { yyerrok }
2625
- | tNL
2626
-
2627
- terms: term
2628
- | terms tSEMI { yyerrok }
2629
-
2630
- none: { result = nil; }
2631
- end
2632
-
2633
- ---- inner
2634
-
2635
- require "ruby_lexer"
2636
- require "ruby_parser_extras"
2637
- include RubyLexer::State::Values
2638
-
2639
- # :stopdoc:
2640
-
2641
- # Local Variables: **
2642
- # racc-token-length-max:14 **
2643
- # End: **