prism 0.23.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/BSDmakefile +58 -0
  3. data/CHANGELOG.md +65 -1
  4. data/Makefile +5 -2
  5. data/README.md +45 -6
  6. data/config.yml +499 -4
  7. data/docs/build_system.md +31 -0
  8. data/docs/configuration.md +2 -0
  9. data/docs/cruby_compilation.md +1 -1
  10. data/docs/parser_translation.md +14 -9
  11. data/docs/releasing.md +3 -3
  12. data/docs/ripper_translation.md +50 -0
  13. data/docs/ruby_api.md +1 -0
  14. data/docs/serialization.md +26 -5
  15. data/ext/prism/api_node.c +2342 -1801
  16. data/ext/prism/api_pack.c +9 -0
  17. data/ext/prism/extconf.rb +27 -11
  18. data/ext/prism/extension.c +313 -66
  19. data/ext/prism/extension.h +5 -4
  20. data/include/prism/ast.h +213 -64
  21. data/include/prism/defines.h +106 -2
  22. data/include/prism/diagnostic.h +134 -71
  23. data/include/prism/encoding.h +22 -4
  24. data/include/prism/node.h +93 -0
  25. data/include/prism/options.h +82 -7
  26. data/include/prism/pack.h +11 -0
  27. data/include/prism/parser.h +198 -53
  28. data/include/prism/prettyprint.h +8 -0
  29. data/include/prism/static_literals.h +118 -0
  30. data/include/prism/util/pm_buffer.h +65 -2
  31. data/include/prism/util/pm_constant_pool.h +18 -1
  32. data/include/prism/util/pm_integer.h +119 -0
  33. data/include/prism/util/pm_list.h +1 -1
  34. data/include/prism/util/pm_newline_list.h +12 -3
  35. data/include/prism/util/pm_string.h +26 -2
  36. data/include/prism/version.h +2 -2
  37. data/include/prism.h +59 -1
  38. data/lib/prism/compiler.rb +8 -1
  39. data/lib/prism/debug.rb +46 -3
  40. data/lib/prism/desugar_compiler.rb +225 -80
  41. data/lib/prism/dispatcher.rb +29 -0
  42. data/lib/prism/dot_visitor.rb +87 -16
  43. data/lib/prism/dsl.rb +315 -300
  44. data/lib/prism/ffi.rb +165 -84
  45. data/lib/prism/lex_compat.rb +17 -15
  46. data/lib/prism/mutation_compiler.rb +11 -0
  47. data/lib/prism/node.rb +4857 -3750
  48. data/lib/prism/node_ext.rb +77 -29
  49. data/lib/prism/pack.rb +4 -0
  50. data/lib/prism/parse_result/comments.rb +34 -17
  51. data/lib/prism/parse_result/newlines.rb +3 -1
  52. data/lib/prism/parse_result.rb +88 -34
  53. data/lib/prism/pattern.rb +16 -4
  54. data/lib/prism/polyfill/string.rb +12 -0
  55. data/lib/prism/serialize.rb +960 -327
  56. data/lib/prism/translation/parser/compiler.rb +152 -50
  57. data/lib/prism/translation/parser/lexer.rb +103 -22
  58. data/lib/prism/translation/parser/rubocop.rb +47 -11
  59. data/lib/prism/translation/parser.rb +134 -10
  60. data/lib/prism/translation/parser33.rb +12 -0
  61. data/lib/prism/translation/parser34.rb +12 -0
  62. data/lib/prism/translation/ripper/sexp.rb +125 -0
  63. data/lib/prism/translation/ripper/shim.rb +5 -0
  64. data/lib/prism/translation/ripper.rb +3248 -379
  65. data/lib/prism/translation/ruby_parser.rb +35 -18
  66. data/lib/prism/translation.rb +3 -1
  67. data/lib/prism/visitor.rb +10 -0
  68. data/lib/prism.rb +8 -2
  69. data/prism.gemspec +35 -4
  70. data/rbi/prism/compiler.rbi +14 -0
  71. data/rbi/prism/desugar_compiler.rbi +5 -0
  72. data/rbi/prism/mutation_compiler.rbi +5 -0
  73. data/rbi/prism/node.rbi +8221 -0
  74. data/rbi/prism/node_ext.rbi +102 -0
  75. data/rbi/prism/parse_result.rbi +304 -0
  76. data/rbi/prism/translation/parser/compiler.rbi +13 -0
  77. data/rbi/prism/translation/ripper/ripper_compiler.rbi +5 -0
  78. data/rbi/prism/translation/ripper.rbi +25 -0
  79. data/rbi/prism/translation/ruby_parser.rbi +11 -0
  80. data/rbi/prism/visitor.rbi +470 -0
  81. data/rbi/prism.rbi +39 -7749
  82. data/sig/prism/compiler.rbs +9 -0
  83. data/sig/prism/dispatcher.rbs +16 -0
  84. data/sig/prism/dot_visitor.rbs +6 -0
  85. data/sig/prism/dsl.rbs +462 -0
  86. data/sig/prism/mutation_compiler.rbs +158 -0
  87. data/sig/prism/node.rbs +3529 -0
  88. data/sig/prism/node_ext.rbs +78 -0
  89. data/sig/prism/pack.rbs +43 -0
  90. data/sig/prism/parse_result.rbs +127 -0
  91. data/sig/prism/pattern.rbs +13 -0
  92. data/sig/prism/serialize.rbs +7 -0
  93. data/sig/prism/visitor.rbs +168 -0
  94. data/sig/prism.rbs +188 -4767
  95. data/src/diagnostic.c +575 -230
  96. data/src/encoding.c +211 -108
  97. data/src/node.c +7526 -447
  98. data/src/options.c +36 -12
  99. data/src/pack.c +33 -17
  100. data/src/prettyprint.c +1297 -1388
  101. data/src/prism.c +3665 -1121
  102. data/src/regexp.c +17 -2
  103. data/src/serialize.c +47 -28
  104. data/src/static_literals.c +552 -0
  105. data/src/token_type.c +1 -0
  106. data/src/util/pm_buffer.c +147 -20
  107. data/src/util/pm_char.c +4 -4
  108. data/src/util/pm_constant_pool.c +35 -11
  109. data/src/util/pm_integer.c +629 -0
  110. data/src/util/pm_list.c +1 -1
  111. data/src/util/pm_newline_list.c +20 -8
  112. data/src/util/pm_string.c +134 -5
  113. data/src/util/pm_string_list.c +2 -2
  114. metadata +37 -6
  115. data/docs/ripper.md +0 -36
  116. data/rbi/prism_static.rbi +0 -207
  117. data/sig/prism_static.rbs +0 -201
