herb 0.8.5-x86_64-linux-gnu → 0.8.6-x86_64-linux-gnu

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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/ext/herb/nodes.c +1 -1
  3. data/lib/herb/3.0/herb.so +0 -0
  4. data/lib/herb/3.1/herb.so +0 -0
  5. data/lib/herb/3.2/herb.so +0 -0
  6. data/lib/herb/3.3/herb.so +0 -0
  7. data/lib/herb/3.4/herb.so +0 -0
  8. data/lib/herb/4.0/herb.so +0 -0
  9. data/lib/herb/version.rb +1 -1
  10. data/src/analyze.c +13 -3
  11. data/src/include/util/hb_narray.h +29 -0
  12. data/src/include/version.h +1 -1
  13. data/src/util/hb_narray.c +75 -0
  14. data/vendor/prism/config.yml +28 -3
  15. data/vendor/prism/include/prism/ast.h +54 -20
  16. data/vendor/prism/include/prism/diagnostic.h +2 -0
  17. data/vendor/prism/include/prism/options.h +8 -2
  18. data/vendor/prism/include/prism/parser.h +3 -0
  19. data/vendor/prism/include/prism/version.h +2 -2
  20. data/vendor/prism/include/prism.h +1 -1
  21. data/vendor/prism/src/diagnostic.c +5 -1
  22. data/vendor/prism/src/encoding.c +172 -67
  23. data/vendor/prism/src/node.c +9 -0
  24. data/vendor/prism/src/options.c +17 -7
  25. data/vendor/prism/src/prettyprint.c +16 -0
  26. data/vendor/prism/src/prism.c +1192 -1895
  27. data/vendor/prism/src/serialize.c +7 -1
  28. data/vendor/prism/src/token_type.c +2 -2
  29. data/vendor/prism/src/util/pm_constant_pool.c +1 -1
  30. data/vendor/prism/templates/include/prism/ast.h.erb +26 -16
  31. data/vendor/prism/templates/java/org/prism/Loader.java.erb +1 -1
  32. data/vendor/prism/templates/javascript/src/deserialize.js.erb +1 -1
  33. data/vendor/prism/templates/lib/prism/serialize.rb.erb +1 -1
  34. data/vendor/prism/templates/src/diagnostic.c.erb +2 -0
  35. data/vendor/prism/templates/src/serialize.c.erb +1 -1
  36. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23dad59f52609e11e836451c3f37e5c9634a8dbecada3baaa64de65e3e2eeaea
4
- data.tar.gz: 0071f3d556f5e3f6b3d09b0b0a6ed6dc0c2ee4d74c74f94ae0f1e9332be6d382
3
+ metadata.gz: 2b0f966bad1bb818a2e858730ef0efe494a91932f75be63b687635e944139266
4
+ data.tar.gz: 2976b2c7d16d0760b6b72d90a92ca85494a057ab85c327db5f6274337e006e11
5
5
  SHA512:
