antlr4-native 2.2.1 → 2.3.0
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/antlr4-native.gemspec +1 -1
- data/lib/antlr4-native/context.rb +4 -4
- data/lib/antlr4-native/generator.rb +20 -7
- data/lib/antlr4-native/version.rb +1 -1
- metadata +5 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e0ba82bae327f0b02ac099beab9b01d8efef600b21dd1f0bac9438303af8d9fc
|
|
4
|
+
data.tar.gz: f840a00ac13adf1282c77fc2b2376da1b9c986cc32d9affa2232ab0d01c6ae57
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a9aec0e46b565763c2e77c6e7af5108e24b7c348afda4d0073a5f99a52813feeb8204b8a554ed3dc500898aa4bb6a023c5646d5f0965c7d0bb25f2acb831889a
|
|
7
|
+
data.tar.gz: 508ed703bf98e7584c998cbed39b73f788a99cf5b65469b9c82d0adba5467c6bc1bed458ad26bde81dc5d32a73ef755a89a9516c9aa36ee5a550a3516dd30a7f
|
data/antlr4-native.gemspec
CHANGED
|
@@ -56,7 +56,7 @@ module Antlr4Native
|
|
|
56
56
|
class To_Ruby<#{parser_ns}::#{name}*> {
|
|
57
57
|
public:
|
|
58
58
|
VALUE convert(#{parser_ns}::#{name}* const &x) {
|
|
59
|
-
if (!x) return
|
|
59
|
+
if (!x) return Qnil;
|
|
60
60
|
return Data_Object<#{parser_ns}::#{name}>(x, false, #{proxy_class_variable});
|
|
61
61
|
}
|
|
62
62
|
};
|
|
@@ -65,7 +65,7 @@ module Antlr4Native
|
|
|
65
65
|
class To_Ruby<#{name}Proxy*> {
|
|
66
66
|
public:
|
|
67
67
|
VALUE convert(#{name}Proxy* const &x) {
|
|
68
|
-
if (!x) return
|
|
68
|
+
if (!x) return Qnil;
|
|
69
69
|
return Data_Object<#{name}Proxy>(x, false, #{proxy_class_variable});
|
|
70
70
|
}
|
|
71
71
|
};
|
|
@@ -114,11 +114,11 @@ module Antlr4Native
|
|
|
114
114
|
|
|
115
115
|
for (auto child : getChildren()) {
|
|
116
116
|
if (ctx == detail::From_Ruby<ContextProxy>().convert(child.value()).getOriginal()) {
|
|
117
|
-
return child;
|
|
117
|
+
return Rice::Object(child);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
return
|
|
121
|
+
return Qnil;
|
|
122
122
|
}
|
|
123
123
|
END
|
|
124
124
|
end
|
|
@@ -97,7 +97,7 @@ module Antlr4Native
|
|
|
97
97
|
class To_Ruby<Token*> {
|
|
98
98
|
public:
|
|
99
99
|
VALUE convert(Token* const &x) {
|
|
100
|
-
if (!x) return
|
|
100
|
+
if (!x) return Qnil;
|
|
101
101
|
return Data_Object<Token>(x, false, rb_cToken);
|
|
102
102
|
}
|
|
103
103
|
};
|
|
@@ -106,7 +106,7 @@ module Antlr4Native
|
|
|
106
106
|
class To_Ruby<tree::ParseTree*> {
|
|
107
107
|
public:
|
|
108
108
|
VALUE convert(tree::ParseTree* const &x) {
|
|
109
|
-
if (!x) return
|
|
109
|
+
if (!x) return Qnil;
|
|
110
110
|
return Data_Object<tree::ParseTree>(x, false, rb_cParseTree);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
@@ -115,7 +115,7 @@ module Antlr4Native
|
|
|
115
115
|
class To_Ruby<tree::TerminalNode*> {
|
|
116
116
|
public:
|
|
117
117
|
VALUE convert(tree::TerminalNode* const &x) {
|
|
118
|
-
if (!x) return
|
|
118
|
+
if (!x) return Qnil;
|
|
119
119
|
return Data_Object<tree::TerminalNode>(x, false, rb_cTerminalNode);
|
|
120
120
|
}
|
|
121
121
|
};
|
|
@@ -153,7 +153,7 @@ module Antlr4Native
|
|
|
153
153
|
for (auto it = orig -> children.begin(); it != orig -> children.end(); it ++) {
|
|
154
154
|
Object parseTree = ContextProxy::wrapParseTree(*it);
|
|
155
155
|
|
|
156
|
-
if (parseTree
|
|
156
|
+
if (!parseTree.is_nil()) {
|
|
157
157
|
children.push(parseTree);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -162,7 +162,7 @@ module Antlr4Native
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
Object getParent() {
|
|
165
|
-
return orig == nullptr ?
|
|
165
|
+
return orig == nullptr ? Rice::Object(Qnil) : ContextProxy::wrapParseTree(orig -> parent);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
size_t childCount() {
|
|
@@ -300,13 +300,26 @@ module Antlr4Native
|
|
|
300
300
|
};
|
|
301
301
|
|
|
302
302
|
namespace Rice::detail {
|
|
303
|
+
template <>
|
|
304
|
+
struct Type<ParserProxy*> {
|
|
305
|
+
static bool verify() {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
|
|
303
310
|
template <>
|
|
304
311
|
class To_Ruby<ParserProxy*> {
|
|
305
312
|
public:
|
|
313
|
+
To_Ruby() = default;
|
|
314
|
+
|
|
315
|
+
explicit To_Ruby(Arg* arg) : arg_(arg) {}
|
|
316
|
+
|
|
306
317
|
VALUE convert(ParserProxy* const &x) {
|
|
307
|
-
if (!x) return
|
|
318
|
+
if (!x) return Qnil;
|
|
308
319
|
return Data_Object<ParserProxy>(x, false, rb_cParser);
|
|
309
320
|
}
|
|
321
|
+
private:
|
|
322
|
+
Arg* arg_ = nullptr;
|
|
310
323
|
};
|
|
311
324
|
}
|
|
312
325
|
END
|
|
@@ -372,7 +385,7 @@ module Antlr4Native
|
|
|
372
385
|
TerminalNodeProxy proxy(node);
|
|
373
386
|
return detail::To_Ruby<TerminalNodeProxy>().convert(proxy);
|
|
374
387
|
} else {
|
|
375
|
-
return
|
|
388
|
+
return Qnil;
|
|
376
389
|
}
|
|
377
390
|
}
|
|
378
391
|
END
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: antlr4-native
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cameron Dutro
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rice
|
|
@@ -16,14 +15,14 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '4.
|
|
18
|
+
version: '4.11'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - "~>"
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '4.
|
|
25
|
+
version: '4.11'
|
|
27
26
|
description: Create a Ruby native extension from any ANTLR4 grammar.
|
|
28
27
|
email:
|
|
29
28
|
- camertron@gmail.com
|
|
@@ -56,7 +55,6 @@ files:
|
|
|
56
55
|
homepage: http://github.com/camertron/antlr4-native-rb
|
|
57
56
|
licenses: []
|
|
58
57
|
metadata: {}
|
|
59
|
-
post_install_message:
|
|
60
58
|
rdoc_options: []
|
|
61
59
|
require_paths:
|
|
62
60
|
- lib
|
|
@@ -71,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
71
69
|
- !ruby/object:Gem::Version
|
|
72
70
|
version: '0'
|
|
73
71
|
requirements: []
|
|
74
|
-
rubygems_version: 3.
|
|
75
|
-
signing_key:
|
|
72
|
+
rubygems_version: 3.6.7
|
|
76
73
|
specification_version: 4
|
|
77
74
|
summary: Create a Ruby native extension from any ANTLR4 grammar.
|
|
78
75
|
test_files: []
|