prism 2.0.0.rc2-aarch64-linux-gnu → 2.1.0-aarch64-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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -41
  3. data/Makefile +8 -8
  4. data/README.md +3 -1
  5. data/docs/fuzzing.md +5 -5
  6. data/docs/serialization.md +19 -6
  7. data/ext/prism/api_node.c +80 -80
  8. data/ext/prism/extension.c +34 -67
  9. data/ext/prism/extension.h +1 -1
  10. data/include/prism/arena.h +8 -0
  11. data/include/prism/arena.hpp +42 -0
  12. data/include/prism/ast.h +11 -1
  13. data/include/prism/ast.hpp +641 -0
  14. data/include/prism/buffer.h +8 -0
  15. data/include/prism/buffer.hpp +55 -0
  16. data/include/prism/comments.h +17 -0
  17. data/include/prism/compiler/branch.h +26 -0
  18. data/include/prism/compiler/cplusplus.hpp +16 -0
  19. data/include/prism/compiler/exceptions.hpp +17 -0
  20. data/include/prism/compiler/format.h +2 -0
  21. data/include/prism/compiler/lifetimebound.hpp +25 -0
  22. data/include/prism/constant_pool.h +25 -0
  23. data/include/prism/diagnostic.h +18 -0
  24. data/include/prism/errors_format.h +8 -0
  25. data/include/prism/internal/comments.h +2 -1
  26. data/include/prism/internal/node.h +8 -4
  27. data/include/prism/internal/parser.h +26 -15
  28. data/include/prism/internal/static_literals.h +24 -64
  29. data/include/prism/internal/stringy.h +1 -6
  30. data/include/prism/json.h +8 -0
  31. data/include/prism/line_offset_list.h +8 -0
  32. data/include/prism/magic_comments.h +18 -0
  33. data/include/prism/node.h +55 -10
  34. data/include/prism/node.hpp +272 -0
  35. data/include/prism/node_type.hpp +38 -0
  36. data/include/prism/options.h +10 -1
  37. data/include/prism/options.hpp +43 -0
  38. data/include/prism/parser.h +72 -64
  39. data/include/prism/parser.hpp +274 -0
  40. data/include/prism/prettyprint.h +8 -0
  41. data/include/prism/serialize.h +8 -0
  42. data/include/prism/source.h +8 -0
  43. data/include/prism/stream.h +8 -0
  44. data/include/prism/string_query.h +8 -0
  45. data/include/prism/stringy.h +16 -27
  46. data/include/prism/stringy.hpp +31 -0
  47. data/include/prism/version.h +10 -2
  48. data/include/prism.h +0 -8
  49. data/include/prism.hpp +24 -0
  50. data/lib/prism/3.3/prism.so +0 -0
  51. data/lib/prism/3.4/prism.so +0 -0
  52. data/lib/prism/4.0/prism.so +0 -0
  53. data/lib/prism/serialize.rb +2550 -3282
  54. data/prism.gemspec +14 -1
  55. data/rbi/generated/prism/node.rbi +736 -0
  56. data/rbi/generated/prism/serialize.rbi +6 -5
  57. data/sig/generated/prism/node.rbs +736 -0
  58. data/sig/generated/prism/serialize.rbs +7 -5
  59. data/src/arena.c +6 -1
  60. data/src/comments.c +11 -10
  61. data/src/diagnostic.c +24 -4
  62. data/src/integer.c +6 -1
  63. data/src/node.c +216 -368
  64. data/src/options.c +7 -13
  65. data/src/parser.c +52 -48
  66. data/src/prism.c +222 -240
  67. data/src/regexp.c +0 -1
  68. data/src/serialize.c +2300 -1950
  69. data/src/source.c +8 -2
  70. data/src/static_literals.c +280 -405
  71. data/src/stringy.c +3 -33
  72. metadata +14 -1
data/src/stringy.c CHANGED
@@ -1,9 +1,6 @@
1
1
  #include "prism/internal/stringy.h"
2
2
 
3
- #include "prism/internal/allocator.h"
4
-
5
3
  #include <assert.h>
6
- #include <stdlib.h>
7
4
  #include <string.h>
8
5
 
