brakeman 5.0.2 → 5.1.2

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