6
- metadata.gz: 5124aa63156817a77813e8f574e14c0f0897d21b290312123d3cde81dbfeac133f4ff80ed343dd76052f323701b3fb7860c5734318ccef40dffc4953f4b4d8af
7
- data.tar.gz: e5f9620c31c361d4179b57d7ff7b919abdf3b8fe1e32695b7289fe7c4196b7c538bb98c3ab950882b56a27e2f89a225a0e1c1c4e1e307aa3cc171725606a15f7
6
+ metadata.gz: d9b8bf3e9dca82ad708be78a7b56214942800ba6055cc6d6a83a2114b7fa1575ce6df308ad1ae1b435956552d88c0a95f1811f53404e2070f86c252011dd11fd
7
+ data.tar.gz: '079e6fa4f4d00193e884ef94cdc0e2d40d18747337266cbd257198d42ff1b06c38416905948f488c124a052dea8ab0a568eb8080a999ca586d9bd6ada86d5191'
data/ext/herb/nodes.c CHANGED
@@ -464,7 +464,7 @@ static VALUE rb_erb_content_node_from_c_struct(AST_ERB_CONTENT_NODE_T* erb_conte
464
464
  VALUE erb_content_node_tag_opening = rb_token_from_c_struct(erb_content_node->tag_opening);
465
465
  VALUE erb_content_node_content = rb_token_from_c_struct(erb_content_node->content);
466
466
  VALUE erb_content_node_tag_closing = rb_token_from_c_struct(erb_content_node->tag_closing);
467
- /* #<Herb::Template::AnalyzedRubyField:0x00007f00e53252c0 @name="analyzed_ruby", @options={kind: nil}> */
467
+ /* #<Herb::Template::AnalyzedRubyField:0x00007f46a1d3cf40 @name="analyzed_ruby", @options={kind: nil}> */
468
468
  VALUE erb_content_node_analyzed_ruby = Qnil;
469
469
  VALUE erb_content_node_parsed = (erb_content_node->parsed) ? Qtrue : Qfalse;
470
470
  VALUE erb_content_node_valid = (erb_content_node->valid) ? Qtrue : Qfalse;
data/lib/herb/3.0/herb.so CHANGED
Binary file
data/lib/herb/3.1/herb.so CHANGED
Binary file
data/lib/herb/3.2/herb.so CHANGED
Binary file
data/lib/herb/3.3/herb.so CHANGED
Binary file
data/lib/herb/3.4/herb.so CHANGED
Binary file
Binary file
data/lib/herb/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # typed: true
3
3
 
4
4
  module Herb
5
- VERSION = "0.8.5"
5
+ VERSION = "0.8.6"
6
6
  end
data/src/analyze.c CHANGED
@@ -192,9 +192,19 @@ static bool find_earliest_control_keyword_walker(const pm_node_t* node, void* da
192
192
  case PM_CALL_NODE: {
193
193
  pm_call_node_t* call = (pm_call_node_t*) node;
194
194
 
195
- if (call->block != NULL) {
196
- current_type = CONTROL_TYPE_BLOCK;
197
- keyword_offset = (uint32_t) (node->location.start - context->source_start);
195
+ if (call->block != NULL && call->block->type == PM_BLOCK_NODE) {
196
+ pm_block_node_t* block_node = (pm_block_node_t*) call->block;
197
+ size_t opening_length = block_node->opening_loc.end - block_node->opening_loc.start;
198
+ bool has_do_opening =
199
+ opening_length == 2 && block_node->opening_loc.start[0] == 'd' && block_node->opening_loc.start[1] == 'o';
200
+ bool has_brace_opening = opening_length == 1 && block_node->opening_loc.start[0] == '{';
201
+ bool has_closing_location = block_node->closing_loc.start != NULL && block_node->closing_loc.end != NULL
202
+ && (block_node->closing_loc.end - block_node->closing_loc.start) > 0;
203
+
204
+ if (has_do_opening || (has_brace_opening && !has_closing_location)) {
205
+ current_type = CONTROL_TYPE_BLOCK;
206
+ keyword_offset = (uint32_t) (node->location.start - context->source_start);
207
+ }
198
208
  }
199
209
  break;
200
210
  }
@@ -0,0 +1,29 @@
1
+ #ifndef HERB_NARRAY_H
2
+ #define HERB_NARRAY_H
3
+
4
+ #include <stdint.h>
5
+ #include <stdlib.h>
6
+ #include <stdbool.h>
7
+
8
+ typedef struct HB_NARRAY_STRUCT {
9
+ uint8_t* items;
10
+ size_t item_size;
11
+ size_t size;
12
+ size_t capacity;
13
+ } hb_narray_T;
14
+
15
+ void hb_narray_init(hb_narray_T* array, size_t item_size, size_t initial_capacity);
16
+ #define hb_narray_pointer_init(array, initial_capacity) (hb_narray_init(array, sizeof(void*), initial_capacity))
17
+
18
+ void* hb_narray_get(const hb_narray_T* array, size_t index);
19
+ void* hb_narray_first(hb_narray_T* array);
20
+ void* hb_narray_last(hb_narray_T* array);
21
+
22
+ void hb_narray_append(hb_narray_T* array, void* item);
23
+ void hb_narray_remove(hb_narray_T* array, size_t index);
24
+ void hb_narray_deinit(hb_narray_T* array);
25
+
26
+ #define hb_narray_push(array, item) (hb_narray_append(array, item))
27
+ bool hb_narray_pop(hb_narray_T* array, void* item);
28
+
29
+ #endif
@@ -1,6 +1,6 @@
1
1
  #ifndef HERB_VERSION_H
2
2
  #define HERB_VERSION_H
3
3
 
4
- #define HERB_VERSION "0.8.5"
4
+ #define HERB_VERSION "0.8.6"
5
5
 
6
6
  #endif
@@ -0,0 +1,75 @@
1
+ #include "../include/util/hb_narray.h"
2
+
3
+ #include <assert.h>
4
+ #include <stdbool.h>
5
+ #include <string.h>
6
+
7
+ void hb_narray_init(hb_narray_T* array, size_t item_size, size_t initial_capacity) {
8
+ assert(initial_capacity != 0);
9
+
10
+ array->item_size = item_size;
11
+ array->capacity = initial_capacity;
12
+ array->size = 0;
13
+ array->items = malloc(array->capacity * array->item_size);
14
+ }
15
+
16
+ void hb_narray_append(hb_narray_T* array, void* item) {
17
+ if (array->size + 1 > array->capacity) {
18
+ array->capacity *= 2;
19
+ void* new_buffer = realloc(array->items, array->capacity * array->item_size);
20
+ assert(new_buffer != NULL);
21
+ array->items = new_buffer;
22
+ }
23
+
24
+ memcpy(array->items + (array->size * array->item_size), item, array->item_size);
25
+ array->size += 1;
26
+ }
27
+
28
+ static inline uint8_t* hb_narray_memory_position(const hb_narray_T* array, size_t index) {
29
+ return array->items + (array->item_size * index);
30
+ }
31
+
32
+ void hb_narray_remove(hb_narray_T* array, size_t index) {
33
+ assert(index < array->size);
34
+
35
+ if (array->size - 1 > index) {
36
+ size_t elements_to_shift = (array->size - 1) - index;
37
+ size_t bytes_to_shift = array->item_size * elements_to_shift;
38
+
39
+ memcpy(hb_narray_memory_position(array, index), hb_narray_memory_position(array, index + 1), bytes_to_shift);
40
+ }
41
+
42
+ array->size -= 1;
43
+ }
44
+
45
+ void* hb_narray_get(const hb_narray_T* array, size_t index) {
46
+ assert(index < array->size);
47
+
48
+ return hb_narray_memory_position(array, index);
49
+ }
50
+
51
+ void* hb_narray_first(hb_narray_T* array) {
52
+ if (array->size == 0) { return NULL; }
53
+
54
+ return hb_narray_get(array, 0);
55
+ }
56
+
57
+ void* hb_narray_last(hb_narray_T* array) {
58
+ if (array->size == 0) { return NULL; }
59
+ return hb_narray_get(array, array->size - 1);
60
+ }
61
+
62
+ bool hb_narray_pop(hb_narray_T* array, void* item) {
63
+ if (array->size == 0) { return false; }
64
+ memcpy(item, hb_narray_last(array), array->item_size);
65
+ array->size -= 1;
66
+
67
+ return true;
68
+ }
69
+
70
+ void hb_narray_deinit(hb_narray_T* array) {
71
+ array->item_size = 0;
72
+ array->capacity = 0;
73
+ array->size = 0;
74
+ free(array->items);
75
+ }
@@ -219,6 +219,7 @@ errors:
219
219
  - PARAMETER_WILD_LOOSE_COMMA
220
220
  - PATTERN_ARRAY_MULTIPLE_RESTS
221
221
  - PATTERN_CAPTURE_DUPLICATE
222
+ - PATTERN_CAPTURE_IN_ALTERNATIVE
222
223
  - PATTERN_EXPRESSION_AFTER_BRACKET
223
224
  - PATTERN_EXPRESSION_AFTER_COMMA
224
225
  - PATTERN_EXPRESSION_AFTER_HROCKET
@@ -280,6 +281,7 @@ errors:
280
281
  - UNEXPECTED_INDEX_KEYWORDS
281
282
  - UNEXPECTED_LABEL
282
283
  - UNEXPECTED_MULTI_WRITE
284
+ - UNEXPECTED_PARAMETER_DEFAULT_VALUE
283
285
  - UNEXPECTED_RANGE_OPERATOR
284
286
  - UNEXPECTED_SAFE_NAVIGATION
285
287
  - UNEXPECTED_TOKEN_CLOSE_CONTEXT
@@ -356,6 +358,8 @@ tokens:
356
358
  comment: "a newline character outside of other tokens"
357
359
  - name: PARENTHESIS_RIGHT
358
360
  comment: ")"
361
+ - name: PIPE
362
+ comment: "|"
359
363
  - name: SEMICOLON
360
364
  comment: ";"
361
365
  # Tokens from here on are not used for lookup, and can be in any order.
@@ -589,8 +593,6 @@ tokens:
589
593
  comment: "%I"
590
594
  - name: PERCENT_UPPER_W
591
595
  comment: "%W"
592
- - name: PIPE
593
- comment: "|"
594
596
  - name: PIPE_EQUAL
595
597
  comment: "|="
596
598
  - name: PIPE_PIPE
@@ -1515,6 +1517,16 @@ nodes:
1515
1517
 
1516
1518
  foo(bar)
1517
1519
  ^
1520
+ - name: equal_loc
1521
+ type: location?
1522
+ comment: |
1523
+ Represents the location of the equal sign, in the case that this is an attribute write.
1524
+
1525
+ foo.bar = value
1526
+ ^
1527
+
1528
+ foo[bar] = value
1529
+ ^
1518
1530
  - name: block
1519
1531
  type: node?
1520
1532
  kind:
@@ -2616,11 +2628,18 @@ nodes:
2616
2628
  - name: block
2617
2629
  type: node?
2618
2630
  kind: BlockNode
2631
+ comment: |
2632
+ All other arguments are forwarded as normal, except the original block is replaced with the new block.
2619
2633
  comment: |
2620
- Represents the use of the `super` keyword without parentheses or arguments.
2634
+ Represents the use of the `super` keyword without parentheses or arguments, but which might have a block.
2621
2635
 
2622
2636
  super
2623
2637
  ^^^^^
2638
+
2639
+ super { 123 }
2640
+ ^^^^^^^^^^^^^
2641
+
2642
+ If it has any other arguments, it would be a `SuperNode` instead.
2624
2643
  - name: GlobalVariableAndWriteNode
2625
2644
  fields:
2626
2645
  - name: name
@@ -3287,6 +3306,9 @@ nodes:
3287
3306
  - EmbeddedVariableNode
3288
3307
  - InterpolatedStringNode # `"a" "#{b}"`
3289
3308
  - on error: XStringNode # `<<`FOO` "bar"
3309
+ - on error: InterpolatedXStringNode
3310
+ - on error: SymbolNode
3311
+ - on error: InterpolatedSymbolNode
3290
3312
  - name: closing_loc
3291
3313
  type: location?
3292
3314
  newline: parts
@@ -4496,6 +4518,7 @@ nodes:
4496
4518
  - name: arguments
4497
4519
  type: node?
4498
4520
  kind: ArgumentsNode
4521
+ comment: "Can be only `nil` when there are empty parentheses, like `super()`."
4499
4522
  - name: rparen_loc
4500
4523
  type: location?
4501
4524
  - name: block
@@ -4511,6 +4534,8 @@ nodes:
4511
4534
 
4512
4535
  super foo, bar
4513
4536
  ^^^^^^^^^^^^^^
4537
+
4538
+ If no arguments are provided (except for a block), it would be a `ForwardingSuperNode` instead.
4514
4539
  - name: SymbolNode
4515
4540
  flags: SymbolFlags
4516
4541
  fields:
@@ -76,6 +76,9 @@ typedef enum pm_token_type {
76
76
  /** ) */
77
77
  PM_TOKEN_PARENTHESIS_RIGHT,
78
78
 
79
+ /** | */
80
+ PM_TOKEN_PIPE,
81
+
79
82
  /** ; */
80
83
  PM_TOKEN_SEMICOLON,
81
84
 
@@ -424,9 +427,6 @@ typedef enum pm_token_type {
424
427
  /** %W */
425
428
  PM_TOKEN_PERCENT_UPPER_W,
426
429
 
427
- /** | */
428
- PM_TOKEN_PIPE,
429
-
430
430
  /** |= */
431
431
  PM_TOKEN_PIPE_EQUAL,
432
432
 
@@ -1050,22 +1050,6 @@ typedef uint16_t pm_node_flags_t;
1050
1050
  static const pm_node_flags_t PM_NODE_FLAG_NEWLINE = 0x1;
1051
1051
  static const pm_node_flags_t PM_NODE_FLAG_STATIC_LITERAL = 0x2;
1052
1052
 
1053
- /**
1054
- * Cast the type to an enum to allow the compiler to provide exhaustiveness
1055
- * checking.
1056
- */
1057
- #define PM_NODE_TYPE(node) ((enum pm_node_type) (node)->type)
1058
-
1059
- /**
1060
- * Return true if the type of the given node matches the given type.
1061
- */
1062
- #define PM_NODE_TYPE_P(node, type) (PM_NODE_TYPE(node) == (type))
1063
-
1064
- /**
1065
- * Return true if the given flag is set on the given node.
1066
- */
1067
- #define PM_NODE_FLAG_P(node, flag) ((((pm_node_t *)(node))->flags & (flag)) != 0)
1068
-
1069
1053
  /**
1070
1054
  * This is the base structure that represents a node in the syntax tree. It is
1071
1055
  * embedded into every node type.
@@ -1096,6 +1080,32 @@ typedef struct pm_node {
1096
1080
  pm_location_t location;
1097
1081
  } pm_node_t;
1098
1082
 
1083
+ /**
1084
+ * Cast the given node to the base pm_node_t type.
1085
+ */
1086
+ #define PM_NODE_UPCAST(node_) ((pm_node_t *) (node_))
1087
+
1088
+ /**
1089
+ * Cast the type to an enum to allow the compiler to provide exhaustiveness
1090
+ * checking.
1091
+ */
1092
+ #define PM_NODE_TYPE(node_) ((enum pm_node_type) (node_)->type)
1093
+
1094
+ /**
1095
+ * Return true if the type of the given node matches the given type.
1096
+ */
1097
+ #define PM_NODE_TYPE_P(node_, type_) (PM_NODE_TYPE(node_) == (type_))
1098
+
1099
+ /**
1100
+ * Return the flags associated with the given node.
1101
+ */
1102
+ #define PM_NODE_FLAGS(node_) (PM_NODE_UPCAST(node_)->flags)
1103
+
1104
+ /**
1105
+ * Return true if the given flag is set on the given node.
1106
+ */
1107
+ #define PM_NODE_FLAG_P(node_, flag_) ((PM_NODE_FLAGS(node_) & (flag_)) != 0)
1108
+
1099
1109
  /**
1100
1110
  * AliasGlobalVariableNode
1101
1111
  *
@@ -2214,6 +2224,19 @@ typedef struct pm_call_node {
2214
2224
  */
2215
2225
  pm_location_t closing_loc;
2216
2226
 
2227
+ /**
2228
+ * CallNode#equal_loc
2229
+ *
2230
+ * Represents the location of the equal sign, in the case that this is an attribute write.
2231
+ *
2232
+ * foo.bar = value
2233
+ * ^
2234
+ *
2235
+ * foo[bar] = value
2236
+ * ^
2237
+ */
2238
+ pm_location_t equal_loc;
2239
+
2217
2240
  /**
2218
2241
  * CallNode#block
2219
2242
  *
@@ -4084,11 +4107,16 @@ typedef struct pm_forwarding_parameter_node {
4084
4107
  /**
4085
4108
  * ForwardingSuperNode
4086
4109
  *
4087
- * Represents the use of the `super` keyword without parentheses or arguments.
4110
+ * Represents the use of the `super` keyword without parentheses or arguments, but which might have a block.
4088
4111
  *
4089
4112
  * super
4090
4113
  * ^^^^^
4091
4114
  *
4115
+ * super { 123 }
4116
+ * ^^^^^^^^^^^^^
4117
+ *
4118
+ * If it has any other arguments, it would be a `SuperNode` instead.
4119
+ *
4092
4120
  * Type: ::PM_FORWARDING_SUPER_NODE
4093
4121
  *
4094
4122
  * @extends pm_node_t
@@ -4100,6 +4128,8 @@ typedef struct pm_forwarding_super_node {
4100
4128
 
4101
4129
  /**
4102
4130
  * ForwardingSuperNode#block
4131
+ *
4132
+ * All other arguments are forwarded as normal, except the original block is replaced with the new block.
4103
4133
  */
4104
4134
  struct pm_block_node *block;
4105
4135
  } pm_forwarding_super_node_t;
@@ -7539,6 +7569,8 @@ typedef struct pm_string_node {
7539
7569
  * super foo, bar
7540
7570
  * ^^^^^^^^^^^^^^
7541
7571
  *
7572
+ * If no arguments are provided (except for a block), it would be a `ForwardingSuperNode` instead.
7573
+ *
7542
7574
  * Type: ::PM_SUPER_NODE
7543
7575
  *
7544
7576
  * @extends pm_node_t
@@ -7560,6 +7592,8 @@ typedef struct pm_super_node {
7560
7592
 
7561
7593
  /**
7562
7594
  * SuperNode#arguments
7595
+ *
7596
+ * Can be only `nil` when there are empty parentheses, like `super()`.
7563
7597
  */
7564
7598
  struct pm_arguments_node *arguments;
7565
7599
 
@@ -250,6 +250,7 @@ typedef enum {
250
250
  PM_ERR_PARAMETER_WILD_LOOSE_COMMA,
251
251
  PM_ERR_PATTERN_ARRAY_MULTIPLE_RESTS,
252
252
  PM_ERR_PATTERN_CAPTURE_DUPLICATE,
253
+ PM_ERR_PATTERN_CAPTURE_IN_ALTERNATIVE,
253
254
  PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET,
254
255
  PM_ERR_PATTERN_EXPRESSION_AFTER_COMMA,
255
256
  PM_ERR_PATTERN_EXPRESSION_AFTER_HROCKET,
@@ -311,6 +312,7 @@ typedef enum {
311
312
  PM_ERR_UNEXPECTED_INDEX_KEYWORDS,
312
313
  PM_ERR_UNEXPECTED_LABEL,
313
314
  PM_ERR_UNEXPECTED_MULTI_WRITE,
315
+ PM_ERR_UNEXPECTED_PARAMETER_DEFAULT_VALUE,
314
316
  PM_ERR_UNEXPECTED_RANGE_OPERATOR,
315
317
  PM_ERR_UNEXPECTED_SAFE_NAVIGATION,
316
318
  PM_ERR_UNEXPECTED_TOKEN_CLOSE_CONTEXT,
@@ -91,11 +91,17 @@ typedef enum {
91
91
  /** The vendored version of prism in CRuby 3.4.x. */
92
92
  PM_OPTIONS_VERSION_CRUBY_3_4 = 2,
93
93
 
94
- /** The vendored version of prism in CRuby 3.5.x. */
94
+ /** The vendored version of prism in CRuby 4.0.x. */
95
95
  PM_OPTIONS_VERSION_CRUBY_3_5 = 3,
96
96
 
97
+ /** The vendored version of prism in CRuby 4.0.x. */
98
+ PM_OPTIONS_VERSION_CRUBY_4_0 = 3,
99
+
100
+ /** The vendored version of prism in CRuby 4.1.x. */
101
+ PM_OPTIONS_VERSION_CRUBY_4_1 = 4,
102
+
97
103
  /** The current version of prism. */
98
- PM_OPTIONS_VERSION_LATEST = PM_OPTIONS_VERSION_CRUBY_3_5
104
+ PM_OPTIONS_VERSION_LATEST = PM_OPTIONS_VERSION_CRUBY_4_1
99
105
  } pm_options_version_t;
100
106
 
101
107
  /**
@@ -299,6 +299,9 @@ typedef enum {
299
299
  /** a rescue else statement within a do..end block */
300
300
  PM_CONTEXT_BLOCK_ELSE,
301
301
 
302
+ /** expressions in block parameters `foo do |...| end ` */
303
+ PM_CONTEXT_BLOCK_PARAMETERS,
304
+
302
305
  /** a rescue statement within a do..end block */
303
306
  PM_CONTEXT_BLOCK_RESCUE,
304
307
 
@@ -14,7 +14,7 @@
14
14
  /**
15
15
  * The minor version of the Prism library as an int.
16
16
  */
17
- #define PRISM_VERSION_MINOR 6
17
+ #define PRISM_VERSION_MINOR 7
18
18
 
19
19
  /**
20
20
  * The patch version of the Prism library as an int.
@@ -24,6 +24,6 @@
24
24
  /**
25
25
  * The version of the Prism library as a constant string.
26
26
  */
27
- #define PRISM_VERSION "1.6.0"
27
+ #define PRISM_VERSION "1.7.0"
28
28
 
29
29
  #endif
@@ -314,7 +314,7 @@ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_method_name(const uint
314
314
  * dependencies. It is currently being integrated into
315
315
  * [CRuby](https://github.com/ruby/ruby),
316
316
  * [JRuby](https://github.com/jruby/jruby),
317
- * [TruffleRuby](https://github.com/oracle/truffleruby),
317
+ * [TruffleRuby](https://github.com/truffleruby/truffleruby),
318
318
  * [Sorbet](https://github.com/sorbet/sorbet), and
319
319
  * [Syntax Tree](https://github.com/ruby-syntax-tree/syntax_tree).
320
320
  *
@@ -10,7 +10,7 @@
10
10
 
11
11
  #include "prism/diagnostic.h"
12
12
 
13
- #define PM_DIAGNOSTIC_ID_MAX 322
13
+ #define PM_DIAGNOSTIC_ID_MAX 324
14
14
 
15
15
  /** This struct holds the data for each diagnostic. */
16
16
  typedef struct {
@@ -311,6 +311,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
311
311
  [PM_ERR_PARAMETER_UNEXPECTED_NO_KW] = { "unexpected **nil; no keywords marker disallowed after keywords", PM_ERROR_LEVEL_SYNTAX },
312
312
  [PM_ERR_PATTERN_ARRAY_MULTIPLE_RESTS] = { "unexpected multiple '*' rest patterns in an array pattern", PM_ERROR_LEVEL_SYNTAX },
313
313
  [PM_ERR_PATTERN_CAPTURE_DUPLICATE] = { "duplicated variable name", PM_ERROR_LEVEL_SYNTAX },
314
+ [PM_ERR_PATTERN_CAPTURE_IN_ALTERNATIVE] = { "variable capture in alternative pattern", PM_ERROR_LEVEL_SYNTAX },
314
315
  [PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET] = { "expected a pattern expression after the `[` operator", PM_ERROR_LEVEL_SYNTAX },
315
316
  [PM_ERR_PATTERN_EXPRESSION_AFTER_COMMA] = { "expected a pattern expression after `,`", PM_ERROR_LEVEL_SYNTAX },
316
317
  [PM_ERR_PATTERN_EXPRESSION_AFTER_HROCKET] = { "expected a pattern expression after `=>`", PM_ERROR_LEVEL_SYNTAX },
@@ -371,6 +372,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
371
372
  [PM_ERR_UNEXPECTED_INDEX_KEYWORDS] = { "unexpected keyword arg given in index assignment; keywords are not allowed in index assignment expressions", PM_ERROR_LEVEL_SYNTAX },
372
373
  [PM_ERR_UNEXPECTED_LABEL] = { "unexpected label", PM_ERROR_LEVEL_SYNTAX },
373
374
  [PM_ERR_UNEXPECTED_MULTI_WRITE] = { "unexpected multiple assignment; multiple assignment is not allowed in this context", PM_ERROR_LEVEL_SYNTAX },
375
+ [PM_ERR_UNEXPECTED_PARAMETER_DEFAULT_VALUE] = { "unexpected %s; expected a default value for a parameter", PM_ERROR_LEVEL_SYNTAX },
374
376
  [PM_ERR_UNEXPECTED_RANGE_OPERATOR] = { "unexpected range operator; .. and ... are non-associative and cannot be chained", PM_ERROR_LEVEL_SYNTAX },
375
377
  [PM_ERR_UNEXPECTED_SAFE_NAVIGATION] = { "&. inside multiple assignment destination", PM_ERROR_LEVEL_SYNTAX },
376
378
  [PM_ERR_UNEXPECTED_TOKEN_CLOSE_CONTEXT] = { "unexpected %s, assuming it is closing the parent %s", PM_ERROR_LEVEL_SYNTAX },
@@ -642,6 +644,7 @@ pm_diagnostic_id_human(pm_diagnostic_id_t diag_id) {
642
644
  case PM_ERR_PARAMETER_WILD_LOOSE_COMMA: return "parameter_wild_loose_comma";
643
645
  case PM_ERR_PATTERN_ARRAY_MULTIPLE_RESTS: return "pattern_array_multiple_rests";
644
646
  case PM_ERR_PATTERN_CAPTURE_DUPLICATE: return "pattern_capture_duplicate";
647
+ case PM_ERR_PATTERN_CAPTURE_IN_ALTERNATIVE: return "pattern_capture_in_alternative";
645
648
  case PM_ERR_PATTERN_EXPRESSION_AFTER_BRACKET: return "pattern_expression_after_bracket";
646
649
  case PM_ERR_PATTERN_EXPRESSION_AFTER_COMMA: return "pattern_expression_after_comma";
647
650
  case PM_ERR_PATTERN_EXPRESSION_AFTER_HROCKET: return "pattern_expression_after_hrocket";
@@ -703,6 +706,7 @@ pm_diagnostic_id_human(pm_diagnostic_id_t diag_id) {
703
706
  case PM_ERR_UNEXPECTED_INDEX_KEYWORDS: return "unexpected_index_keywords";
704
707
  case PM_ERR_UNEXPECTED_LABEL: return "unexpected_label";
705
708
  case PM_ERR_UNEXPECTED_MULTI_WRITE: return "unexpected_multi_write";
709
+ case PM_ERR_UNEXPECTED_PARAMETER_DEFAULT_VALUE: return "unexpected_parameter_default_value";
706
710
  case PM_ERR_UNEXPECTED_RANGE_OPERATOR: return "unexpected_range_operator";
707
711
  case PM_ERR_UNEXPECTED_SAFE_NAVIGATION: return "unexpected_safe_navigation";
708
712
  case PM_ERR_UNEXPECTED_TOKEN_CLOSE_CONTEXT: return "unexpected_token_close_context";