prism 2.0.0.rc1-x86_64-linux-gnu → 2.0.0.rc2-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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/LICENSE.md +1 -1
- data/docs/serialization.md +1 -0
- data/ext/prism/api_node.c +1 -1
- data/ext/prism/extension.c +20 -2
- data/ext/prism/extension.h +1 -1
- data/include/prism/compiler/accel.h +3 -1
- data/include/prism/compiler/bswap.h +46 -0
- data/include/prism/compiler/endianness.h +34 -0
- data/include/prism/internal/buffer.h +3 -0
- data/include/prism/internal/parser.h +20 -0
- data/include/prism/internal/xxh3.h +16 -0
- data/include/prism/parser.h +21 -0
- data/include/prism/string_query.h +11 -0
- data/include/prism/version.h +1 -1
- data/lib/prism/3.3/prism.so +0 -0
- data/lib/prism/3.4/prism.so +0 -0
- data/lib/prism/4.0/prism.so +0 -0
- data/lib/prism/ffi.rb +6 -0
- data/lib/prism/node.rb +736 -0
- data/lib/prism/parse_result.rb +23 -8
- data/lib/prism/serialize.rb +19 -6
- data/lib/prism/string_query.rb +8 -0
- data/prism.gemspec +8 -4
- data/rbi/generated/prism/node.rbi +1706 -980
- data/rbi/generated/prism/parse_result.rbi +16 -4
- data/rbi/generated/prism/serialize.rbi +3 -0
- data/rbi/generated/prism/string_query.rbi +7 -0
- data/sig/generated/prism/node.rbs +1713 -977
- data/sig/generated/prism/parse_result.rbs +16 -4
- data/sig/generated/prism/serialize.rbs +3 -0
- data/sig/generated/prism/string_query.rbs +7 -0
- data/src/buffer.c +9 -0
- data/src/parser.c +18 -0
- data/src/prism.c +406 -225
- data/src/serialize.c +2 -1
- data/src/string_query.c +14 -0
- data/src/xxh3.c +292 -0
- metadata +7 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 98349b6e074f7483057352eec27a0d76d3d012cd04ba771c12319beb07786040
|
|
4
|
+
data.tar.gz: d0cc79a7745253e2ae1987e7a5df08a63e63a350f1a44a05fc4ce8a0563a234a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f3cab7ac92216d5b7546e6f4fcb4fcfeff2262ee6540b513d84cc0d28d99c74c7697d3803477d62b81c233ed9aaeb942c131f19b18f58b08b908ad0662afeebb
|
|
7
|
+
data.tar.gz: cbfcf5a6da8e0be1937906da87d5a38dafe0a67f36f94752b1a37a908904f4a71c82a78ab717ce44d21014db30db8d5dd3d89e9b0dc699957f0f52fde844682a
|
data/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
|
12
12
|
- Precompiled platform-specific variants on rubygems.org.
|
|
13
13
|
- Many documentation improvements, including a new playground.
|
|
14
14
|
- Prism now ships accurate and complete RBS and RBI definitions.
|
|
15
|
+
- The license is now owned by the Ruby developers.
|
|
15
16
|
|
|
16
17
|
### Added
|
|
17
18
|
|
|
@@ -29,6 +30,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
|
29
30
|
- Allow pattern matching with prism nodes to match on location slices, like `node in Prism::StringNode[content: "foo"]`.
|
|
30
31
|
- `Prism.parse_file` and similar now accept anything responding to `to_path` (like `Pathname`) directly.
|
|
31
32
|
- `attach_comments` was added as a valid option. Each comment is attached to the node that ends latest on the comment's line before it, otherwise to the innermost node that contains it (or to that node's statements, if only whitespace and comments come between the comment and the statements), otherwise to the top-level statements. The attached comments are available through `Node#comments` and through `pm_node_comments_size` and `pm_node_comment` in the C API, as well as `pm_parser_comment_attachment`, `pm_parser_comment_ranges_size`, and `pm_parser_comment_range`, which expose the attachments grouped by node. When the option is set, the comments on the parse result are sorted by start offset.
|
|
33
|
+
- `StringQuery#keyword?` was added to check if the string query matches a keyword.
|
|
34
|
+
- `Source#checksum` was added to retrieve the checksum of the source content.
|
|
32
35
|
|
|
33
36
|
### Changed
|
|
34
37
|
|
|
@@ -71,6 +74,7 @@ Note that for this major version, almost every change listed below is breaking.
|
|
|
71
74
|
- Most allocations are now performed through an arena.
|
|
72
75
|
- `newline_list` was renamed to `list_offset_list`.
|
|
73
76
|
- `Diagnostic::message` now returns `&[u8]` instead of `&str`.
|
|
77
|
+
- `StringQuery` is now exposed.
|
|
74
78
|
|
|
75
79
|
#### JavaScript
|
|
76
80
|
|
data/CODE_OF_CONDUCT.md
CHANGED
|
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
|
55
55
|
## Enforcement
|
|
56
56
|
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
-
reported by contacting the project team at
|
|
58
|
+
reported by contacting the project team at ruby-core@ruby-lang.org. All
|
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/LICENSE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright 2022-present,
|
|
1
|
+
Copyright 2022-present, Ruby developers
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
data/docs/serialization.md
CHANGED
|
@@ -106,6 +106,7 @@ The header is structured like the following table:
|
|
|
106
106
|
| `1` | 1 indicates only semantics fields were serialized, 0 indicates all fields were serialized (including location fields) |
|
|
107
107
|
| string | the encoding name |
|
|
108
108
|
| varsint | the start line |
|
|
109
|
+
| `8` | the checksum of the source up to the end of the `__END__` line in native endian order, see `pm_parser_checksum` |
|
|
109
110
|
| varuint | number of newline offsets |
|
|
110
111
|
| varuint* | newline offsets |
|
|
111
112
|
| varuint | number of comments |
|
data/ext/prism/api_node.c
CHANGED
|
@@ -253,7 +253,7 @@ pm_source_new(const pm_parser_t *parser, rb_encoding *encoding, VALUE comments,
|
|
|
253
253
|
offsets = rb_str_new((const char *) line_offsets->offsets, line_offsets->size * sizeof(uint32_t));
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
VALUE source = rb_funcall(rb_cPrismSource, rb_intern("for"),
|
|
256
|
+
VALUE source = rb_funcall(rb_cPrismSource, rb_intern("for"), 7, source_string, LONG2NUM(pm_parser_start_line(parser)), offsets, comments, comment_attachments, comment_ranges, ULL2NUM(pm_parser_checksum(parser)));
|
|
257
257
|
if (freeze) rb_obj_freeze(source);
|
|
258
258
|
|
|
259
259
|
return source;
|
data/ext/prism/extension.c
CHANGED
|
@@ -983,8 +983,9 @@ parse_lex_input(const uint8_t *input, size_t input_length, const pm_options_t *o
|
|
|
983
983
|
|
|
984
984
|
result_t result = check_raise_error_option(parser, options, path_encoding);
|
|
985
985
|
if (result.type == RESULT_OK) {
|
|
986
|
-
/* Update the Source object with the correct encoding
|
|
987
|
-
* which are only available after pm_parse()
|
|
986
|
+
/* Update the Source object with the correct encoding, line offsets,
|
|
987
|
+
* and source hash, which are only available after pm_parse()
|
|
988
|
+
* completes. */
|
|
988
989
|
rb_encoding *encoding = rb_enc_find(pm_parser_encoding_name(parser));
|
|
989
990
|
rb_enc_associate(source_string, encoding);
|
|
990
991
|
|
|
@@ -993,6 +994,8 @@ parse_lex_input(const uint8_t *input, size_t input_length, const pm_options_t *o
|
|
|
993
994
|
rb_ary_store(offsets, (long) index, ULONG2NUM(line_offsets->offsets[index]));
|
|
994
995
|
}
|
|
995
996
|
|
|
997
|
+
rb_funcall(source, rb_intern("replace_checksum"), 1, ULL2NUM(pm_parser_checksum(parser)));
|
|
998
|
+
|
|
996
999
|
if (pm_options_freeze(options)) {
|
|
997
1000
|
rb_obj_freeze(source_string);
|
|
998
1001
|
rb_obj_freeze(offsets);
|
|
@@ -1678,6 +1681,20 @@ string_query_method_name_p(VALUE self, VALUE string) {
|
|
|
1678
1681
|
return string_query(pm_string_query_method_name(source, RSTRING_LEN(string), rb_enc_get(string)->name));
|
|
1679
1682
|
}
|
|
1680
1683
|
|
|
1684
|
+
/**
|
|
1685
|
+
* :markup: markdown
|
|
1686
|
+
* call-seq:
|
|
1687
|
+
* keyword?(string) -> bool
|
|
1688
|
+
*
|
|
1689
|
+
* Returns true if the string is a valid keyword, such as `if`, `defined?`, or
|
|
1690
|
+
* `__FILE__`.
|
|
1691
|
+
*/
|
|
1692
|
+
static VALUE
|
|
1693
|
+
string_query_keyword_p(VALUE self, VALUE string) {
|
|
1694
|
+
const uint8_t *source = (const uint8_t *) check_string(string);
|
|
1695
|
+
return string_query(pm_string_query_keyword(source, RSTRING_LEN(string), rb_enc_get(string)->name));
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1681
1698
|
/******************************************************************************/
|
|
1682
1699
|
/* Initialization of the extension */
|
|
1683
1700
|
/******************************************************************************/
|
|
@@ -1778,6 +1795,7 @@ Init_prism(void) {
|
|
|
1778
1795
|
rb_define_singleton_method(rb_cPrismStringQuery, "local?", string_query_local_p, 1);
|
|
1779
1796
|
rb_define_singleton_method(rb_cPrismStringQuery, "constant?", string_query_constant_p, 1);
|
|
1780
1797
|
rb_define_singleton_method(rb_cPrismStringQuery, "method_name?", string_query_method_name_p, 1);
|
|
1798
|
+
rb_define_singleton_method(rb_cPrismStringQuery, "keyword?", string_query_keyword_p, 1);
|
|
1781
1799
|
|
|
1782
1800
|
Init_prism_api_node();
|
|
1783
1801
|
}
|
data/ext/prism/extension.h
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
#ifndef PRISM_COMPILER_ACCEL_H
|
|
5
5
|
#define PRISM_COMPILER_ACCEL_H
|
|
6
6
|
|
|
7
|
+
#include "prism/compiler/endianness.h"
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* Platform detection for SIMD/fast-path implementations. At most one of these
|
|
9
11
|
* macros is defined, selecting the best available vectorization strategy.
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
# define PRISM_HAS_NEON
|
|
18
20
|
#elif (defined(__x86_64__) && defined(__SSE2__)) || (defined(_MSC_VER) && defined(_M_X64))
|
|
19
21
|
# define PRISM_HAS_SSE2
|
|
20
|
-
#elif defined(
|
|
22
|
+
#elif defined(PRISM_LITTLE_ENDIAN_COMPTIME)
|
|
21
23
|
# define PRISM_HAS_SWAR
|
|
22
24
|
#endif
|
|
23
25
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file compiler/bswap.h
|
|
3
|
+
*/
|
|
4
|
+
#ifndef PRISM_COMPILER_BSWAP_H
|
|
5
|
+
#define PRISM_COMPILER_BSWAP_H
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Byte swap utilities for 32-bit and 64-bit integers.
|
|
9
|
+
*/
|
|
10
|
+
#if defined(__GNUC__) || defined(__clang__)
|
|
11
|
+
#define pm_bswap32(x_) __builtin_bswap32((x_))
|
|
12
|
+
#define pm_bswap64(x_) __builtin_bswap64((x_))
|
|
13
|
+
#elif defined(_MSC_VER)
|
|
14
|
+
#include <stdlib.h>
|
|
15
|
+
|
|
16
|
+
#define pm_bswap32(x_) _byteswap_ulong((x_))
|
|
17
|
+
#define pm_bswap64(x_) _byteswap_uint64((x_))
|
|
18
|
+
#else
|
|
19
|
+
#include <stdint.h>
|
|
20
|
+
|
|
21
|
+
static uint32_t
|
|
22
|
+
pm_bswap32(uint32_t x) {
|
|
23
|
+
return (
|
|
24
|
+
((x >> 24) & 0x000000FFUL) |
|
|
25
|
+
((x << 24) & 0xFF000000UL) |
|
|
26
|
+
((x >> 8) & 0x0000FF00UL) |
|
|
27
|
+
((x << 8) & 0x00FF0000UL)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static uint64_t
|
|
32
|
+
pm_bswap64(uint64_t x) {
|
|
33
|
+
return (
|
|
34
|
+
((x >> 56) & 0x00000000000000FFULL) |
|
|
35
|
+
((x << 56) & 0xFF00000000000000ULL) |
|
|
36
|
+
((x >> 40) & 0x000000000000FF00ULL) |
|
|
37
|
+
((x << 40) & 0x00FF000000000000ULL) |
|
|
38
|
+
((x >> 24) & 0x0000000000FF0000ULL) |
|
|
39
|
+
((x << 24) & 0x0000FF0000000000ULL) |
|
|
40
|
+
((x >> 8) & 0x00000000FF000000ULL) |
|
|
41
|
+
((x << 8) & 0x000000FF00000000ULL)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
#endif
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file compiler/endianness.h
|
|
3
|
+
*/
|
|
4
|
+
#ifndef PRISM_COMPILER_ENDIANNESS_H
|
|
5
|
+
#define PRISM_COMPILER_ENDIANNESS_H
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Detect endianness at compile-time through the use of predefined macros.
|
|
9
|
+
*/
|
|
10
|
+
#if defined(_WIN32) || defined(__LITTLE_ENDIAN__) || (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
|
11
|
+
#define PRISM_LITTLE_ENDIAN_COMPTIME
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Determine endianness at runtime, either through predefined macros or through
|
|
16
|
+
* a runtime check that is usually folded.
|
|
17
|
+
*/
|
|
18
|
+
#if defined(PRISM_LITTLE_ENDIAN_COMPTIME)
|
|
19
|
+
#define PRISM_LITTLE_ENDIAN_RUNTIME 1
|
|
20
|
+
#elif defined(__BIG_ENDIAN__) || (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
|
21
|
+
#define PRISM_LITTLE_ENDIAN_RUNTIME 0
|
|
22
|
+
#else
|
|
23
|
+
#include <stdint.h>
|
|
24
|
+
|
|
25
|
+
static inline int
|
|
26
|
+
pm_little_endian(void) {
|
|
27
|
+
const union { uint32_t u; uint8_t c[4]; } one = { 1 };
|
|
28
|
+
return one.c[0];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#define PRISM_LITTLE_ENDIAN_RUNTIME pm_little_endian()
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#endif
|
|
@@ -52,6 +52,9 @@ void pm_buffer_append_varsint(pm_buffer_t *buffer, int32_t value);
|
|
|
52
52
|
/* Append a double to the buffer. */
|
|
53
53
|
void pm_buffer_append_double(pm_buffer_t *buffer, double value);
|
|
54
54
|
|
|
55
|
+
/* Append a 64-bit unsigned integer to the buffer in native endian order. */
|
|
56
|
+
void pm_buffer_append_uint64(pm_buffer_t *buffer, uint64_t value);
|
|
57
|
+
|
|
55
58
|
/* Append a unicode codepoint to the buffer. */
|
|
56
59
|
bool pm_buffer_append_unicode_codepoint(pm_buffer_t *buffer, uint32_t value);
|
|
57
60
|
|
|
@@ -715,9 +715,23 @@ struct pm_parser_t {
|
|
|
715
715
|
/* The current local scope. */
|
|
716
716
|
pm_scope_t *current_scope;
|
|
717
717
|
|
|
718
|
+
/*
|
|
719
|
+
* Scopes that have been popped, kept for reuse by the next push. Scopes
|
|
720
|
+
* are allocated from the metadata arena, so they are never freed
|
|
721
|
+
* individually.
|
|
722
|
+
*/
|
|
723
|
+
pm_scope_t *free_scopes;
|
|
724
|
+
|
|
718
725
|
/* The current parsing context. */
|
|
719
726
|
pm_context_node_t *current_context;
|
|
720
727
|
|
|
728
|
+
/*
|
|
729
|
+
* Context nodes that have been popped, kept for reuse by the next push.
|
|
730
|
+
* Context nodes are allocated from the metadata arena, so they are never
|
|
731
|
+
* freed individually.
|
|
732
|
+
*/
|
|
733
|
+
pm_context_node_t *free_contexts;
|
|
734
|
+
|
|
721
735
|
/*
|
|
722
736
|
* The encoding functions for the current file is attached to the parser as
|
|
723
737
|
* it's parsing so that it can change with a magic comment.
|
|
@@ -981,4 +995,10 @@ void pm_parser_init(pm_arena_t *arena, pm_parser_t *parser, const uint8_t *sourc
|
|
|
981
995
|
*/
|
|
982
996
|
void pm_parser_cleanup(pm_parser_t *parser);
|
|
983
997
|
|
|
998
|
+
/*
|
|
999
|
+
* Returns true if the bytes between start and end spell a keyword, using the
|
|
1000
|
+
* same lookup that the lexer does.
|
|
1001
|
+
*/
|
|
1002
|
+
bool pm_keyword_p(const uint8_t *start, const uint8_t *end);
|
|
1003
|
+
|
|
984
1004
|
#endif
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef PRISM_INTERNAL_XXH3_H
|
|
2
|
+
#define PRISM_INTERNAL_XXH3_H
|
|
3
|
+
|
|
4
|
+
#include <stddef.h>
|
|
5
|
+
#include <stdint.h>
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Computes the XXH3 digest of the given input.
|
|
9
|
+
*
|
|
10
|
+
* @param input The input data to hash.
|
|
11
|
+
* @param length The length of the input data.
|
|
12
|
+
* @return The 64-bit XXH3 hash of the input data.
|
|
13
|
+
*/
|
|
14
|
+
uint64_t pm_xxh3(const uint8_t *input, size_t length);
|
|
15
|
+
|
|
16
|
+
#endif
|
data/include/prism/parser.h
CHANGED
|
@@ -177,6 +177,27 @@ PRISM_EXPORTED_FUNCTION const pm_line_offset_list_t * pm_parser_line_offsets(con
|
|
|
177
177
|
*/
|
|
178
178
|
PRISM_EXPORTED_FUNCTION const pm_location_t * pm_parser_data_loc(const pm_parser_t *parser) PRISM_NONNULL(1);
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Returns the checksum of the source code that was parsed. The data section
|
|
182
|
+
* after an __END__ marker is not code, so the hash covers the source only up to
|
|
183
|
+
* and including the newline that ends the __END__ line. The __END__ marker is
|
|
184
|
+
* only found by parsing, so this must be called after pm_parse.
|
|
185
|
+
*
|
|
186
|
+
* The hash is computed from the source on each call rather than during
|
|
187
|
+
* parsing, so that parses that never ask for it do not pay for it. This
|
|
188
|
+
* requires the source to still be alive, and callers that need the value more
|
|
189
|
+
* than once should keep it.
|
|
190
|
+
*
|
|
191
|
+
* The hash is currently the 64-bit variant of XXH3 with a seed of 0. It is not
|
|
192
|
+
* cryptographic, and the algorithm may change between versions of prism, so
|
|
193
|
+
* hashes should only be compared against other hashes computed by the same
|
|
194
|
+
* version of prism.
|
|
195
|
+
*
|
|
196
|
+
* @param parser the parser whose checksum we want to get
|
|
197
|
+
* @returns the checksum of the source code that was parsed
|
|
198
|
+
*/
|
|
199
|
+
PRISM_EXPORTED_FUNCTION uint64_t pm_parser_checksum(const pm_parser_t *parser) PRISM_NONNULL(1);
|
|
200
|
+
|
|
180
201
|
/**
|
|
181
202
|
* Returns whether the given parser is continuable, meaning that it could become
|
|
182
203
|
* valid if more input were appended, as opposed to being definitively invalid.
|
|
@@ -60,4 +60,15 @@ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_constant(const uint8_t
|
|
|
60
60
|
*/
|
|
61
61
|
PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_method_name(const uint8_t *source, size_t length, const char *encoding_name) PRISM_NONNULL(1, 3);
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Check that the slice is a keyword.
|
|
65
|
+
*
|
|
66
|
+
* @param source The source to check.
|
|
67
|
+
* @param length The length of the source.
|
|
68
|
+
* @param encoding_name The name of the encoding of the source.
|
|
69
|
+
* @returns PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if
|
|
70
|
+
* the query is false, and PM_STRING_QUERY_ERROR if the encoding was invalid.
|
|
71
|
+
*/
|
|
72
|
+
PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_keyword(const uint8_t *source, size_t length, const char *encoding_name) PRISM_NONNULL(1, 3);
|
|
73
|
+
|
|
63
74
|
#endif
|
data/include/prism/version.h
CHANGED
data/lib/prism/3.3/prism.so
CHANGED
|
Binary file
|
data/lib/prism/3.4/prism.so
CHANGED
|
Binary file
|
data/lib/prism/4.0/prism.so
CHANGED
|
Binary file
|
data/lib/prism/ffi.rb
CHANGED
|
@@ -124,6 +124,7 @@ module Prism # :nodoc:
|
|
|
124
124
|
"pm_string_query_local",
|
|
125
125
|
"pm_string_query_constant",
|
|
126
126
|
"pm_string_query_method_name",
|
|
127
|
+
"pm_string_query_keyword",
|
|
127
128
|
[]
|
|
128
129
|
)
|
|
129
130
|
|
|
@@ -722,6 +723,11 @@ module Prism # :nodoc:
|
|
|
722
723
|
query(LibRubyParser.pm_string_query_method_name(string, string.bytesize, string.encoding.name))
|
|
723
724
|
end
|
|
724
725
|
|
|
726
|
+
# Mirrors the C extension's StringQuery::keyword? method.
|
|
727
|
+
def keyword?(string)
|
|
728
|
+
query(LibRubyParser.pm_string_query_keyword(string, string.bytesize, string.encoding.name))
|
|
729
|
+
end
|
|
730
|
+
|
|
725
731
|
private
|
|
726
732
|
|
|
727
733
|
# Parse the enum result and return an appropriate boolean.
|