@@ -0,0 +1,158 @@
1
+ # This file is generated by the templates/template.rb script and should not be
2
+ # modified manually. See templates/sig/prism/mutation_compiler.rbs.erb
3
+ # if you are looking to modify the template
4
+
5
+ module Prism
6
+ class MutationCompiler < Compiler
7
+ def visit_alias_global_variable_node: (AliasGlobalVariableNode) -> node?
8
+ def visit_alias_method_node: (AliasMethodNode) -> node?
9
+ def visit_alternation_pattern_node: (AlternationPatternNode) -> node?
10
+ def visit_and_node: (AndNode) -> node?
11
+ def visit_arguments_node: (ArgumentsNode) -> node?
12
+ def visit_array_node: (ArrayNode) -> node?
13
+ def visit_array_pattern_node: (ArrayPatternNode) -> node?
14
+ def visit_assoc_node: (AssocNode) -> node?
15
+ def visit_assoc_splat_node: (AssocSplatNode) -> node?
16
+ def visit_back_reference_read_node: (BackReferenceReadNode) -> node?
17
+ def visit_begin_node: (BeginNode) -> node?
18
+ def visit_block_argument_node: (BlockArgumentNode) -> node?
19
+ def visit_block_local_variable_node: (BlockLocalVariableNode) -> node?
20
+ def visit_block_node: (BlockNode) -> node?
21
+ def visit_block_parameter_node: (BlockParameterNode) -> node?
22
+ def visit_block_parameters_node: (BlockParametersNode) -> node?
23
+ def visit_break_node: (BreakNode) -> node?
24
+ def visit_call_and_write_node: (CallAndWriteNode) -> node?
25
+ def visit_call_node: (CallNode) -> node?
26
+ def visit_call_operator_write_node: (CallOperatorWriteNode) -> node?
27
+ def visit_call_or_write_node: (CallOrWriteNode) -> node?
28
+ def visit_call_target_node: (CallTargetNode) -> node?
29
+ def visit_capture_pattern_node: (CapturePatternNode) -> node?
30
+ def visit_case_match_node: (CaseMatchNode) -> node?
31
+ def visit_case_node: (CaseNode) -> node?
32
+ def visit_class_node: (ClassNode) -> node?
33
+ def visit_class_variable_and_write_node: (ClassVariableAndWriteNode) -> node?
34
+ def visit_class_variable_operator_write_node: (ClassVariableOperatorWriteNode) -> node?
35
+ def visit_class_variable_or_write_node: (ClassVariableOrWriteNode) -> node?
36
+ def visit_class_variable_read_node: (ClassVariableReadNode) -> node?
37
+ def visit_class_variable_target_node: (ClassVariableTargetNode) -> node?
38
+ def visit_class_variable_write_node: (ClassVariableWriteNode) -> node?
39
+ def visit_constant_and_write_node: (ConstantAndWriteNode) -> node?
40
+ def visit_constant_operator_write_node: (ConstantOperatorWriteNode) -> node?
41
+ def visit_constant_or_write_node: (ConstantOrWriteNode) -> node?
42
+ def visit_constant_path_and_write_node: (ConstantPathAndWriteNode) -> node?
43
+ def visit_constant_path_node: (ConstantPathNode) -> node?
44
+ def visit_constant_path_operator_write_node: (ConstantPathOperatorWriteNode) -> node?
45
+ def visit_constant_path_or_write_node: (ConstantPathOrWriteNode) -> node?
46
+ def visit_constant_path_target_node: (ConstantPathTargetNode) -> node?
47
+ def visit_constant_path_write_node: (ConstantPathWriteNode) -> node?
48
+ def visit_constant_read_node: (ConstantReadNode) -> node?
49
+ def visit_constant_target_node: (ConstantTargetNode) -> node?
50
+ def visit_constant_write_node: (ConstantWriteNode) -> node?
51
+ def visit_def_node: (DefNode) -> node?
52
+ def visit_defined_node: (DefinedNode) -> node?
53
+ def visit_else_node: (ElseNode) -> node?
54
+ def visit_embedded_statements_node: (EmbeddedStatementsNode) -> node?
55
+ def visit_embedded_variable_node: (EmbeddedVariableNode) -> node?
56
+ def visit_ensure_node: (EnsureNode) -> node?
57
+ def visit_false_node: (FalseNode) -> node?
58
+ def visit_find_pattern_node: (FindPatternNode) -> node?
59
+ def visit_flip_flop_node: (FlipFlopNode) -> node?
60
+ def visit_float_node: (FloatNode) -> node?
61
+ def visit_for_node: (ForNode) -> node?
62
+ def visit_forwarding_arguments_node: (ForwardingArgumentsNode) -> node?
63
+ def visit_forwarding_parameter_node: (ForwardingParameterNode) -> node?
64
+ def visit_forwarding_super_node: (ForwardingSuperNode) -> node?
65
+ def visit_global_variable_and_write_node: (GlobalVariableAndWriteNode) -> node?
66
+ def visit_global_variable_operator_write_node: (GlobalVariableOperatorWriteNode) -> node?
67
+ def visit_global_variable_or_write_node: (GlobalVariableOrWriteNode) -> node?
68
+ def visit_global_variable_read_node: (GlobalVariableReadNode) -> node?
69
+ def visit_global_variable_target_node: (GlobalVariableTargetNode) -> node?
70
+ def visit_global_variable_write_node: (GlobalVariableWriteNode) -> node?
71
+ def visit_hash_node: (HashNode) -> node?
72
+ def visit_hash_pattern_node: (HashPatternNode) -> node?
73
+ def visit_if_node: (IfNode) -> node?
74
+ def visit_imaginary_node: (ImaginaryNode) -> node?
75
+ def visit_implicit_node: (ImplicitNode) -> node?
76
+ def visit_implicit_rest_node: (ImplicitRestNode) -> node?
77
+ def visit_in_node: (InNode) -> node?
78
+ def visit_index_and_write_node: (IndexAndWriteNode) -> node?
79
+ def visit_index_operator_write_node: (IndexOperatorWriteNode) -> node?
80
+ def visit_index_or_write_node: (IndexOrWriteNode) -> node?
81
+ def visit_index_target_node: (IndexTargetNode) -> node?
82
+ def visit_instance_variable_and_write_node: (InstanceVariableAndWriteNode) -> node?
83
+ def visit_instance_variable_operator_write_node: (InstanceVariableOperatorWriteNode) -> node?
84
+ def visit_instance_variable_or_write_node: (InstanceVariableOrWriteNode) -> node?
85
+ def visit_instance_variable_read_node: (InstanceVariableReadNode) -> node?
86
+ def visit_instance_variable_target_node: (InstanceVariableTargetNode) -> node?
87
+ def visit_instance_variable_write_node: (InstanceVariableWriteNode) -> node?
88
+ def visit_integer_node: (IntegerNode) -> node?
89
+ def visit_interpolated_match_last_line_node: (InterpolatedMatchLastLineNode) -> node?
90
+ def visit_interpolated_regular_expression_node: (InterpolatedRegularExpressionNode) -> node?
91
+ def visit_interpolated_string_node: (InterpolatedStringNode) -> node?
92
+ def visit_interpolated_symbol_node: (InterpolatedSymbolNode) -> node?
93
+ def visit_interpolated_x_string_node: (InterpolatedXStringNode) -> node?
94
+ def visit_it_parameters_node: (ItParametersNode) -> node?
95
+ def visit_keyword_hash_node: (KeywordHashNode) -> node?
96
+ def visit_keyword_rest_parameter_node: (KeywordRestParameterNode) -> node?
97
+ def visit_lambda_node: (LambdaNode) -> node?
98
+ def visit_local_variable_and_write_node: (LocalVariableAndWriteNode) -> node?
99
+ def visit_local_variable_operator_write_node: (LocalVariableOperatorWriteNode) -> node?
100
+ def visit_local_variable_or_write_node: (LocalVariableOrWriteNode) -> node?
101
+ def visit_local_variable_read_node: (LocalVariableReadNode) -> node?
102
+ def visit_local_variable_target_node: (LocalVariableTargetNode) -> node?
103
+ def visit_local_variable_write_node: (LocalVariableWriteNode) -> node?
104
+ def visit_match_last_line_node: (MatchLastLineNode) -> node?
105
+ def visit_match_predicate_node: (MatchPredicateNode) -> node?
106
+ def visit_match_required_node: (MatchRequiredNode) -> node?
107
+ def visit_match_write_node: (MatchWriteNode) -> node?
108
+ def visit_missing_node: (MissingNode) -> node?
109
+ def visit_module_node: (ModuleNode) -> node?
110
+ def visit_multi_target_node: (MultiTargetNode) -> node?
111
+ def visit_multi_write_node: (MultiWriteNode) -> node?
112
+ def visit_next_node: (NextNode) -> node?
113
+ def visit_nil_node: (NilNode) -> node?
114
+ def visit_no_keywords_parameter_node: (NoKeywordsParameterNode) -> node?
115
+ def visit_numbered_parameters_node: (NumberedParametersNode) -> node?
116
+ def visit_numbered_reference_read_node: (NumberedReferenceReadNode) -> node?
117
+ def visit_optional_keyword_parameter_node: (OptionalKeywordParameterNode) -> node?
118
+ def visit_optional_parameter_node: (OptionalParameterNode) -> node?
119
+ def visit_or_node: (OrNode) -> node?
120
+ def visit_parameters_node: (ParametersNode) -> node?
121
+ def visit_parentheses_node: (ParenthesesNode) -> node?
122
+ def visit_pinned_expression_node: (PinnedExpressionNode) -> node?
123
+ def visit_pinned_variable_node: (PinnedVariableNode) -> node?
124
+ def visit_post_execution_node: (PostExecutionNode) -> node?
125
+ def visit_pre_execution_node: (PreExecutionNode) -> node?
126
+ def visit_program_node: (ProgramNode) -> node?
127
+ def visit_range_node: (RangeNode) -> node?
128
+ def visit_rational_node: (RationalNode) -> node?
129
+ def visit_redo_node: (RedoNode) -> node?
130
+ def visit_regular_expression_node: (RegularExpressionNode) -> node?
131
+ def visit_required_keyword_parameter_node: (RequiredKeywordParameterNode) -> node?
132
+ def visit_required_parameter_node: (RequiredParameterNode) -> node?
133
+ def visit_rescue_modifier_node: (RescueModifierNode) -> node?
134
+ def visit_rescue_node: (RescueNode) -> node?
135
+ def visit_rest_parameter_node: (RestParameterNode) -> node?
136
+ def visit_retry_node: (RetryNode) -> node?
137
+ def visit_return_node: (ReturnNode) -> node?
138
+ def visit_self_node: (SelfNode) -> node?
139
+ def visit_shareable_constant_node: (ShareableConstantNode) -> node?
140
+ def visit_singleton_class_node: (SingletonClassNode) -> node?
141
+ def visit_source_encoding_node: (SourceEncodingNode) -> node?
142
+ def visit_source_file_node: (SourceFileNode) -> node?
143
+ def visit_source_line_node: (SourceLineNode) -> node?
144
+ def visit_splat_node: (SplatNode) -> node?
145
+ def visit_statements_node: (StatementsNode) -> node?
146
+ def visit_string_node: (StringNode) -> node?
147
+ def visit_super_node: (SuperNode) -> node?
148
+ def visit_symbol_node: (SymbolNode) -> node?
149
+ def visit_true_node: (TrueNode) -> node?
150
+ def visit_undef_node: (UndefNode) -> node?
151
+ def visit_unless_node: (UnlessNode) -> node?
152
+ def visit_until_node: (UntilNode) -> node?
153
+ def visit_when_node: (WhenNode) -> node?
154
+ def visit_while_node: (WhileNode) -> node?
155
+ def visit_x_string_node: (XStringNode) -> node?
156
+ def visit_yield_node: (YieldNode) -> node?
157
+ end
158
+ end