prism 2.0.0.rc2-arm-linux-gnu → 2.1.0-arm-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 +57 -41
- data/Makefile +8 -8
- data/README.md +3 -1
- data/docs/fuzzing.md +5 -5
- data/docs/serialization.md +19 -6
- data/ext/prism/api_node.c +80 -80
- data/ext/prism/extension.c +34 -67
- data/ext/prism/extension.h +1 -1
- data/include/prism/arena.h +8 -0
- data/include/prism/arena.hpp +42 -0
- data/include/prism/ast.h +11 -1
- data/include/prism/ast.hpp +641 -0
- data/include/prism/buffer.h +8 -0
- data/include/prism/buffer.hpp +55 -0
- data/include/prism/comments.h +17 -0
- data/include/prism/compiler/branch.h +26 -0
- data/include/prism/compiler/cplusplus.hpp +16 -0
- data/include/prism/compiler/exceptions.hpp +17 -0
- data/include/prism/compiler/format.h +2 -0
- data/include/prism/compiler/lifetimebound.hpp +25 -0
- data/include/prism/constant_pool.h +25 -0
- data/include/prism/diagnostic.h +18 -0
- data/include/prism/errors_format.h +8 -0
- data/include/prism/internal/comments.h +2 -1
- data/include/prism/internal/node.h +8 -4
- data/include/prism/internal/parser.h +26 -15
- data/include/prism/internal/static_literals.h +24 -64
- data/include/prism/internal/stringy.h +1 -6
- data/include/prism/json.h +8 -0
- data/include/prism/line_offset_list.h +8 -0
- data/include/prism/magic_comments.h +18 -0
- data/include/prism/node.h +55 -10
- data/include/prism/node.hpp +272 -0
- data/include/prism/node_type.hpp +38 -0
- data/include/prism/options.h +10 -1
- data/include/prism/options.hpp +43 -0
- data/include/prism/parser.h +72 -64
- data/include/prism/parser.hpp +274 -0
- data/include/prism/prettyprint.h +8 -0
- data/include/prism/serialize.h +8 -0
- data/include/prism/source.h +8 -0
- data/include/prism/stream.h +8 -0
- data/include/prism/string_query.h +8 -0
- data/include/prism/stringy.h +16 -27
- data/include/prism/stringy.hpp +31 -0
- data/include/prism/version.h +10 -2
- data/include/prism.h +0 -8
- data/include/prism.hpp +24 -0
- 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/serialize.rb +2550 -3282
- data/prism.gemspec +14 -1
- data/rbi/generated/prism/node.rbi +736 -0
- data/rbi/generated/prism/serialize.rbi +6 -5
- data/sig/generated/prism/node.rbs +736 -0
- data/sig/generated/prism/serialize.rbs +7 -5
- data/src/arena.c +6 -1
- data/src/comments.c +11 -10
- data/src/diagnostic.c +24 -4
- data/src/integer.c +6 -1
- data/src/node.c +216 -368
- data/src/options.c +7 -13
- data/src/parser.c +52 -48
- data/src/prism.c +222 -240
- data/src/regexp.c +0 -1
- data/src/serialize.c +2300 -1950
- data/src/source.c +8 -2
- data/src/static_literals.c +280 -405
- data/src/stringy.c +3 -33
- metadata +14 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file stringy.hpp
|
|
3
|
+
*
|
|
4
|
+
* Access to the contents of strings from C++.
|
|
5
|
+
*/
|
|
6
|
+
#ifndef PRISM_STRINGY_HPP
|
|
7
|
+
#define PRISM_STRINGY_HPP
|
|
8
|
+
|
|
9
|
+
#include "prism/compiler/cplusplus.hpp"
|
|
10
|
+
#include "prism/compiler/lifetimebound.hpp"
|
|
11
|
+
|
|
12
|
+
#include "prism/stringy.h"
|
|
13
|
+
|
|
14
|
+
#include <string_view>
|
|
15
|
+
|
|
16
|
+
namespace prism {
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The bytes of the given string.
|
|
20
|
+
*
|
|
21
|
+
* @param string The string to view.
|
|
22
|
+
* @return A view of the bytes of the string.
|
|
23
|
+
*/
|
|
24
|
+
[[nodiscard]] inline std::string_view
|
|
25
|
+
view(const pm_string_t &string PRISM_LIFETIMEBOUND) noexcept {
|
|
26
|
+
return std::string_view(reinterpret_cast<const char *>(pm_string_source(&string)), pm_string_length(&string));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#endif
|
data/include/prism/version.h
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
#include "prism/compiler/exported.h"
|
|
10
10
|
|
|
11
|
+
#ifdef __cplusplus
|
|
12
|
+
extern "C" {
|
|
13
|
+
#endif
|
|
14
|
+
|
|
11
15
|
/**
|
|
12
16
|
* The major version of the Prism library as an int.
|
|
13
17
|
*/
|
|
@@ -16,7 +20,7 @@
|
|
|
16
20
|
/**
|
|
17
21
|
* The minor version of the Prism library as an int.
|
|
18
22
|
*/
|
|
19
|
-
#define PRISM_VERSION_MINOR
|
|
23
|
+
#define PRISM_VERSION_MINOR 1
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* The patch version of the Prism library as an int.
|
|
@@ -26,7 +30,7 @@
|
|
|
26
30
|
/**
|
|
27
31
|
* The version of the Prism library as a constant string.
|
|
28
32
|
*/
|
|
29
|
-
#define PRISM_VERSION "2.
|
|
33
|
+
#define PRISM_VERSION "2.1.0"
|
|
30
34
|
|
|
31
35
|
/**
|
|
32
36
|
* The prism version and the serialization format.
|
|
@@ -35,4 +39,8 @@
|
|
|
35
39
|
*/
|
|
36
40
|
PRISM_EXPORTED_FUNCTION const char * pm_version(void);
|
|
37
41
|
|
|
42
|
+
#ifdef __cplusplus
|
|
43
|
+
}
|
|
44
|
+
#endif
|
|
45
|
+
|
|
38
46
|
#endif
|
data/include/prism.h
CHANGED
|
@@ -6,10 +6,6 @@
|
|
|
6
6
|
#ifndef PRISM_H
|
|
7
7
|
#define PRISM_H
|
|
8
8
|
|
|
9
|
-
#ifdef __cplusplus
|
|
10
|
-
extern "C" {
|
|
11
|
-
#endif
|
|
12
|
-
|
|
13
9
|
#include "prism/arena.h"
|
|
14
10
|
#include "prism/ast.h"
|
|
15
11
|
#include "prism/buffer.h"
|
|
@@ -124,8 +120,4 @@ extern "C" {
|
|
|
124
120
|
* ```
|
|
125
121
|
*/
|
|
126
122
|
|
|
127
|
-
#ifdef __cplusplus
|
|
128
|
-
}
|
|
129
|
-
#endif
|
|
130
|
-
|
|
131
123
|
#endif
|
data/include/prism.hpp
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file prism.hpp
|
|
3
|
+
*
|
|
4
|
+
* The main header file for the C++ interface to the prism parser. It adds
|
|
5
|
+
* ownership, checked casts between node types, and callable-based iteration on
|
|
6
|
+
* top of the C API. It never wraps the C structs: every function in it takes
|
|
7
|
+
* and returns the same pm_*_t types that prism.h declares, so the two can be
|
|
8
|
+
* mixed freely. It requires C++17 or later.
|
|
9
|
+
*/
|
|
10
|
+
#ifndef PRISM_HPP
|
|
11
|
+
#define PRISM_HPP
|
|
12
|
+
|
|
13
|
+
#include "prism.h"
|
|
14
|
+
|
|
15
|
+
#include "prism/arena.hpp"
|
|
16
|
+
#include "prism/ast.hpp"
|
|
17
|
+
#include "prism/buffer.hpp"
|
|
18
|
+
#include "prism/node.hpp"
|
|
19
|
+
#include "prism/node_type.hpp"
|
|
20
|
+
#include "prism/options.hpp"
|
|
21
|
+
#include "prism/parser.hpp"
|
|
22
|
+
#include "prism/stringy.hpp"
|
|
23
|
+
|
|
24
|
+
#endif
|
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
|