antlr4-native 2.0.1 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba388dfab9f2c91aec93eb1ae6ce3da83bff2777a921c14dca055e7c5ef06f82
4
- data.tar.gz: 635a32e158d29328fdb181a636462ec5f73af777ab6c1bff24da13191d735f3b
3
+ metadata.gz: 15c061ecc5402e131b0bb299f653624452168b857a20010f6243e1415d74fe43
4
+ data.tar.gz: c9c1dcbdcb46daedcdfbe219dee93d1f18512fbbeeb26808a5d2acb3281db73c
5
5
  SHA512:
6
- metadata.gz: c019c9f3549d0b0d4f1aae071592a160d3e2fdd2c8a0bab89c24d34d2f81d0925c1a4f2b4d59f227988ce94b042011c2e910f63b20df14366d2956483f1eb11a
7
- data.tar.gz: 658ec185e823312c7acd8f45d33ef249fed4f0f9125606b11e0d683ab2dc7150bac18a7e4fded01e8dfb40faa04f12c8ce3a42d647a872c43de6c76810d7d3d0
6
+ metadata.gz: 0c973edc74b86e8fbf2193832c3555aa1e93a52bc60dc9736752c0be35a18cee3a1dd5d68cb262603467e0586a4eb22c74b38589246eb6d34edba6d4e4fe54c2
7
+ data.tar.gz: e6b89735c4083c6c51b6260f751048aeec4187da2a93d286af7cf2778d490fb5d82a9dff958af7285229f790f3a8e1f537581a5946feda441ebf95e1bd93ffa8
data/README.md CHANGED
@@ -79,9 +79,8 @@ Finally, if you override `#initialize` in your visitor subclasses, don't forget
79
79
 
80
80
  ## Caveats
81
81
 
82
- 1. Avoid retaining references to contexts, tokens, etc anywhere in your Ruby code. Contexts (i.e. the `ctx` variables in the examples above) and other objects that are created by ANTLR's C++ runtime are automatically cleaned up without the Ruby interpreter's knowledge. You'll almost surely see a segfault if you retain a reference to one of these objects and try to use it after the call to `Parser#visit`.
83
- 2. Due to an ANTLR limitation, parsers cannot be used in a multi-threaded environment, even if each parser instance is used entirely in the context of a single thread (i.e. parsers are not shared between threads). According to the ANTLR C++ developers, parsers should be threadsafe. Unfortunately firsthand experience has proven otherwise. Your mileage may vary.
84
- 3. The description of this gem says "(almost) any ANTLR4 grammar" because many grammars contain target-specific code. For example, the Python3 grammar referenced in the examples above contains inline Java code that the C++ compiler won't understand. You'll need to port any such code to C++ before you'll be able to compile and use the native extension.
82
+ 1. Due to an ANTLR limitation, parsers cannot be used in a multi-threaded environment, even if each parser instance is used entirely in the context of a single thread (i.e. parsers are not shared between threads). According to the ANTLR C++ developers, parsers should be threadsafe. Unfortunately firsthand experience has proven otherwise. Your mileage may vary.
83
+ 1. The description of this gem says "(almost) any ANTLR4 grammar" because many grammars contain target-specific code. For example, the Python3 grammar referenced in the examples above contains inline Java code that the C++ compiler won't understand. You'll need to port any such code to C++ before you'll be able to compile and use the native extension.
85
84
 
86
85
  ## System Requirements
87
86
 
@@ -2,10 +2,10 @@ require 'fileutils'
2
2
 
3
3
  module Antlr4Native
4
4
  class Generator
5
- ANTLR_VERSION = '4.8'.freeze
5
+ ANTLR_VERSION = '4.10.1'.freeze
6
6
 
7
7
  ANTLR_JAR = File.expand_path(
8
- File.join('..', '..', 'vendor', 'antlr4-4.8-1-complete.jar'), __dir__
8
+ File.join('..', '..', 'vendor', "antlr-#{ANTLR_VERSION}-complete.jar"), __dir__
9
9
  ).freeze
10
10
 
11
11
  include StringHelpers
@@ -16,6 +16,7 @@ module Antlr4Native
16
16
  @grammar_files = grammar_files
17
17
  @output_dir = output_dir
18
18
  @parser_root_method = parser_root_method
19
+
19
20
  end
20
21
 
21
22
  def generate
@@ -268,7 +269,7 @@ module Antlr4Native
268
269
  this -> lexer -> reset();
269
270
  this -> parser -> reset();
270
271
 
271
- return result;
272
+ return std::any_cast<Object>(result);
272
273
  }
273
274
 
274
275
  ~ParserProxy() {
@@ -1,3 +1,3 @@
1
1
  module Antlr4Native
2
- VERSION = '2.0.1'
2
+ VERSION = '2.1.0'
3
3
  end
@@ -48,7 +48,7 @@ module Antlr4Native
48
48
  Object ruby_visit(ContextProxy* proxy) {
49
49
  auto result = visit(proxy -> getOriginal());
50
50
  try {
51
- return result.as<Object>();
51
+ return std::any_cast<Object>(result);
52
52
  } catch(std::bad_cast) {
53
53
  return Qnil;
54
54
  }
@@ -57,7 +57,7 @@ module Antlr4Native
57
57
  Object ruby_visitChildren(ContextProxy* proxy) {
58
58
  auto result = visitChildren(proxy -> getOriginal());
59
59
  try {
60
- return result.as<Object>();
60
+ return std::any_cast<Object>(result);
61
61
  } catch(std::bad_cast) {
62
62
  return Qnil;
63
63
  }
Binary file
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.1
4
+ version: 2.1.0
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-05-09 00:00:00.000000000 Z
11
+ date: 2022-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice
@@ -43,7 +43,7 @@ files:
43
43
  - lib/antlr4-native/string_helpers.rb
44
44
  - lib/antlr4-native/version.rb
45
45
  - lib/antlr4-native/visitor_generator.rb
46
- - vendor/antlr4-4.8-1-complete.jar
46
+ - vendor/antlr-4.10.1-complete.jar
47
47
  homepage: http://github.com/camertron/antlr4-native-rb
48
48
  licenses: []
49
49
  metadata: {}
Binary file