herb 0.7.5 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +8 -5
  3. data/config.yml +26 -6
  4. data/ext/herb/error_helpers.c +57 -3
  5. data/ext/herb/error_helpers.h +1 -1
  6. data/ext/herb/extconf.rb +1 -0
  7. data/ext/herb/extension.c +10 -24
  8. data/ext/herb/extension_helpers.c +3 -3
  9. data/ext/herb/extension_helpers.h +1 -1
  10. data/ext/herb/nodes.c +72 -37
  11. data/herb.gemspec +0 -2
  12. data/lib/herb/ast/helpers.rb +11 -0
  13. data/lib/herb/ast/node.rb +15 -6
  14. data/lib/herb/ast/nodes.rb +609 -392
  15. data/lib/herb/cli.rb +31 -0
  16. data/lib/herb/colors.rb +82 -0
  17. data/lib/herb/engine/compiler.rb +140 -14
  18. data/lib/herb/engine/debug_visitor.rb +1 -5
  19. data/lib/herb/engine/parser_error_overlay.rb +1 -1
  20. data/lib/herb/engine.rb +8 -14
  21. data/lib/herb/errors.rb +166 -56
  22. data/lib/herb/location.rb +2 -2
  23. data/lib/herb/project.rb +86 -21
  24. data/lib/herb/token.rb +14 -2
  25. data/lib/herb/version.rb +1 -1
  26. data/lib/herb.rb +1 -0
  27. data/sig/herb/ast/helpers.rbs +3 -0
  28. data/sig/herb/ast/node.rbs +12 -5
  29. data/sig/herb/ast/nodes.rbs +124 -62
  30. data/sig/herb/colors.rbs +35 -0
  31. data/sig/herb/engine/compiler.rbs +23 -1
  32. data/sig/herb/errors.rbs +74 -20
  33. data/sig/herb/token.rbs +8 -0
  34. data/sig/herb_c_extension.rbs +1 -1
  35. data/sig/serialized_ast_errors.rbs +8 -0
  36. data/src/analyze.c +420 -171
  37. data/src/analyze_helpers.c +5 -0
  38. data/src/analyze_missing_end.c +147 -0
  39. data/src/analyze_transform.c +196 -0
  40. data/src/analyzed_ruby.c +23 -2
  41. data/src/ast_node.c +5 -5
  42. data/src/ast_nodes.c +179 -179
  43. data/src/ast_pretty_print.c +232 -232
  44. data/src/element_source.c +7 -6
  45. data/src/errors.c +246 -126
  46. data/src/extract.c +92 -34
  47. data/src/herb.c +37 -49
  48. data/src/html_util.c +34 -96
  49. data/src/include/analyze.h +10 -2
  50. data/src/include/analyze_helpers.h +3 -0
  51. data/src/include/analyzed_ruby.h +4 -2
  52. data/src/include/ast_node.h +2 -2
  53. data/src/include/ast_nodes.h +67 -66
  54. data/src/include/ast_pretty_print.h +2 -2
  55. data/src/include/element_source.h +3 -1
  56. data/src/include/errors.h +30 -14
  57. data/src/include/extract.h +4 -4
  58. data/src/include/herb.h +6 -7
  59. data/src/include/html_util.h +4 -5
  60. data/src/include/lexer.h +1 -3
  61. data/src/include/lexer_peek_helpers.h +14 -14
  62. data/src/include/lexer_struct.h +3 -2
  63. data/src/include/macros.h +4 -0
  64. data/src/include/parser.h +12 -6
  65. data/src/include/parser_helpers.h +25 -15
  66. data/src/include/pretty_print.h +38 -28
  67. data/src/include/token.h +5 -8
  68. data/src/include/utf8.h +3 -2
  69. data/src/include/util/hb_arena.h +31 -0
  70. data/src/include/util/hb_arena_debug.h +8 -0
  71. data/src/include/util/hb_array.h +33 -0
  72. data/src/include/util/hb_buffer.h +34 -0
  73. data/src/include/util/hb_string.h +29 -0
  74. data/src/include/util/hb_system.h +9 -0
  75. data/src/include/util.h +3 -14
  76. data/src/include/version.h +1 -1
  77. data/src/include/visitor.h +1 -1
  78. data/src/io.c +7 -4
  79. data/src/lexer.c +61 -88
  80. data/src/lexer_peek_helpers.c +35 -37
  81. data/src/main.c +19 -23
  82. data/src/parser.c +282 -201
  83. data/src/parser_helpers.c +46 -40
  84. data/src/parser_match_tags.c +316 -0
  85. data/src/pretty_print.c +82 -106
  86. data/src/token.c +18 -65
  87. data/src/utf8.c +4 -4
  88. data/src/util/hb_arena.c +179 -0
  89. data/src/util/hb_arena_debug.c +237 -0
  90. data/src/{array.c → util/hb_array.c} +26 -27
  91. data/src/util/hb_buffer.c +203 -0
  92. data/src/util/hb_string.c +85 -0
  93. data/src/util/hb_system.c +30 -0
  94. data/src/util.c +29 -99
  95. data/src/visitor.c +54 -54
  96. data/templates/ext/herb/error_helpers.c.erb +3 -3
  97. data/templates/ext/herb/error_helpers.h.erb +1 -1
  98. data/templates/ext/herb/nodes.c.erb +11 -6
  99. data/templates/java/error_helpers.c.erb +75 -0
  100. data/templates/java/error_helpers.h.erb +20 -0
  101. data/templates/java/nodes.c.erb +97 -0
  102. data/templates/java/nodes.h.erb +23 -0
  103. data/templates/java/org/herb/ast/Errors.java.erb +121 -0
  104. data/templates/java/org/herb/ast/NodeVisitor.java.erb +14 -0
  105. data/templates/java/org/herb/ast/Nodes.java.erb +220 -0
  106. data/templates/java/org/herb/ast/Visitor.java.erb +56 -0
  107. data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +8 -8
  108. data/templates/javascript/packages/node/extension/error_helpers.h.erb +1 -1
  109. data/templates/javascript/packages/node/extension/nodes.cpp.erb +9 -9
  110. data/templates/javascript/packages/node/extension/nodes.h.erb +1 -1
  111. data/templates/lib/herb/ast/nodes.rb.erb +28 -16
  112. data/templates/lib/herb/errors.rb.erb +17 -12
  113. data/templates/rust/src/ast/nodes.rs.erb +220 -0
  114. data/templates/rust/src/errors.rs.erb +216 -0
  115. data/templates/rust/src/nodes.rs.erb +374 -0
  116. data/templates/src/analyze_missing_end.c.erb +36 -0
  117. data/templates/src/analyze_transform.c.erb +24 -0
  118. data/templates/src/ast_nodes.c.erb +14 -14
  119. data/templates/src/ast_pretty_print.c.erb +36 -36
  120. data/templates/src/errors.c.erb +31 -31
  121. data/templates/src/include/ast_nodes.h.erb +10 -9
  122. data/templates/src/include/ast_pretty_print.h.erb +2 -2
  123. data/templates/src/include/errors.h.erb +6 -6
  124. data/templates/src/parser_match_tags.c.erb +38 -0
  125. data/templates/src/visitor.c.erb +4 -4
  126. data/templates/template.rb +22 -3
  127. data/templates/wasm/error_helpers.cpp.erb +9 -9
  128. data/templates/wasm/error_helpers.h.erb +1 -1
  129. data/templates/wasm/nodes.cpp.erb +9 -9
  130. data/templates/wasm/nodes.h.erb +1 -1
  131. data/vendor/prism/Rakefile +4 -1
  132. data/vendor/prism/config.yml +2 -1
  133. data/vendor/prism/include/prism/ast.h +31 -1
  134. data/vendor/prism/include/prism/diagnostic.h +1 -0
  135. data/vendor/prism/include/prism/version.h +3 -3
  136. data/vendor/prism/src/diagnostic.c +3 -1
  137. data/vendor/prism/src/prism.c +130 -71
  138. data/vendor/prism/src/util/pm_string.c +6 -8
  139. data/vendor/prism/templates/include/prism/ast.h.erb +2 -0
  140. data/vendor/prism/templates/java/org/prism/Loader.java.erb +2 -2
  141. data/vendor/prism/templates/javascript/src/deserialize.js.erb +2 -2
  142. data/vendor/prism/templates/lib/prism/serialize.rb.erb +2 -2
  143. data/vendor/prism/templates/sig/prism.rbs.erb +4 -0
  144. data/vendor/prism/templates/src/diagnostic.c.erb +1 -0
  145. metadata +34 -20
  146. data/lib/herb/libherb/array.rb +0 -51
  147. data/lib/herb/libherb/ast_node.rb +0 -50
  148. data/lib/herb/libherb/buffer.rb +0 -56
  149. data/lib/herb/libherb/extract_result.rb +0 -20
  150. data/lib/herb/libherb/lex_result.rb +0 -32
  151. data/lib/herb/libherb/libherb.rb +0 -52
  152. data/lib/herb/libherb/parse_result.rb +0 -20
  153. data/lib/herb/libherb/token.rb +0 -46
  154. data/lib/herb/libherb.rb +0 -35
  155. data/src/buffer.c +0 -241
  156. data/src/include/array.h +0 -33
  157. data/src/include/buffer.h +0 -39
  158. data/src/include/json.h +0 -28
  159. data/src/include/memory.h +0 -12
  160. data/src/json.c +0 -205
  161. data/src/memory.c +0 -53
