prism 1.8.0 → 1.8.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -3
- data/config.yml +2 -0
- data/ext/prism/extension.h +1 -1
- data/include/prism/defines.h +18 -0
- data/include/prism/diagnostic.h +2 -0
- data/include/prism/util/pm_memchr.h +1 -1
- data/include/prism/version.h +2 -2
- data/lib/prism/serialize.rb +3 -1
- data/prism.gemspec +1 -1
- data/src/diagnostic.c +7 -1
- data/src/prism.c +62 -15
- data/src/util/pm_memchr.c +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c783657a881bf48ea7f582fd8460ce7230ffc142a67d6eab53f06c5878d2739
|
|
4
|
+
data.tar.gz: 761e009ead12f8984342f4aa44a8efb8e2c312b1b19527ba9e6399ba8a9990aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 247eb5ba72e15a0bf3136a45582218c232cb300f34b33304bbc63dcfa2ab8fbd728192aff1f63de3b6d2bf23a18afb1711460e28f8e5ce1cc478f5af6e37b205
|
|
7
|
+
data.tar.gz: f0ee65d2c2ff74a3bc9fe0709177467fafdaf0a79aa0c43e8e5f82bfc17c855d3546aa6442d45de55dcea4fe06e567879e60d8a23448a151a1e9d539ccfbd1fd
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [1.8.2] - 2026-10-21
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Fix build errors with C23 qualifier-preserving `memchr`.
|
|
14
|
+
- Do not warn for ambiguous `/` when targeting Ruby 4.1.
|
|
15
|
+
- Fix array-bounds warnings with newer GCC.
|
|
16
|
+
|
|
17
|
+
## [1.8.1] - 2026-03-16
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Fix `not` binding power in endless methods.
|
|
22
|
+
- Correctly handle `and?` and similar on Ruby 4.0.
|
|
23
|
+
- Fix error message for block/lambda with `...` argument.
|
|
24
|
+
- Fix `in` handling.
|
|
25
|
+
|
|
7
26
|
## [1.8.0] - 2026-01-12
|
|
8
27
|
|
|
9
28
|
### Added
|
|
@@ -19,8 +38,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
|
19
38
|
- Decouple ripper translator from ripper library.
|
|
20
39
|
- Sync Prism::Translation::ParserCurrent with Ruby 4.0.
|
|
21
40
|
|
|
22
|
-
## [Unreleased]
|
|
23
|
-
|
|
24
41
|
## [1.7.0] - 2025-12-18
|
|
25
42
|
|
|
26
43
|
### Added
|
|
@@ -731,7 +748,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
|
731
748
|
|
|
732
749
|
- 🎉 Initial release! 🎉
|
|
733
750
|
|
|
734
|
-
[unreleased]: https://github.com/ruby/prism/compare/v1.8.
|
|
751
|
+
[unreleased]: https://github.com/ruby/prism/compare/v1.8.2...HEAD
|
|
752
|
+
[1.8.2]: https://github.com/ruby/prism/compare/v1.8.1...v1.8.2
|
|
753
|
+
[1.8.1]: https://github.com/ruby/prism/compare/v1.8.0...v1.8.1
|
|
735
754
|
[1.8.0]: https://github.com/ruby/prism/compare/v1.7.0...v1.8.0
|
|
736
755
|
[1.7.0]: https://github.com/ruby/prism/compare/v1.6.0...v1.7.0
|
|
737
756
|
[1.6.0]: https://github.com/ruby/prism/compare/v1.5.2...v1.6.0
|
data/config.yml
CHANGED
|
@@ -17,6 +17,8 @@ errors:
|
|
|
17
17
|
- ARGUMENT_FORWARDING_UNBOUND
|
|
18
18
|
- ARGUMENT_NO_FORWARDING_AMPERSAND
|
|
19
19
|
- ARGUMENT_NO_FORWARDING_ELLIPSES
|
|
20
|
+
- ARGUMENT_NO_FORWARDING_ELLIPSES_LAMBDA
|
|
21
|
+
- ARGUMENT_NO_FORWARDING_ELLIPSES_BLOCK
|
|
20
22
|
- ARGUMENT_NO_FORWARDING_STAR
|
|
21
23
|
- ARGUMENT_NO_FORWARDING_STAR_STAR
|
|
22
24
|
- ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT
|
data/ext/prism/extension.h
CHANGED
data/include/prism/defines.h
CHANGED
|
@@ -257,4 +257,22 @@
|
|
|
257
257
|
#define PRISM_FALLTHROUGH
|
|
258
258
|
#endif
|
|
259
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Tell the compiler that the given expression can be assumed to be true. Unlike
|
|
262
|
+
* assert, this emits no runtime check — it only feeds the optimizer's value
|
|
263
|
+
* range analysis so it can prune impossible paths. Use it to communicate an
|
|
264
|
+
* invariant the caller guarantees but that the compiler cannot otherwise prove.
|
|
265
|
+
*/
|
|
266
|
+
#if defined(__clang__)
|
|
267
|
+
#define PRISM_ASSUME(expr_) __builtin_assume(expr_)
|
|
268
|
+
#elif defined(_MSC_VER)
|
|
269
|
+
#define PRISM_ASSUME(expr_) __assume(expr_)
|
|
270
|
+
#elif defined(__GNUC__) && (__GNUC__ >= 13)
|
|
271
|
+
#define PRISM_ASSUME(expr_) __attribute__((assume(expr_)))
|
|
272
|
+
#elif defined(__GNUC__)
|
|
273
|
+
#define PRISM_ASSUME(expr_) ((expr_) ? (void) 0 : __builtin_unreachable())
|
|
274
|
+
#else
|
|
275
|
+
#define PRISM_ASSUME(expr_) ((void) 0)
|
|
276
|
+
#endif
|
|
277
|
+
|
|
260
278
|
#endif
|
data/include/prism/diagnostic.h
CHANGED
|
@@ -48,6 +48,8 @@ typedef enum {
|
|
|
48
48
|
PM_ERR_ARGUMENT_FORWARDING_UNBOUND,
|
|
49
49
|
PM_ERR_ARGUMENT_NO_FORWARDING_AMPERSAND,
|
|
50
50
|
PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES,
|
|
51
|
+
PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_LAMBDA,
|
|
52
|
+
PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_BLOCK,
|
|
51
53
|
PM_ERR_ARGUMENT_NO_FORWARDING_STAR,
|
|
52
54
|
PM_ERR_ARGUMENT_NO_FORWARDING_STAR_STAR,
|
|
53
55
|
PM_ERR_ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT,
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
* @return A pointer to the first occurrence of the character in the source
|
|
25
25
|
* string, or NULL if no such character exists.
|
|
26
26
|
*/
|
|
27
|
-
void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding);
|
|
27
|
+
const void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding);
|
|
28
28
|
|
|
29
29
|
#endif
|
data/include/prism/version.h
CHANGED
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* The patch version of the Prism library as an int.
|
|
21
21
|
*/
|
|
22
|
-
#define PRISM_VERSION_PATCH
|
|
22
|
+
#define PRISM_VERSION_PATCH 2
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* The version of the Prism library as a constant string.
|
|
26
26
|
*/
|
|
27
|
-
#define PRISM_VERSION "1.8.
|
|
27
|
+
#define PRISM_VERSION "1.8.2"
|
|
28
28
|
|
|
29
29
|
#endif
|
data/lib/prism/serialize.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Prism
|
|
|
25
25
|
|
|
26
26
|
# The patch version of prism that we are expecting to find in the serialized
|
|
27
27
|
# strings.
|
|
28
|
-
PATCH_VERSION =
|
|
28
|
+
PATCH_VERSION = 2
|
|
29
29
|
|
|
30
30
|
# Deserialize the dumped output from a request to parse or parse_file.
|
|
31
31
|
#
|
|
@@ -354,6 +354,8 @@ module Prism
|
|
|
354
354
|
:argument_forwarding_unbound,
|
|
355
355
|
:argument_no_forwarding_ampersand,
|
|
356
356
|
:argument_no_forwarding_ellipses,
|
|
357
|
+
:argument_no_forwarding_ellipses_lambda,
|
|
358
|
+
:argument_no_forwarding_ellipses_block,
|
|
357
359
|
:argument_no_forwarding_star,
|
|
358
360
|
:argument_no_forwarding_star_star,
|
|
359
361
|
:argument_splat_after_assoc_splat,
|
data/prism.gemspec
CHANGED
data/src/diagnostic.c
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
#include "prism/diagnostic.h"
|
|
12
12
|
|
|
13
|
-
#define PM_DIAGNOSTIC_ID_MAX
|
|
13
|
+
#define PM_DIAGNOSTIC_ID_MAX 326
|
|
14
14
|
|
|
15
15
|
/** This struct holds the data for each diagnostic. */
|
|
16
16
|
typedef struct {
|
|
@@ -112,6 +112,8 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
|
|
|
112
112
|
[PM_ERR_ARGUMENT_FORWARDING_UNBOUND] = { "unexpected `...` in an non-parenthesized call", PM_ERROR_LEVEL_SYNTAX },
|
|
113
113
|
[PM_ERR_ARGUMENT_NO_FORWARDING_AMPERSAND] = { "unexpected `&`; no anonymous block parameter", PM_ERROR_LEVEL_SYNTAX },
|
|
114
114
|
[PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES] = { "unexpected ... when the parent method is not forwarding", PM_ERROR_LEVEL_SYNTAX },
|
|
115
|
+
[PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_LAMBDA] = { "unexpected ... in lambda argument", PM_ERROR_LEVEL_SYNTAX },
|
|
116
|
+
[PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_BLOCK] = { "unexpected ... in block argument", PM_ERROR_LEVEL_SYNTAX },
|
|
115
117
|
[PM_ERR_ARGUMENT_NO_FORWARDING_STAR] = { "unexpected `*`; no anonymous rest parameter", PM_ERROR_LEVEL_SYNTAX },
|
|
116
118
|
[PM_ERR_ARGUMENT_NO_FORWARDING_STAR_STAR] = { "unexpected `**`; no anonymous keyword rest parameter", PM_ERROR_LEVEL_SYNTAX },
|
|
117
119
|
[PM_ERR_ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT] = { "unexpected `*` splat argument after a `**` keyword splat argument", PM_ERROR_LEVEL_SYNTAX },
|
|
@@ -442,6 +444,8 @@ pm_diagnostic_id_human(pm_diagnostic_id_t diag_id) {
|
|
|
442
444
|
case PM_ERR_ARGUMENT_FORWARDING_UNBOUND: return "argument_forwarding_unbound";
|
|
443
445
|
case PM_ERR_ARGUMENT_NO_FORWARDING_AMPERSAND: return "argument_no_forwarding_ampersand";
|
|
444
446
|
case PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES: return "argument_no_forwarding_ellipses";
|
|
447
|
+
case PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_LAMBDA: return "argument_no_forwarding_ellipses_lambda";
|
|
448
|
+
case PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_BLOCK: return "argument_no_forwarding_ellipses_block";
|
|
445
449
|
case PM_ERR_ARGUMENT_NO_FORWARDING_STAR: return "argument_no_forwarding_star";
|
|
446
450
|
case PM_ERR_ARGUMENT_NO_FORWARDING_STAR_STAR: return "argument_no_forwarding_star_star";
|
|
447
451
|
case PM_ERR_ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT: return "argument_splat_after_assoc_splat";
|
|
@@ -757,6 +761,7 @@ pm_diagnostic_id_human(pm_diagnostic_id_t diag_id) {
|
|
|
757
761
|
static inline const char *
|
|
758
762
|
pm_diagnostic_message(pm_diagnostic_id_t diag_id) {
|
|
759
763
|
assert(diag_id < PM_DIAGNOSTIC_ID_MAX);
|
|
764
|
+
PRISM_ASSUME(diag_id < PM_DIAGNOSTIC_ID_MAX);
|
|
760
765
|
|
|
761
766
|
const char *message = diagnostic_messages[diag_id].message;
|
|
762
767
|
assert(message);
|
|
@@ -767,6 +772,7 @@ pm_diagnostic_message(pm_diagnostic_id_t diag_id) {
|
|
|
767
772
|
static inline uint8_t
|
|
768
773
|
pm_diagnostic_level(pm_diagnostic_id_t diag_id) {
|
|
769
774
|
assert(diag_id < PM_DIAGNOSTIC_ID_MAX);
|
|
775
|
+
PRISM_ASSUME(diag_id < PM_DIAGNOSTIC_ID_MAX);
|
|
770
776
|
|
|
771
777
|
return (uint8_t) diagnostic_messages[diag_id].level;
|
|
772
778
|
}
|
data/src/prism.c
CHANGED
|
@@ -9979,8 +9979,21 @@ parser_lex(pm_parser_t *parser) {
|
|
|
9979
9979
|
following && (
|
|
9980
9980
|
(peek_at(parser, following) == '&' && peek_at(parser, following + 1) == '&') ||
|
|
9981
9981
|
(peek_at(parser, following) == '|' && peek_at(parser, following + 1) == '|') ||
|
|
9982
|
-
(
|
|
9983
|
-
|
|
9982
|
+
(
|
|
9983
|
+
peek_at(parser, following) == 'a' &&
|
|
9984
|
+
peek_at(parser, following + 1) == 'n' &&
|
|
9985
|
+
peek_at(parser, following + 2) == 'd' &&
|
|
9986
|
+
peek_at(parser, next_content + 3) != '!' &&
|
|
9987
|
+
peek_at(parser, next_content + 3) != '?' &&
|
|
9988
|
+
!char_is_identifier(parser, following + 3, parser->end - (following + 3))
|
|
9989
|
+
) ||
|
|
9990
|
+
(
|
|
9991
|
+
peek_at(parser, following) == 'o' &&
|
|
9992
|
+
peek_at(parser, following + 1) == 'r' &&
|
|
9993
|
+
peek_at(parser, next_content + 2) != '!' &&
|
|
9994
|
+
peek_at(parser, next_content + 2) != '?' &&
|
|
9995
|
+
!char_is_identifier(parser, following + 2, parser->end - (following + 2))
|
|
9996
|
+
)
|
|
9984
9997
|
)
|
|
9985
9998
|
) {
|
|
9986
9999
|
if (!lexed_comment) parser_lex_ignored_newline(parser);
|
|
@@ -10051,6 +10064,8 @@ parser_lex(pm_parser_t *parser) {
|
|
|
10051
10064
|
peek_at(parser, next_content) == 'a' &&
|
|
10052
10065
|
peek_at(parser, next_content + 1) == 'n' &&
|
|
10053
10066
|
peek_at(parser, next_content + 2) == 'd' &&
|
|
10067
|
+
peek_at(parser, next_content + 3) != '!' &&
|
|
10068
|
+
peek_at(parser, next_content + 3) != '?' &&
|
|
10054
10069
|
!char_is_identifier(parser, next_content + 3, parser->end - (next_content + 3))
|
|
10055
10070
|
) {
|
|
10056
10071
|
if (!lexed_comment) parser_lex_ignored_newline(parser);
|
|
@@ -10067,6 +10082,8 @@ parser_lex(pm_parser_t *parser) {
|
|
|
10067
10082
|
if (
|
|
10068
10083
|
peek_at(parser, next_content) == 'o' &&
|
|
10069
10084
|
peek_at(parser, next_content + 1) == 'r' &&
|
|
10085
|
+
peek_at(parser, next_content + 2) != '!' &&
|
|
10086
|
+
peek_at(parser, next_content + 2) != '?' &&
|
|
10070
10087
|
!char_is_identifier(parser, next_content + 2, parser->end - (next_content + 2))
|
|
10071
10088
|
) {
|
|
10072
10089
|
if (!lexed_comment) parser_lex_ignored_newline(parser);
|
|
@@ -10757,7 +10774,10 @@ parser_lex(pm_parser_t *parser) {
|
|
|
10757
10774
|
}
|
|
10758
10775
|
|
|
10759
10776
|
if (lex_state_spcarg_p(parser, space_seen)) {
|
|
10760
|
-
|
|
10777
|
+
// https://bugs.ruby-lang.org/issues/21994
|
|
10778
|
+
if (parser->version <= PM_OPTIONS_VERSION_CRUBY_4_0) {
|
|
10779
|
+
pm_parser_warn_token(parser, &parser->current, PM_WARN_AMBIGUOUS_SLASH);
|
|
10780
|
+
}
|
|
10761
10781
|
lex_mode_push_regexp(parser, '\0', '/');
|
|
10762
10782
|
LEX(PM_TOKEN_REGEXP_BEGIN);
|
|
10763
10783
|
}
|
|
@@ -13859,6 +13879,7 @@ parse_parameters(
|
|
|
13859
13879
|
bool allows_forwarding_parameters,
|
|
13860
13880
|
bool accepts_blocks_in_defaults,
|
|
13861
13881
|
bool in_block,
|
|
13882
|
+
pm_diagnostic_id_t diag_id_forwarding,
|
|
13862
13883
|
uint16_t depth
|
|
13863
13884
|
) {
|
|
13864
13885
|
pm_do_loop_stack_push(parser, false);
|
|
@@ -13914,7 +13935,7 @@ parse_parameters(
|
|
|
13914
13935
|
}
|
|
13915
13936
|
case PM_TOKEN_UDOT_DOT_DOT: {
|
|
13916
13937
|
if (!allows_forwarding_parameters) {
|
|
13917
|
-
pm_parser_err_current(parser,
|
|
13938
|
+
pm_parser_err_current(parser, diag_id_forwarding);
|
|
13918
13939
|
}
|
|
13919
13940
|
|
|
13920
13941
|
bool succeeded = update_parameter_state(parser, &parser->current, &order);
|
|
@@ -14594,6 +14615,7 @@ parse_block_parameters(
|
|
|
14594
14615
|
false,
|
|
14595
14616
|
accepts_blocks_in_defaults,
|
|
14596
14617
|
true,
|
|
14618
|
+
is_lambda_literal ? PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_LAMBDA : PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES_BLOCK,
|
|
14597
14619
|
(uint16_t) (depth + 1)
|
|
14598
14620
|
);
|
|
14599
14621
|
if (!is_lambda_literal) {
|
|
@@ -18836,7 +18858,17 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
|
|
|
18836
18858
|
if (match1(parser, PM_TOKEN_PARENTHESIS_RIGHT)) {
|
|
18837
18859
|
params = NULL;
|
|
18838
18860
|
} else {
|
|
18839
|
-
params = parse_parameters(
|
|
18861
|
+
params = parse_parameters(
|
|
18862
|
+
parser,
|
|
18863
|
+
PM_BINDING_POWER_DEFINED,
|
|
18864
|
+
true,
|
|
18865
|
+
false,
|
|
18866
|
+
true,
|
|
18867
|
+
true,
|
|
18868
|
+
false,
|
|
18869
|
+
PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES,
|
|
18870
|
+
(uint16_t) (depth + 1)
|
|
18871
|
+
);
|
|
18840
18872
|
}
|
|
18841
18873
|
|
|
18842
18874
|
lex_state_set(parser, PM_LEX_STATE_BEG);
|
|
@@ -18861,7 +18893,17 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
|
|
|
18861
18893
|
|
|
18862
18894
|
lparen = not_provided(parser);
|
|
18863
18895
|
rparen = not_provided(parser);
|
|
18864
|
-
params = parse_parameters(
|
|
18896
|
+
params = parse_parameters(
|
|
18897
|
+
parser,
|
|
18898
|
+
PM_BINDING_POWER_DEFINED,
|
|
18899
|
+
false,
|
|
18900
|
+
false,
|
|
18901
|
+
true,
|
|
18902
|
+
true,
|
|
18903
|
+
false,
|
|
18904
|
+
PM_ERR_ARGUMENT_NO_FORWARDING_ELLIPSES,
|
|
18905
|
+
(uint16_t) (depth + 1)
|
|
18906
|
+
);
|
|
18865
18907
|
|
|
18866
18908
|
// Reject `def * = 1` and similar. We have to specifically check
|
|
18867
18909
|
// for them because they create ambiguity with optional arguments.
|
|
@@ -18917,7 +18959,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
|
|
|
18917
18959
|
context_push(parser, PM_CONTEXT_RESCUE_MODIFIER);
|
|
18918
18960
|
|
|
18919
18961
|
pm_token_t rescue_keyword = parser->previous;
|
|
18920
|
-
pm_node_t *value = parse_expression(parser,
|
|
18962
|
+
pm_node_t *value = parse_expression(parser, PM_BINDING_POWER_MATCH + 1, false, false, PM_ERR_RESCUE_MODIFIER_VALUE, (uint16_t) (depth + 1));
|
|
18921
18963
|
context_pop(parser);
|
|
18922
18964
|
|
|
18923
18965
|
statement = UP(pm_rescue_modifier_node_create(parser, statement, &rescue_keyword, value));
|
|
@@ -20214,7 +20256,7 @@ parse_assignment_value(pm_parser_t *parser, pm_binding_power_t previous_binding_
|
|
|
20214
20256
|
pm_token_t rescue = parser->current;
|
|
20215
20257
|
parser_lex(parser);
|
|
20216
20258
|
|
|
20217
|
-
pm_node_t *right = parse_expression(parser,
|
|
20259
|
+
pm_node_t *right = parse_expression(parser, PM_BINDING_POWER_MATCH + 1, false, false, PM_ERR_RESCUE_MODIFIER_VALUE, (uint16_t) (depth + 1));
|
|
20218
20260
|
context_pop(parser);
|
|
20219
20261
|
|
|
20220
20262
|
return UP(pm_rescue_modifier_node_create(parser, value, &rescue, right));
|
|
@@ -20320,7 +20362,7 @@ parse_assignment_values(pm_parser_t *parser, pm_binding_power_t previous_binding
|
|
|
20320
20362
|
}
|
|
20321
20363
|
}
|
|
20322
20364
|
|
|
20323
|
-
pm_node_t *right = parse_expression(parser,
|
|
20365
|
+
pm_node_t *right = parse_expression(parser, PM_BINDING_POWER_MATCH + 1, accepts_command_call_inner, false, PM_ERR_RESCUE_MODIFIER_VALUE, (uint16_t) (depth + 1));
|
|
20324
20366
|
context_pop(parser);
|
|
20325
20367
|
|
|
20326
20368
|
return UP(pm_rescue_modifier_node_create(parser, value, &rescue, right));
|
|
@@ -21639,12 +21681,6 @@ parse_expression(pm_parser_t *parser, pm_binding_power_t binding_power, bool acc
|
|
|
21639
21681
|
) {
|
|
21640
21682
|
node = parse_expression_infix(parser, node, binding_power, current_binding_powers.right, accepts_command_call, (uint16_t) (depth + 1));
|
|
21641
21683
|
|
|
21642
|
-
if (context_terminator(parser->current_context->context, &parser->current)) {
|
|
21643
|
-
// If this token terminates the current context, then we need to
|
|
21644
|
-
// stop parsing the expression, as it has become a statement.
|
|
21645
|
-
return node;
|
|
21646
|
-
}
|
|
21647
|
-
|
|
21648
21684
|
switch (PM_NODE_TYPE(node)) {
|
|
21649
21685
|
case PM_MULTI_WRITE_NODE:
|
|
21650
21686
|
// Multi-write nodes are statements, and cannot be followed by
|
|
@@ -21757,6 +21793,17 @@ parse_expression(pm_parser_t *parser, pm_binding_power_t binding_power, bool acc
|
|
|
21757
21793
|
break;
|
|
21758
21794
|
}
|
|
21759
21795
|
}
|
|
21796
|
+
|
|
21797
|
+
if (context_terminator(parser->current_context->context, &parser->current)) {
|
|
21798
|
+
pm_binding_powers_t next_binding_powers = pm_binding_powers[parser->current.type];
|
|
21799
|
+
if (
|
|
21800
|
+
!next_binding_powers.binary ||
|
|
21801
|
+
binding_power > next_binding_powers.left ||
|
|
21802
|
+
(PM_NODE_TYPE_P(node, PM_CALL_NODE) && pm_call_node_command_p((pm_call_node_t *) node))
|
|
21803
|
+
) {
|
|
21804
|
+
return node;
|
|
21805
|
+
}
|
|
21806
|
+
}
|
|
21760
21807
|
}
|
|
21761
21808
|
|
|
21762
21809
|
return node;
|
data/src/util/pm_memchr.c
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* we need to search for a character in a buffer that could be the trailing byte
|
|
8
8
|
* of a multibyte character.
|
|
9
9
|
*/
|
|
10
|
-
void *
|
|
10
|
+
const void *
|
|
11
11
|
pm_memchr(const void *memory, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding) {
|
|
12
12
|
if (encoding_changed && encoding->multibyte && character >= PRISM_MEMCHR_TRAILING_BYTE_MINIMUM) {
|
|
13
13
|
const uint8_t *source = (const uint8_t *) memory;
|