antlr4-native 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f14d05febd863a51c3e111e7ef3493eb2fe1b72fe72b0b3d1c5c114a2947f7c7
4
- data.tar.gz: e8f3fe771ae21c552a1074e2f0608f9c87da1e7bd9063f2f8e18363531c37e6b
3
+ metadata.gz: ba388dfab9f2c91aec93eb1ae6ce3da83bff2777a921c14dca055e7c5ef06f82
4
+ data.tar.gz: 635a32e158d29328fdb181a636462ec5f73af777ab6c1bff24da13191d735f3b
5
5
  SHA512:
6
- metadata.gz: 64cf7e6628edbaff365daf278c1e70dccd7ca083128d604efe8fcb4850c77efc621ce204fe250a7ffb91adb5d6cb4d02de9f1f68bbbb32c4c8c79d725c308a26
7
- data.tar.gz: 1c5ba3ec3908cc1a951794d0e70f87afa0f01694ef623b38269ad5f22569fd8b587c1c6a7e820d32de273f6c87e77d15abcf604e83b0edd13f2a0636c09c5d86
6
+ metadata.gz: c019c9f3549d0b0d4f1aae071592a160d3e2fdd2c8a0bab89c24d34d2f81d0925c1a4f2b4d59f227988ce94b042011c2e910f63b20df14366d2956483f1eb11a
7
+ data.tar.gz: 658ec185e823312c7acd8f45d33ef249fed4f0f9125606b11e0d683ab2dc7150bac18a7e4fded01e8dfb40faa04f12c8ce3a42d647a872c43de6c76810d7d3d0
@@ -147,39 +147,25 @@ module Antlr4Native
147
147
  }
148
148
 
149
149
  Array getChildren() {
150
- if (children == nullptr) {
151
- children = new Array();
150
+ Array children;
151
+ if (orig != nullptr) {
152
+ for (auto it = orig -> children.begin(); it != orig -> children.end(); it ++) {
153
+ Object parseTree = ContextProxy::wrapParseTree(*it);
152
154
 
153
- if (orig != nullptr) {
154
- for (auto it = orig -> children.begin(); it != orig -> children.end(); it ++) {
155
- Object parseTree = ContextProxy::wrapParseTree(*it);
156
-
157
- if (parseTree != Nil) {
158
- children -> push(parseTree);
159
- }
155
+ if (parseTree != Nil) {
156
+ children.push(parseTree);
160
157
  }
161
158
  }
162
159
  }
163
-
164
- return *children;
160
+ return children;
165
161
  }
166
162
 
167
163
  Object getParent() {
168
- if (parent == Nil) {
169
- if (orig != nullptr) {
170
- parent = ContextProxy::wrapParseTree(orig -> parent);
171
- }
172
- }
173
-
174
- return parent;
164
+ return orig == nullptr ? Nil : ContextProxy::wrapParseTree(orig -> parent);
175
165
  }
176
166
 
177
167
  size_t childCount() {
178
- if (orig == nullptr) {
179
- return 0;
180
- }
181
-
182
- return getChildren().size();
168
+ return orig == nullptr ? 0 : orig -> children.size();
183
169
  }
184
170
 
185
171
  bool doubleEquals(Object other) {
@@ -196,8 +182,6 @@ module Antlr4Native
196
182
 
197
183
  protected:
198
184
  tree::ParseTree* orig = nullptr;
199
- Array* children = nullptr;
200
- Object parent = Nil;
201
185
  };
202
186
 
203
187
  class TerminalNodeProxy : public ContextProxy {
@@ -361,8 +345,8 @@ module Antlr4Native
361
345
  rb_cParser = define_class_under<ParserProxy>(rb_m#{parser_ns}, "Parser")
362
346
  .define_singleton_function("parse", &ParserProxy::parse)
363
347
  .define_singleton_function("parse_file", &ParserProxy::parseFile)
364
- .define_method("#{parser_root_method}", &ParserProxy::#{parser_root_method})
365
- .define_method("visit", &ParserProxy::visit);
348
+ .define_method("#{parser_root_method}", &ParserProxy::#{parser_root_method}, Return().keepAlive())
349
+ .define_method("visit", &ParserProxy::visit, Return().keepAlive());
366
350
 
367
351
  #{class_wrappers_str(' ')}
368
352
  }
@@ -1,3 +1,3 @@
1
1
  module Antlr4Native
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antlr4-native
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-24 00:00:00.000000000 Z
11
+ date: 2022-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice