brakeman 5.1.1 → 5.2.0

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