9
6
  /**
@@ -14,34 +11,17 @@ pm_string_shared_init(pm_string_t *string, const uint8_t *start, const uint8_t *
14
11
  assert(start <= end);
15
12
 
16
13
  *string = (pm_string_t) {
17
- .type = PM_STRING_SHARED,
18
14
  .source = start,
19
15
  .length = (size_t) (end - start)
20
16
  };
21
17
  }
22
18
 
23
19
  /**
24
- * Initialize an owned string that is responsible for freeing allocated memory.
25
- */
26
- void
27
- pm_string_owned_init(pm_string_t *string, uint8_t *source, size_t length) {
28
- *string = (pm_string_t) {
29
- .type = PM_STRING_OWNED,
30
- .source = source,
31
- .length = length
32
- };
33
- }
34
-
35
- /**
36
- * Initialize a constant string that doesn't own its memory source.
20
+ * Initialize a string that views the given bytes.
37
21
  */
38
22
  void
39
- pm_string_constant_init(pm_string_t *string, const char *source, size_t length) {
40
- *string = (pm_string_t) {
41
- .type = PM_STRING_CONSTANT,
42
- .source = (const uint8_t *) source,
43
- .length = length
44
- };
23
+ pm_string_init(pm_string_t *string, const uint8_t *source, size_t length) {
24
+ *string = (pm_string_t) { .source = source, .length = length };
45
25
  }
46
26
 
47
27
  /**
@@ -79,13 +59,3 @@ const uint8_t *
79
59
  pm_string_source(const pm_string_t *string) {
80
60
  return string->source;
81
61
  }
82
-
83
- /**
84
- * Free the associated memory of the given string.
85
- */
86
- void
87
- pm_string_cleanup(pm_string_t *string) {
88
- if (string->type == PM_STRING_OWNED) {
89
- xfree_sized((void *) string->source, string->length);
90
- }
91
- }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prism
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc2
4
+ version: 2.1.0
5
5
  platform: aarch64-linux-gnu
6
6
  authors:
7
7
  - Ruby developers
@@ -47,15 +47,22 @@ files:
47
47
  - ext/prism/extension.c
48
48
  - ext/prism/extension.h
49
49
  - include/prism.h
50
+ - include/prism.hpp
50
51
  - include/prism/arena.h
52
+ - include/prism/arena.hpp
51
53
  - include/prism/ast.h
54
+ - include/prism/ast.hpp
52
55
  - include/prism/buffer.h
56
+ - include/prism/buffer.hpp
53
57
  - include/prism/comments.h
54
58
  - include/prism/compiler/accel.h
55
59
  - include/prism/compiler/align.h
56
60
  - include/prism/compiler/assume.h
61
+ - include/prism/compiler/branch.h
57
62
  - include/prism/compiler/bswap.h
63
+ - include/prism/compiler/cplusplus.hpp
58
64
  - include/prism/compiler/endianness.h
65
+ - include/prism/compiler/exceptions.hpp
59
66
  - include/prism/compiler/exported.h
60
67
  - include/prism/compiler/fallthrough.h
61
68
  - include/prism/compiler/filesystem.h
@@ -63,6 +70,7 @@ files:
63
70
  - include/prism/compiler/force_inline.h
64
71
  - include/prism/compiler/format.h
65
72
  - include/prism/compiler/inline.h
73
+ - include/prism/compiler/lifetimebound.hpp
66
74
  - include/prism/compiler/nodiscard.h
67
75
  - include/prism/compiler/nonnull.h
68
76
  - include/prism/compiler/unused.h
@@ -103,14 +111,19 @@ files:
103
111
  - include/prism/line_offset_list.h
104
112
  - include/prism/magic_comments.h
105
113
  - include/prism/node.h
114
+ - include/prism/node.hpp
115
+ - include/prism/node_type.hpp
106
116
  - include/prism/options.h
117
+ - include/prism/options.hpp
107
118
  - include/prism/parser.h
119
+ - include/prism/parser.hpp
108
120
  - include/prism/prettyprint.h
109
121
  - include/prism/serialize.h
110
122
  - include/prism/source.h
111
123
  - include/prism/stream.h
112
124
  - include/prism/string_query.h
113
125
  - include/prism/stringy.h
126
+ - include/prism/stringy.hpp
114
127
  - include/prism/version.h
115
128
  - lib/prism.rb
116
129
  - lib/prism/3.3/prism.so