@@ -14,16 +14,16 @@
14
14
  /**
15
15
  * The minor version of the Prism library as an int.
16
16
  */
17
- #define PRISM_VERSION_MINOR 5
17
+ #define PRISM_VERSION_MINOR 6
18
18
 
19
19
  /**
20
20
  * The patch version of the Prism library as an int.
21
21
  */
22
- #define PRISM_VERSION_PATCH 1
22
+ #define PRISM_VERSION_PATCH 0
23
23
 
24
24
  /**
25
25
  * The version of the Prism library as a constant string.
26
26
  */
27
- #define PRISM_VERSION "1.5.1"
27
+ #define PRISM_VERSION "1.6.0"
28
28
 
29
29
  #endif
@@ -10,7 +10,7 @@
10
10
 
11
11
  #include "prism/diagnostic.h"
12
12
 
13
- #define PM_DIAGNOSTIC_ID_MAX 321
13
+ #define PM_DIAGNOSTIC_ID_MAX 322
14
14
 
15
15
  /** This struct holds the data for each diagnostic. */
16
16
  typedef struct {
@@ -154,6 +154,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
154
154
  [PM_ERR_CONDITIONAL_WHILE_PREDICATE] = { "expected a predicate expression for the `while` statement", PM_ERROR_LEVEL_SYNTAX },
155
155
  [PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT] = { "expected a constant after the `::` operator", PM_ERROR_LEVEL_SYNTAX },
156
156
  [PM_ERR_DEF_ENDLESS] = { "could not parse the endless method body", PM_ERROR_LEVEL_SYNTAX },
157
+ [PM_ERR_DEF_ENDLESS_PARAMETERS] = { "could not parse the endless method parameters", PM_ERROR_LEVEL_SYNTAX },
157
158
  [PM_ERR_DEF_ENDLESS_SETTER] = { "invalid method name; a setter method cannot be defined in an endless method definition", PM_ERROR_LEVEL_SYNTAX },
158
159
  [PM_ERR_DEF_NAME] = { "unexpected %s; expected a method name", PM_ERROR_LEVEL_SYNTAX },
159
160
  [PM_ERR_DEF_PARAMS_TERM] = { "expected a delimiter to close the parameters", PM_ERROR_LEVEL_SYNTAX },
@@ -482,6 +483,7 @@ pm_diagnostic_id_human(pm_diagnostic_id_t diag_id) {
482
483
  case PM_ERR_CONDITIONAL_WHILE_PREDICATE: return "conditional_while_predicate";
483
484
  case PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT: return "constant_path_colon_colon_constant";
484
485
  case PM_ERR_DEF_ENDLESS: return "def_endless";
486
+ case PM_ERR_DEF_ENDLESS_PARAMETERS: return "def_endless_parameters";
485
487
  case PM_ERR_DEF_ENDLESS_SETTER: return "def_endless_setter";
486
488
  case PM_ERR_DEF_NAME: return "def_name";
487
489
  case PM_ERR_DEF_PARAMS_TERM: return "def_params_term";
@@ -2622,10 +2622,11 @@ pm_break_node_create(pm_parser_t *parser, const pm_token_t *keyword, pm_argument
2622
2622
  // There are certain flags that we want to use internally but don't want to
2623
2623
  // expose because they are not relevant beyond parsing. Therefore we'll define
2624
2624
  // them here and not define them in config.yml/a header file.
2625
- static const pm_node_flags_t PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY = 0x4;
2626
- static const pm_node_flags_t PM_CALL_NODE_FLAGS_IMPLICIT_ARRAY = 0x40;
2627
- static const pm_node_flags_t PM_CALL_NODE_FLAGS_COMPARISON = 0x80;
2628
- static const pm_node_flags_t PM_CALL_NODE_FLAGS_INDEX = 0x100;
2625
+ static const pm_node_flags_t PM_WRITE_NODE_FLAGS_IMPLICIT_ARRAY = (1 << 2);
2626
+
2627
+ static const pm_node_flags_t PM_CALL_NODE_FLAGS_IMPLICIT_ARRAY = ((PM_CALL_NODE_FLAGS_LAST - 1) << 1);
2628
+ static const pm_node_flags_t PM_CALL_NODE_FLAGS_COMPARISON = ((PM_CALL_NODE_FLAGS_LAST - 1) << 2);
2629
+ static const pm_node_flags_t PM_CALL_NODE_FLAGS_INDEX = ((PM_CALL_NODE_FLAGS_LAST - 1) << 3);
2629
2630
 
2630
2631
  /**
2631
2632
  * Allocate and initialize a new CallNode node. This sets everything to NULL or
@@ -5279,6 +5280,12 @@ pm_interpolated_string_node_append(pm_interpolated_string_node_t *node, pm_node_
5279
5280
 
5280
5281
  switch (PM_NODE_TYPE(part)) {
5281
5282
  case PM_STRING_NODE:
5283
+ // If inner string is not frozen, it stops being a static literal. We should *not* clear other flags,
5284
+ // because concatenating two frozen strings (`'foo' 'bar'`) is still frozen. This holds true for
5285
+ // as long as this interpolation only consists of other string literals.
5286
+ if (!PM_NODE_FLAG_P(part, PM_STRING_FLAGS_FROZEN)) {
5287
+ pm_node_flag_unset((pm_node_t *) node, PM_NODE_FLAG_STATIC_LITERAL);
5288
+ }
5282
5289
  part->flags = (pm_node_flags_t) ((part->flags | PM_NODE_FLAG_STATIC_LITERAL | PM_STRING_FLAGS_FROZEN) & ~PM_STRING_FLAGS_MUTABLE);
5283
5290
  break;
5284
5291
  case PM_INTERPOLATED_STRING_NODE:
@@ -8584,64 +8591,64 @@ parser_lex_magic_comment(pm_parser_t *parser, bool semantic_token_seen) {
8584
8591
 
8585
8592
  static const uint32_t context_terminators[] = {
8586
8593
  [PM_CONTEXT_NONE] = 0,
8587
- [PM_CONTEXT_BEGIN] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_END),
8588
- [PM_CONTEXT_BEGIN_ENSURE] = (1 << PM_TOKEN_KEYWORD_END),
8589
- [PM_CONTEXT_BEGIN_ELSE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_END),
8590
- [PM_CONTEXT_BEGIN_RESCUE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_END),
8591
- [PM_CONTEXT_BLOCK_BRACES] = (1 << PM_TOKEN_BRACE_RIGHT),
8592
- [PM_CONTEXT_BLOCK_KEYWORDS] = (1 << PM_TOKEN_KEYWORD_END) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ENSURE),
8593
- [PM_CONTEXT_BLOCK_ENSURE] = (1 << PM_TOKEN_KEYWORD_END),
8594
- [PM_CONTEXT_BLOCK_ELSE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_END),
8595
- [PM_CONTEXT_BLOCK_RESCUE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_END),
8596
- [PM_CONTEXT_CASE_WHEN] = (1 << PM_TOKEN_KEYWORD_WHEN) | (1 << PM_TOKEN_KEYWORD_END) | (1 << PM_TOKEN_KEYWORD_ELSE),
8597
- [PM_CONTEXT_CASE_IN] = (1 << PM_TOKEN_KEYWORD_IN) | (1 << PM_TOKEN_KEYWORD_END) | (1 << PM_TOKEN_KEYWORD_ELSE),
8598
- [PM_CONTEXT_CLASS] = (1 << PM_TOKEN_KEYWORD_END) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ENSURE),
8599
- [PM_CONTEXT_CLASS_ENSURE] = (1 << PM_TOKEN_KEYWORD_END),
8600
- [PM_CONTEXT_CLASS_ELSE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_END),
8601
- [PM_CONTEXT_CLASS_RESCUE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_END),
8602
- [PM_CONTEXT_DEF] = (1 << PM_TOKEN_KEYWORD_END) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ENSURE),
8603
- [PM_CONTEXT_DEF_ENSURE] = (1 << PM_TOKEN_KEYWORD_END),
8604
- [PM_CONTEXT_DEF_ELSE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_END),
8605
- [PM_CONTEXT_DEF_RESCUE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_END),
8606
- [PM_CONTEXT_DEF_PARAMS] = (1 << PM_TOKEN_EOF),
8607
- [PM_CONTEXT_DEFINED] = (1 << PM_TOKEN_EOF),
8608
- [PM_CONTEXT_DEFAULT_PARAMS] = (1 << PM_TOKEN_COMMA) | (1 << PM_TOKEN_PARENTHESIS_RIGHT),
8609
- [PM_CONTEXT_ELSE] = (1 << PM_TOKEN_KEYWORD_END),
8610
- [PM_CONTEXT_ELSIF] = (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_ELSIF) | (1 << PM_TOKEN_KEYWORD_END),
8611
- [PM_CONTEXT_EMBEXPR] = (1 << PM_TOKEN_EMBEXPR_END),
8612
- [PM_CONTEXT_FOR] = (1 << PM_TOKEN_KEYWORD_END),
8613
- [PM_CONTEXT_FOR_INDEX] = (1 << PM_TOKEN_KEYWORD_IN),
8614
- [PM_CONTEXT_IF] = (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_ELSIF) | (1 << PM_TOKEN_KEYWORD_END),
8615
- [PM_CONTEXT_LAMBDA_BRACES] = (1 << PM_TOKEN_BRACE_RIGHT),
8616
- [PM_CONTEXT_LAMBDA_DO_END] = (1 << PM_TOKEN_KEYWORD_END) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ENSURE),
8617
- [PM_CONTEXT_LAMBDA_ENSURE] = (1 << PM_TOKEN_KEYWORD_END),
8618
- [PM_CONTEXT_LAMBDA_ELSE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_END),
8619
- [PM_CONTEXT_LAMBDA_RESCUE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_END),
8620
- [PM_CONTEXT_LOOP_PREDICATE] = (1 << PM_TOKEN_KEYWORD_DO) | (1 << PM_TOKEN_KEYWORD_THEN),
8621
- [PM_CONTEXT_MAIN] = (1 << PM_TOKEN_EOF),
8622
- [PM_CONTEXT_MODULE] = (1 << PM_TOKEN_KEYWORD_END) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ENSURE),
8623
- [PM_CONTEXT_MODULE_ENSURE] = (1 << PM_TOKEN_KEYWORD_END),
8624
- [PM_CONTEXT_MODULE_ELSE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_END),
8625
- [PM_CONTEXT_MODULE_RESCUE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_END),
8626
- [PM_CONTEXT_MULTI_TARGET] = (1 << PM_TOKEN_EOF),
8627
- [PM_CONTEXT_PARENS] = (1 << PM_TOKEN_PARENTHESIS_RIGHT),
8628
- [PM_CONTEXT_POSTEXE] = (1 << PM_TOKEN_BRACE_RIGHT),
8629
- [PM_CONTEXT_PREDICATE] = (1 << PM_TOKEN_KEYWORD_THEN) | (1 << PM_TOKEN_NEWLINE) | (1 << PM_TOKEN_SEMICOLON),
8630
- [PM_CONTEXT_PREEXE] = (1 << PM_TOKEN_BRACE_RIGHT),
8631
- [PM_CONTEXT_RESCUE_MODIFIER] = (1 << PM_TOKEN_EOF),
8632
- [PM_CONTEXT_SCLASS] = (1 << PM_TOKEN_KEYWORD_END) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ENSURE),
8633
- [PM_CONTEXT_SCLASS_ENSURE] = (1 << PM_TOKEN_KEYWORD_END),
8634
- [PM_CONTEXT_SCLASS_ELSE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_END),
8635
- [PM_CONTEXT_SCLASS_RESCUE] = (1 << PM_TOKEN_KEYWORD_ENSURE) | (1 << PM_TOKEN_KEYWORD_RESCUE) | (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_END),
8636
- [PM_CONTEXT_TERNARY] = (1 << PM_TOKEN_EOF),
8637
- [PM_CONTEXT_UNLESS] = (1 << PM_TOKEN_KEYWORD_ELSE) | (1 << PM_TOKEN_KEYWORD_END),
8638
- [PM_CONTEXT_UNTIL] = (1 << PM_TOKEN_KEYWORD_END),
8639
- [PM_CONTEXT_WHILE] = (1 << PM_TOKEN_KEYWORD_END),
8594
+ [PM_CONTEXT_BEGIN] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END),
8595
+ [PM_CONTEXT_BEGIN_ENSURE] = (1U << PM_TOKEN_KEYWORD_END),
8596
+ [PM_CONTEXT_BEGIN_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END),
8597
+ [PM_CONTEXT_BEGIN_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END),
8598
+ [PM_CONTEXT_BLOCK_BRACES] = (1U << PM_TOKEN_BRACE_RIGHT),
8599
+ [PM_CONTEXT_BLOCK_KEYWORDS] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE),
8600
+ [PM_CONTEXT_BLOCK_ENSURE] = (1U << PM_TOKEN_KEYWORD_END),
8601
+ [PM_CONTEXT_BLOCK_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END),
8602
+ [PM_CONTEXT_BLOCK_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END),
8603
+ [PM_CONTEXT_CASE_WHEN] = (1U << PM_TOKEN_KEYWORD_WHEN) | (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_ELSE),
8604
+ [PM_CONTEXT_CASE_IN] = (1U << PM_TOKEN_KEYWORD_IN) | (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_ELSE),
8605
+ [PM_CONTEXT_CLASS] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE),
8606
+ [PM_CONTEXT_CLASS_ENSURE] = (1U << PM_TOKEN_KEYWORD_END),
8607
+ [PM_CONTEXT_CLASS_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END),
8608
+ [PM_CONTEXT_CLASS_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END),
8609
+ [PM_CONTEXT_DEF] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE),
8610
+ [PM_CONTEXT_DEF_ENSURE] = (1U << PM_TOKEN_KEYWORD_END),
8611
+ [PM_CONTEXT_DEF_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END),
8612
+ [PM_CONTEXT_DEF_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END),
8613
+ [PM_CONTEXT_DEF_PARAMS] = (1U << PM_TOKEN_EOF),
8614
+ [PM_CONTEXT_DEFINED] = (1U << PM_TOKEN_EOF),
8615
+ [PM_CONTEXT_DEFAULT_PARAMS] = (1U << PM_TOKEN_COMMA) | (1U << PM_TOKEN_PARENTHESIS_RIGHT),
8616
+ [PM_CONTEXT_ELSE] = (1U << PM_TOKEN_KEYWORD_END),
8617
+ [PM_CONTEXT_ELSIF] = (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_ELSIF) | (1U << PM_TOKEN_KEYWORD_END),
8618
+ [PM_CONTEXT_EMBEXPR] = (1U << PM_TOKEN_EMBEXPR_END),
8619
+ [PM_CONTEXT_FOR] = (1U << PM_TOKEN_KEYWORD_END),
8620
+ [PM_CONTEXT_FOR_INDEX] = (1U << PM_TOKEN_KEYWORD_IN),
8621
+ [PM_CONTEXT_IF] = (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_ELSIF) | (1U << PM_TOKEN_KEYWORD_END),
8622
+ [PM_CONTEXT_LAMBDA_BRACES] = (1U << PM_TOKEN_BRACE_RIGHT),
8623
+ [PM_CONTEXT_LAMBDA_DO_END] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE),
8624
+ [PM_CONTEXT_LAMBDA_ENSURE] = (1U << PM_TOKEN_KEYWORD_END),
8625
+ [PM_CONTEXT_LAMBDA_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END),
8626
+ [PM_CONTEXT_LAMBDA_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END),
8627
+ [PM_CONTEXT_LOOP_PREDICATE] = (1U << PM_TOKEN_KEYWORD_DO) | (1U << PM_TOKEN_KEYWORD_THEN),
8628
+ [PM_CONTEXT_MAIN] = (1U << PM_TOKEN_EOF),
8629
+ [PM_CONTEXT_MODULE] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE),
8630
+ [PM_CONTEXT_MODULE_ENSURE] = (1U << PM_TOKEN_KEYWORD_END),
8631
+ [PM_CONTEXT_MODULE_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END),
8632
+ [PM_CONTEXT_MODULE_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END),
8633
+ [PM_CONTEXT_MULTI_TARGET] = (1U << PM_TOKEN_EOF),
8634
+ [PM_CONTEXT_PARENS] = (1U << PM_TOKEN_PARENTHESIS_RIGHT),
8635
+ [PM_CONTEXT_POSTEXE] = (1U << PM_TOKEN_BRACE_RIGHT),
8636
+ [PM_CONTEXT_PREDICATE] = (1U << PM_TOKEN_KEYWORD_THEN) | (1U << PM_TOKEN_NEWLINE) | (1U << PM_TOKEN_SEMICOLON),
8637
+ [PM_CONTEXT_PREEXE] = (1U << PM_TOKEN_BRACE_RIGHT),
8638
+ [PM_CONTEXT_RESCUE_MODIFIER] = (1U << PM_TOKEN_EOF),
8639
+ [PM_CONTEXT_SCLASS] = (1U << PM_TOKEN_KEYWORD_END) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ENSURE),
8640
+ [PM_CONTEXT_SCLASS_ENSURE] = (1U << PM_TOKEN_KEYWORD_END),
8641
+ [PM_CONTEXT_SCLASS_ELSE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_END),
8642
+ [PM_CONTEXT_SCLASS_RESCUE] = (1U << PM_TOKEN_KEYWORD_ENSURE) | (1U << PM_TOKEN_KEYWORD_RESCUE) | (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END),
8643
+ [PM_CONTEXT_TERNARY] = (1U << PM_TOKEN_EOF),
8644
+ [PM_CONTEXT_UNLESS] = (1U << PM_TOKEN_KEYWORD_ELSE) | (1U << PM_TOKEN_KEYWORD_END),
8645
+ [PM_CONTEXT_UNTIL] = (1U << PM_TOKEN_KEYWORD_END),
8646
+ [PM_CONTEXT_WHILE] = (1U << PM_TOKEN_KEYWORD_END),
8640
8647
  };
8641
8648
 
8642
8649
  static inline bool
8643
8650
  context_terminator(pm_context_t context, pm_token_t *token) {
8644
- return token->type < 32 && (context_terminators[context] & (1 << token->type));
8651
+ return token->type < 32 && (context_terminators[context] & (1U << token->type));
8645
8652
  }
8646
8653
 
8647
8654
  /**
@@ -14443,6 +14450,17 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for
14443
14450
  if (accepted_newline) {
14444
14451
  pm_parser_err_previous(parser, PM_ERR_INVALID_COMMA);
14445
14452
  }
14453
+
14454
+ // If this is a command call and an argument takes a block,
14455
+ // there can be no further arguments. For example,
14456
+ // `foo(bar 1 do end, 2)` should be rejected.
14457
+ if (PM_NODE_TYPE_P(argument, PM_CALL_NODE)) {
14458
+ pm_call_node_t *call = (pm_call_node_t *) argument;
14459
+ if (call->opening_loc.start == NULL && call->arguments != NULL && call->block != NULL) {
14460
+ pm_parser_err_previous(parser, PM_ERR_INVALID_COMMA);
14461
+ break;
14462
+ }
14463
+ }
14446
14464
  } else {
14447
14465
  // If there is no comma at the end of the argument list then we're
14448
14466
  // done parsing arguments and can break out of this loop.
@@ -14594,6 +14612,18 @@ update_parameter_state(pm_parser_t *parser, pm_token_t *token, pm_parameters_ord
14594
14612
  return true;
14595
14613
  }
14596
14614
 
14615
+ /**
14616
+ * Ensures that after parsing a parameter, the next token is not `=`.
14617
+ * Some parameters like `def(* = 1)` cannot become optional. When no parens
14618
+ * are present like in `def * = 1`, this creates ambiguity with endless method definitions.
14619
+ */
14620
+ static inline void
14621
+ refute_optional_parameter(pm_parser_t *parser) {
14622
+ if (match1(parser, PM_TOKEN_EQUAL)) {
14623
+ pm_parser_err_previous(parser, PM_ERR_DEF_ENDLESS_PARAMETERS);
14624
+ }
14625
+ }
14626
+
14597
14627
  /**
14598
14628
  * Parse a list of parameters on a method definition.
14599
14629
  */
@@ -14646,6 +14676,10 @@ parse_parameters(
14646
14676
  parser->current_scope->parameters |= PM_SCOPE_PARAMETERS_FORWARDING_BLOCK;
14647
14677
  }
14648
14678
 
14679
+ if (!uses_parentheses) {
14680
+ refute_optional_parameter(parser);
14681
+ }
14682
+
14649
14683
  pm_block_parameter_node_t *param = pm_block_parameter_node_create(parser, &name, &operator);
14650
14684
  if (repeated) {
14651
14685
  pm_node_flag_set_repeated_parameter((pm_node_t *)param);
@@ -14667,6 +14701,10 @@ parse_parameters(
14667
14701
  bool succeeded = update_parameter_state(parser, &parser->current, &order);
14668
14702
  parser_lex(parser);
14669
14703
 
14704
+ if (!uses_parentheses) {
14705
+ refute_optional_parameter(parser);
14706
+ }
14707
+
14670
14708
  parser->current_scope->parameters |= PM_SCOPE_PARAMETERS_FORWARDING_ALL;
14671
14709
  pm_forwarding_parameter_node_t *param = pm_forwarding_parameter_node_create(parser, &parser->previous);
14672
14710
 
@@ -14848,6 +14886,10 @@ parse_parameters(
14848
14886
  context_pop(parser);
14849
14887
  pm_parameters_node_keywords_append(params, param);
14850
14888
 
14889
+ if (!uses_parentheses) {
14890
+ refute_optional_parameter(parser);
14891
+ }
14892
+
14851
14893
  // If parsing the value of the parameter resulted in error recovery,
14852
14894
  // then we can put a missing node in its place and stop parsing the
14853
14895
  // parameters entirely now.
@@ -14879,6 +14921,10 @@ parse_parameters(
14879
14921
  parser->current_scope->parameters |= PM_SCOPE_PARAMETERS_FORWARDING_POSITIONALS;
14880
14922
  }
14881
14923
 
14924
+ if (!uses_parentheses) {
14925
+ refute_optional_parameter(parser);
14926
+ }
14927
+
14882
14928
  pm_node_t *param = (pm_node_t *) pm_rest_parameter_node_create(parser, &operator, &name);
14883
14929
  if (repeated) {
14884
14930
  pm_node_flag_set_repeated_parameter(param);
@@ -14927,6 +14973,10 @@ parse_parameters(
14927
14973
  }
14928
14974
  }
14929
14975
 
14976
+ if (!uses_parentheses) {
14977
+ refute_optional_parameter(parser);
14978
+ }
14979
+
14930
14980
  if (params->keyword_rest == NULL) {
14931
14981
  pm_parameters_node_keyword_rest_set(params, param);
14932
14982
  } else {
@@ -18491,20 +18541,28 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
18491
18541
  return (pm_node_t *) node;
18492
18542
  }
18493
18543
  case PM_TOKEN_CHARACTER_LITERAL: {
18494
- parser_lex(parser);
18495
-
18496
- pm_token_t opening = parser->previous;
18497
- opening.type = PM_TOKEN_STRING_BEGIN;
18498
- opening.end = opening.start + 1;
18499
-
18500
- pm_token_t content = parser->previous;
18501
- content.type = PM_TOKEN_STRING_CONTENT;
18502
- content.start = content.start + 1;
18503
-
18504
18544
  pm_token_t closing = not_provided(parser);
18505
- pm_node_t *node = (pm_node_t *) pm_string_node_create_current_string(parser, &opening, &content, &closing);
18545
+ pm_node_t *node = (pm_node_t *) pm_string_node_create_current_string(
18546
+ parser,
18547
+ &(pm_token_t) {
18548
+ .type = PM_TOKEN_STRING_BEGIN,
18549
+ .start = parser->current.start,
18550
+ .end = parser->current.start + 1
18551
+ },
18552
+ &(pm_token_t) {
18553
+ .type = PM_TOKEN_STRING_CONTENT,
18554
+ .start = parser->current.start + 1,
18555
+ .end = parser->current.end
18556
+ },
18557
+ &closing
18558
+ );
18559
+
18506
18560
  pm_node_flag_set(node, parse_unescaped_encoding(parser));
18507
18561
 
18562
+ // Skip past the character literal here, since now we have handled
18563
+ // parser->explicit_encoding correctly.
18564
+ parser_lex(parser);
18565
+
18508
18566
  // Characters can be followed by strings in which case they are
18509
18567
  // automatically concatenated.
18510
18568
  if (match1(parser, PM_TOKEN_STRING_BEGIN)) {
@@ -20901,7 +20959,7 @@ parse_assignment_values(pm_parser_t *parser, pm_binding_power_t previous_binding
20901
20959
  bool permitted = true;
20902
20960
  if (previous_binding_power != PM_BINDING_POWER_STATEMENT && match1(parser, PM_TOKEN_USTAR)) permitted = false;
20903
20961
 
20904
- pm_node_t *value = parse_starred_expression(parser, binding_power, previous_binding_power == PM_BINDING_POWER_ASSIGNMENT ? accepts_command_call : previous_binding_power < PM_BINDING_POWER_MATCH, diag_id, (uint16_t) (depth + 1));
20962
+ pm_node_t *value = parse_starred_expression(parser, binding_power, previous_binding_power == PM_BINDING_POWER_ASSIGNMENT ? accepts_command_call : previous_binding_power < PM_BINDING_POWER_MODIFIER, diag_id, (uint16_t) (depth + 1));
20905
20963
  if (!permitted) pm_parser_err_node(parser, value, PM_ERR_UNEXPECTED_MULTI_WRITE);
20906
20964
 
20907
20965
  parse_assignment_value_local(parser, value);
@@ -22498,9 +22556,10 @@ parse_program(pm_parser_t *parser) {
22498
22556
  statements = wrap_statements(parser, statements);
22499
22557
  } else {
22500
22558
  flush_block_exits(parser, previous_block_exits);
22501
- pm_node_list_free(&current_block_exits);
22502
22559
  }
22503
22560
 
22561
+ pm_node_list_free(&current_block_exits);
22562
+
22504
22563
  // If this is an empty file, then we're still going to parse all of the
22505
22564
  // statements in order to gather up all of the comments and such. Here we'll
22506
22565
  // correct the location information.
@@ -1,5 +1,7 @@
1
1
  #include "prism/util/pm_string.h"
2
2
 
3
+ static const uint8_t empty_source[] = "";
4
+
3
5
  /**
4
6
  * Returns the size of the pm_string_t struct. This is necessary to allocate the
5
7
  * correct amount of memory in the FFI backend.
@@ -133,8 +135,7 @@ pm_string_mapped_init(pm_string_t *string, const char *filepath) {
133
135
  // the source to a constant empty string and return.
134
136
  if (file_size == 0) {
135
137
  pm_string_file_handle_close(&handle);
136
- const uint8_t source[] = "";
137
- *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 };
138
+ *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = empty_source, .length = 0 };
138
139
  return PM_STRING_INIT_SUCCESS;
139
140
  }
140
141
 
@@ -182,8 +183,7 @@ pm_string_mapped_init(pm_string_t *string, const char *filepath) {
182
183
 
183
184
  if (size == 0) {
184
185
  close(fd);
185
- const uint8_t source[] = "";
186
- *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 };
186
+ *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = empty_source, .length = 0 };
187
187
  return PM_STRING_INIT_SUCCESS;
188
188
  }
189
189
 
@@ -225,8 +225,7 @@ pm_string_file_init(pm_string_t *string, const char *filepath) {
225
225
  // the source to a constant empty string and return.
226
226
  if (file_size == 0) {
227
227
  pm_string_file_handle_close(&handle);
228
- const uint8_t source[] = "";
229
- *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 };
228
+ *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = empty_source, .length = 0 };
230
229
  return PM_STRING_INIT_SUCCESS;
231
230
  }
232
231
 
@@ -278,8 +277,7 @@ pm_string_file_init(pm_string_t *string, const char *filepath) {
278
277
  size_t size = (size_t) sb.st_size;
279
278
  if (size == 0) {
280
279
  close(fd);
281
- const uint8_t source[] = "";
282
- *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = source, .length = 0 };
280
+ *string = (pm_string_t) { .type = PM_STRING_CONSTANT, .source = empty_source, .length = 0 };
283
281
  return PM_STRING_INIT_SUCCESS;
284
282
  }
285
283
 
@@ -212,6 +212,8 @@ typedef enum pm_<%= flag.human %> {
212
212
  /** <%= value.comment %> */
213
213
  PM_<%= flag.human.upcase %>_<%= value.name %> = <%= 1 << (index + Prism::Template::COMMON_FLAGS_COUNT) %>,
214
214
  <%- end -%>
215
+
216
+ PM_<%= flag.human.upcase %>_LAST,
215
217
  } pm_<%= flag.human %>_t;
216
218
  <%- end -%>
217
219
 
@@ -101,8 +101,8 @@ public class Loader {
101
101
  expect((byte) 'M', "incorrect prism header");
102
102
 
103
103
  expect((byte) 1, "prism major version does not match");
104
- expect((byte) 5, "prism minor version does not match");
105
- expect((byte) 1, "prism patch version does not match");
104
+ expect((byte) 6, "prism minor version does not match");
105
+ expect((byte) 0, "prism patch version does not match");
106
106
 
107
107
  expect((byte) 1, "Loader.java requires no location fields in the serialized output");
108
108
 
@@ -1,8 +1,8 @@
1
1
  import * as nodes from "./nodes.js";
2
2
 
3
3
  const MAJOR_VERSION = 1;
4
- const MINOR_VERSION = 5;
5
- const PATCH_VERSION = 1;
4
+ const MINOR_VERSION = 6;
5
+ const PATCH_VERSION = 0;
6
6
 
7
7
  // The DataView getFloat64 function takes an optional second argument that
8
8
  // specifies whether the number is little-endian or big-endian. It does not
@@ -10,11 +10,11 @@ module Prism
10
10
 
11
11
  # The minor version of prism that we are expecting to find in the serialized
12
12
  # strings.
13
- MINOR_VERSION = 5
13
+ MINOR_VERSION = 6
14
14
 
15
15
  # The patch version of prism that we are expecting to find in the serialized
16
16
  # strings.
17
- PATCH_VERSION = 1
17
+ PATCH_VERSION = 0
18
18
 
19
19
  # Deserialize the dumped output from a request to parse or parse_file.
20
20
  #
@@ -2,6 +2,10 @@ module Prism
2
2
  BACKEND: :CEXT | :FFI
3
3
  VERSION: String
4
4
 
5
+ class CurrentVersionError < ArgumentError
6
+ def initialize: (String version) -> void
7
+ end
8
+
5
9
  # Methods taking a Ruby source code string:
6
10
  <%-
7
11
  {
@@ -144,6 +144,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
144
144
  [PM_ERR_CONDITIONAL_WHILE_PREDICATE] = { "expected a predicate expression for the `while` statement", PM_ERROR_LEVEL_SYNTAX },
145
145
  [PM_ERR_CONSTANT_PATH_COLON_COLON_CONSTANT] = { "expected a constant after the `::` operator", PM_ERROR_LEVEL_SYNTAX },
146
146
  [PM_ERR_DEF_ENDLESS] = { "could not parse the endless method body", PM_ERROR_LEVEL_SYNTAX },
147
+ [PM_ERR_DEF_ENDLESS_PARAMETERS] = { "could not parse the endless method parameters", PM_ERROR_LEVEL_SYNTAX },
147
148
  [PM_ERR_DEF_ENDLESS_SETTER] = { "invalid method name; a setter method cannot be defined in an endless method definition", PM_ERROR_LEVEL_SYNTAX },
148
149
  [PM_ERR_DEF_NAME] = { "unexpected %s; expected a method name", PM_ERROR_LEVEL_SYNTAX },
149
150
  [PM_ERR_DEF_PARAMS_TERM] = { "expected a delimiter to close the parameters", PM_ERROR_LEVEL_SYNTAX },
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: herb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Roth
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-10-06 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: Powerful and seamless HTML-aware ERB parsing and tooling.
13
13
  email:
@@ -40,6 +40,7 @@ files:
40
40
  - lib/herb/ast/node.rb
41
41
  - lib/herb/ast/nodes.rb
42
42
  - lib/herb/cli.rb
43
+ - lib/herb/colors.rb
43
44
  - lib/herb/engine.rb
44
45
  - lib/herb/engine/compiler.rb
45
46
  - lib/herb/engine/debug_visitor.rb
@@ -53,15 +54,6 @@ files:
53
54
  - lib/herb/engine/validators/security_validator.rb
54
55
  - lib/herb/errors.rb
55
56
  - lib/herb/lex_result.rb
56
- - lib/herb/libherb.rb
57
- - lib/herb/libherb/array.rb
58
- - lib/herb/libherb/ast_node.rb
59
- - lib/herb/libherb/buffer.rb
60
- - lib/herb/libherb/extract_result.rb
61
- - lib/herb/libherb/lex_result.rb
62
- - lib/herb/libherb/libherb.rb
63
- - lib/herb/libherb/parse_result.rb
64
- - lib/herb/libherb/token.rb
65
57
  - lib/herb/location.rb
66
58
  - lib/herb/parse_result.rb
67
59
  - lib/herb/position.rb
@@ -78,6 +70,7 @@ files:
78
70
  - sig/herb/ast/helpers.rbs
79
71
  - sig/herb/ast/node.rbs
80
72
  - sig/herb/ast/nodes.rbs
73
+ - sig/herb/colors.rbs
81
74
  - sig/herb/engine.rbs
82
75
  - sig/herb/engine/compiler.rbs
83
76
  - sig/herb/engine/debug.rbs
@@ -108,12 +101,12 @@ files:
108
101
  - sig/serialized_ast_nodes.rbs
109
102
  - src/analyze.c
110
103
  - src/analyze_helpers.c
104
+ - src/analyze_missing_end.c
105
+ - src/analyze_transform.c
111
106
  - src/analyzed_ruby.c
112
- - src/array.c
113
107
  - src/ast_node.c
114
108
  - src/ast_nodes.c
115
109
  - src/ast_pretty_print.c
116
- - src/buffer.c
117
110
  - src/element_source.c
118
111
  - src/errors.c
119
112
  - src/extract.c
@@ -122,24 +115,20 @@ files:
122
115
  - src/include/analyze.h
123
116
  - src/include/analyze_helpers.h
124
117
  - src/include/analyzed_ruby.h
125
- - src/include/array.h
126
118
  - src/include/ast_node.h
127
119
  - src/include/ast_nodes.h
128
120
  - src/include/ast_pretty_print.h
129
- - src/include/buffer.h
130
121
  - src/include/element_source.h
131
122
  - src/include/errors.h
132
123
  - src/include/extract.h
133
124
  - src/include/herb.h
134
125
  - src/include/html_util.h
135
126
  - src/include/io.h
136
- - src/include/json.h
137
127
  - src/include/lexer.h
138
128
  - src/include/lexer_peek_helpers.h
139
129
  - src/include/lexer_struct.h
140
130
  - src/include/location.h
141
131
  - src/include/macros.h
142
- - src/include/memory.h
143
132
  - src/include/parser.h
144
133
  - src/include/parser_helpers.h
145
134
  - src/include/position.h
@@ -152,17 +141,22 @@ files:
152
141
  - src/include/token_struct.h
153
142
  - src/include/utf8.h
154
143
  - src/include/util.h
144
+ - src/include/util/hb_arena.h
145
+ - src/include/util/hb_arena_debug.h
146
+ - src/include/util/hb_array.h
147
+ - src/include/util/hb_buffer.h
148
+ - src/include/util/hb_string.h
149
+ - src/include/util/hb_system.h
155
150
  - src/include/version.h
156
151
  - src/include/visitor.h
157
152
  - src/io.c
158
- - src/json.c
159
153
  - src/lexer.c
160
154
  - src/lexer_peek_helpers.c
161
155
  - src/location.c
162
156
  - src/main.c
163
- - src/memory.c
164
157
  - src/parser.c
165
158
  - src/parser_helpers.c
159
+ - src/parser_match_tags.c
166
160
  - src/pretty_print.c
167
161
  - src/prism_helpers.c
168
162
  - src/range.c
@@ -171,11 +165,25 @@ files:
171
165
  - src/token_matchers.c
172
166
  - src/utf8.c
173
167
  - src/util.c
168
+ - src/util/hb_arena.c
169
+ - src/util/hb_arena_debug.c
170
+ - src/util/hb_array.c
171
+ - src/util/hb_buffer.c
172
+ - src/util/hb_string.c
173
+ - src/util/hb_system.c
174
174
  - src/visitor.c
175
175
  - templates/ext/herb/error_helpers.c.erb
176
176
  - templates/ext/herb/error_helpers.h.erb
177
177
  - templates/ext/herb/nodes.c.erb
178
178
  - templates/ext/herb/nodes.h.erb
179
+ - templates/java/error_helpers.c.erb
180
+ - templates/java/error_helpers.h.erb
181
+ - templates/java/nodes.c.erb
182
+ - templates/java/nodes.h.erb
183
+ - templates/java/org/herb/ast/Errors.java.erb
184
+ - templates/java/org/herb/ast/NodeVisitor.java.erb
185
+ - templates/java/org/herb/ast/Nodes.java.erb
186
+ - templates/java/org/herb/ast/Visitor.java.erb
179
187
  - templates/javascript/packages/core/src/errors.ts.erb
180
188
  - templates/javascript/packages/core/src/node-type-guards.ts.erb
181
189
  - templates/javascript/packages/core/src/nodes.ts.erb
@@ -187,14 +195,20 @@ files:
187
195
  - templates/lib/herb/ast/nodes.rb.erb
188
196
  - templates/lib/herb/errors.rb.erb
189
197
  - templates/lib/herb/visitor.rb.erb
198
+ - templates/rust/src/ast/nodes.rs.erb
199
+ - templates/rust/src/errors.rs.erb
200
+ - templates/rust/src/nodes.rs.erb
190
201
  - templates/sig/serialized_ast_errors.rbs.erb
191
202
  - templates/sig/serialized_ast_nodes.rbs.erb
203
+ - templates/src/analyze_missing_end.c.erb
204
+ - templates/src/analyze_transform.c.erb
192
205
  - templates/src/ast_nodes.c.erb
193
206
  - templates/src/ast_pretty_print.c.erb
194
207
  - templates/src/errors.c.erb
195
208
  - templates/src/include/ast_nodes.h.erb
196
209
  - templates/src/include/ast_pretty_print.h.erb
197
210
  - templates/src/include/errors.h.erb
211
+ - templates/src/parser_match_tags.c.erb
198
212
  - templates/src/visitor.c.erb
199
213
  - templates/template.rb
200
214
  - templates/wasm/error_helpers.cpp.erb
@@ -306,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
306
320
  - !ruby/object:Gem::Version
307
321
  version: '0'
308
322
  requirements: []
309
- rubygems_version: 3.6.2
323
+ rubygems_version: 3.6.9
310
324
  specification_version: 4
311
325
  summary: Powerful and seamless HTML-aware ERB parsing and tooling.
312
326
  test_files: []