antlr4-runtime 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/README.md +65 -0
- data/Rakefile +6 -0
- data/antlr4-runtime.gemspec +30 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/rumourhash/Makefile +264 -0
- data/ext/rumourhash/extconf.rb +3 -0
- data/ext/rumourhash/rumourhash.c +59 -0
- data/lib/antlr4/runtime.rb +37 -0
- data/lib/antlr4/runtime/abstract_parse_tree_visitor.rb +43 -0
- data/lib/antlr4/runtime/abstract_predicate_transition.rb +11 -0
- data/lib/antlr4/runtime/action_transition.rb +29 -0
- data/lib/antlr4/runtime/ambiguity_info.rb +10 -0
- data/lib/antlr4/runtime/antlr_error_listener.rb +15 -0
- data/lib/antlr4/runtime/antlr_error_strategy.rb +24 -0
- data/lib/antlr4/runtime/antlr_file_stream.rb +17 -0
- data/lib/antlr4/runtime/antlr_input_stream.rb +6 -0
- data/lib/antlr4/runtime/array_2d_hash_set.rb +471 -0
- data/lib/antlr4/runtime/array_prediction_context.rb +76 -0
- data/lib/antlr4/runtime/atn.rb +100 -0
- data/lib/antlr4/runtime/atn_config.rb +140 -0
- data/lib/antlr4/runtime/atn_config_set.rb +150 -0
- data/lib/antlr4/runtime/atn_deserialization_options.rb +48 -0
- data/lib/antlr4/runtime/atn_deserializer.rb +737 -0
- data/lib/antlr4/runtime/atn_simulator.rb +69 -0
- data/lib/antlr4/runtime/atn_state.rb +118 -0
- data/lib/antlr4/runtime/atn_type.rb +8 -0
- data/lib/antlr4/runtime/atom_transition.rb +27 -0
- data/lib/antlr4/runtime/bail_error_strategy.rb +31 -0
- data/lib/antlr4/runtime/base_error_listener.rb +18 -0
- data/lib/antlr4/runtime/basic_block_start_state.rb +12 -0
- data/lib/antlr4/runtime/basic_state.rb +11 -0
- data/lib/antlr4/runtime/bit_set.rb +54 -0
- data/lib/antlr4/runtime/block_end_state.rb +15 -0
- data/lib/antlr4/runtime/block_start_state.rb +12 -0
- data/lib/antlr4/runtime/buffered_token_stream.rb +335 -0
- data/lib/antlr4/runtime/char_stream.rb +6 -0
- data/lib/antlr4/runtime/char_streams.rb +12 -0
- data/lib/antlr4/runtime/chunk.rb +4 -0
- data/lib/antlr4/runtime/code_point_char_stream.rb +83 -0
- data/lib/antlr4/runtime/common_token.rb +125 -0
- data/lib/antlr4/runtime/common_token_factory.rb +30 -0
- data/lib/antlr4/runtime/common_token_stream.rb +63 -0
- data/lib/antlr4/runtime/console_error_listener.rb +12 -0
- data/lib/antlr4/runtime/context_sensitivity_info.rb +7 -0
- data/lib/antlr4/runtime/decision_event_info.rb +19 -0
- data/lib/antlr4/runtime/decision_info.rb +36 -0
- data/lib/antlr4/runtime/decision_state.rb +15 -0
- data/lib/antlr4/runtime/default_error_strategy.rb +314 -0
- data/lib/antlr4/runtime/dfa.rb +97 -0
- data/lib/antlr4/runtime/dfa_serializer.rb +62 -0
- data/lib/antlr4/runtime/dfa_state.rb +109 -0
- data/lib/antlr4/runtime/diagnostic_error_listener.rb +58 -0
- data/lib/antlr4/runtime/double_key_map.rb +49 -0
- data/lib/antlr4/runtime/empty_prediction_context.rb +35 -0
- data/lib/antlr4/runtime/epsilon_transition.rb +27 -0
- data/lib/antlr4/runtime/equality_comparator.rb +4 -0
- data/lib/antlr4/runtime/error_info.rb +7 -0
- data/lib/antlr4/runtime/error_node.rb +5 -0
- data/lib/antlr4/runtime/error_node_impl.rb +12 -0
- data/lib/antlr4/runtime/failed_predicate_exception.rb +33 -0
- data/lib/antlr4/runtime/flexible_hash_map.rb +232 -0
- data/lib/antlr4/runtime/input_mismatch_exception.rb +20 -0
- data/lib/antlr4/runtime/int_stream.rb +31 -0
- data/lib/antlr4/runtime/integer.rb +14 -0
- data/lib/antlr4/runtime/interval.rb +111 -0
- data/lib/antlr4/runtime/interval_set.rb +540 -0
- data/lib/antlr4/runtime/lexer.rb +257 -0
- data/lib/antlr4/runtime/lexer_action.rb +12 -0
- data/lib/antlr4/runtime/lexer_action_executor.rb +75 -0
- data/lib/antlr4/runtime/lexer_action_type.rb +12 -0
- data/lib/antlr4/runtime/lexer_atn_config.rb +50 -0
- data/lib/antlr4/runtime/lexer_atn_simulator.rb +522 -0
- data/lib/antlr4/runtime/lexer_channel_action.rb +51 -0
- data/lib/antlr4/runtime/lexer_custom_action.rb +49 -0
- data/lib/antlr4/runtime/lexer_dfa_serializer.rb +12 -0
- data/lib/antlr4/runtime/lexer_indexed_custom_action.rb +49 -0
- data/lib/antlr4/runtime/lexer_mode_action.rb +51 -0
- data/lib/antlr4/runtime/lexer_more_action.rb +41 -0
- data/lib/antlr4/runtime/lexer_no_viable_alt_exception.rb +4 -0
- data/lib/antlr4/runtime/lexer_pop_mode_action.rb +41 -0
- data/lib/antlr4/runtime/lexer_push_mode_action.rb +51 -0
- data/lib/antlr4/runtime/lexer_skip_action.rb +43 -0
- data/lib/antlr4/runtime/lexer_type_action.rb +51 -0
- data/lib/antlr4/runtime/ll1_analyzer.rb +133 -0
- data/lib/antlr4/runtime/lookahead_event_info.rb +10 -0
- data/lib/antlr4/runtime/loop_end_state.rb +15 -0
- data/lib/antlr4/runtime/murmur_hash.rb +99 -0
- data/lib/antlr4/runtime/no_viable_alt_exception.rb +7 -0
- data/lib/antlr4/runtime/not_set_transition.rb +20 -0
- data/lib/antlr4/runtime/object_equality_comparator.rb +18 -0
- data/lib/antlr4/runtime/ordered_atn_config_set.rb +15 -0
- data/lib/antlr4/runtime/parse_cancellation_exception.rb +5 -0
- data/lib/antlr4/runtime/parse_tree.rb +7 -0
- data/lib/antlr4/runtime/parse_tree_listener.rb +4 -0
- data/lib/antlr4/runtime/parse_tree_visitor.rb +4 -0
- data/lib/antlr4/runtime/parser.rb +522 -0
- data/lib/antlr4/runtime/parser_atn_simulator.rb +1171 -0
- data/lib/antlr4/runtime/parser_rule_context.rb +186 -0
- data/lib/antlr4/runtime/plus_block_start_state.rb +11 -0
- data/lib/antlr4/runtime/plus_loopback_state.rb +12 -0
- data/lib/antlr4/runtime/precedence_predicate_transition.rb +31 -0
- data/lib/antlr4/runtime/predicate.rb +6 -0
- data/lib/antlr4/runtime/predicate_eval_info.rb +16 -0
- data/lib/antlr4/runtime/predicate_transition.rb +35 -0
- data/lib/antlr4/runtime/prediction_context.rb +103 -0
- data/lib/antlr4/runtime/prediction_context_cache.rb +28 -0
- data/lib/antlr4/runtime/prediction_context_utils.rb +407 -0
- data/lib/antlr4/runtime/prediction_mode.rb +213 -0
- data/lib/antlr4/runtime/profiling_atn_simulator.rb +149 -0
- data/lib/antlr4/runtime/proxy_error_listener.rb +33 -0
- data/lib/antlr4/runtime/range_transition.rb +29 -0
- data/lib/antlr4/runtime/recognition_exception.rb +17 -0
- data/lib/antlr4/runtime/recognizer.rb +136 -0
- data/lib/antlr4/runtime/rule_context.rb +131 -0
- data/lib/antlr4/runtime/rule_context_with_alt_num.rb +11 -0
- data/lib/antlr4/runtime/rule_node.rb +8 -0
- data/lib/antlr4/runtime/rule_start_state.rb +17 -0
- data/lib/antlr4/runtime/rule_stop_state.rb +12 -0
- data/lib/antlr4/runtime/rule_tag_token.rb +64 -0
- data/lib/antlr4/runtime/rule_transition.rb +29 -0
- data/lib/antlr4/runtime/semantic_context.rb +313 -0
- data/lib/antlr4/runtime/set_transition.rb +29 -0
- data/lib/antlr4/runtime/singleton_prediction_context.rb +56 -0
- data/lib/antlr4/runtime/star_block_start_state.rb +12 -0
- data/lib/antlr4/runtime/star_loop_entry_state.rb +17 -0
- data/lib/antlr4/runtime/star_loopback_state.rb +16 -0
- data/lib/antlr4/runtime/syntax_tree.rb +6 -0
- data/lib/antlr4/runtime/tag_chunk.rb +22 -0
- data/lib/antlr4/runtime/terminal_node.rb +5 -0
- data/lib/antlr4/runtime/terminal_node_impl.rb +50 -0
- data/lib/antlr4/runtime/text_chunk.rb +16 -0
- data/lib/antlr4/runtime/token.rb +13 -0
- data/lib/antlr4/runtime/token_stream.rb +13 -0
- data/lib/antlr4/runtime/token_tag_token.rb +22 -0
- data/lib/antlr4/runtime/tokens_start_state.rb +14 -0
- data/lib/antlr4/runtime/transition.rb +51 -0
- data/lib/antlr4/runtime/tree.rb +4 -0
- data/lib/antlr4/runtime/trees.rb +195 -0
- data/lib/antlr4/runtime/triple.rb +40 -0
- data/lib/antlr4/runtime/utils.rb +117 -0
- data/lib/antlr4/runtime/uuid.rb +46 -0
- data/lib/antlr4/runtime/version.rb +5 -0
- data/lib/antlr4/runtime/vocabulary.rb +12 -0
- data/lib/antlr4/runtime/vocabulary_impl.rb +82 -0
- data/lib/antlr4/runtime/wildcard_transition.rb +20 -0
- data/lib/antlr4/runtime/writable_token.rb +7 -0
- metadata +243 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a03191431e6a6af1722e62768fce62dd24efd4fc2d01f6b42770eea00bb3bdb
|
4
|
+
data.tar.gz: ae5d2ac9cbc8d52a318d5356ea57c3cdfe3c9cc581051ad4da889d84cb106ce3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 59f76c79be742eb8bf80106080810b52c07cffac4a2664dfa92d6ebecc402478e5763cadb257f5f3ef9e39febc52d39119fa4c982f48c671881b654354d9ae0b
|
7
|
+
data.tar.gz: 8666a5d04f86cf9402b8042b4099969391201eb0587fead324035c41eb7d34457bf7d53891908450425b277a97e53d09f2fd6022315437060dda796c99f3df4c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at tony@aosd.co.uk. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
antlr4-runtime (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (10.5.0)
|
11
|
+
rspec (3.8.0)
|
12
|
+
rspec-core (~> 3.8.0)
|
13
|
+
rspec-expectations (~> 3.8.0)
|
14
|
+
rspec-mocks (~> 3.8.0)
|
15
|
+
rspec-core (3.8.0)
|
16
|
+
rspec-support (~> 3.8.0)
|
17
|
+
rspec-expectations (3.8.3)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.8.0)
|
20
|
+
rspec-mocks (3.8.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.8.0)
|
23
|
+
rspec-support (3.8.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
antlr4-runtime!
|
30
|
+
bundler (~> 2.0)
|
31
|
+
rake (~> 10.0)
|
32
|
+
rspec (~> 3.0)
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
2.0.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Tony Walmsley
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Antlr4::Runtime
|
2
|
+
|
3
|
+
This gem adds support for the ANTLR4 runtime for Ruby lexers and parsers generated from the Ruby langauge
|
4
|
+
target available at https://github.com/twalmsley/antlr4/tree/ruby_dev
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'antlr4-runtime'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or clone the repository and build and install it yourself as:
|
18
|
+
|
19
|
+
$ rake install
|
20
|
+
|
21
|
+
or if that fails:
|
22
|
+
|
23
|
+
$ sudo rake install
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'modl/parser/MODLParserListener'
|
29
|
+
require 'modl/parser/MODLParserVisitor'
|
30
|
+
require 'modl/parser/MODLLexer'
|
31
|
+
require 'modl/parser/MODLParser'
|
32
|
+
require 'modl/parser/Parser'
|
33
|
+
require 'modl/parser/class_processor'
|
34
|
+
require 'json'
|
35
|
+
|
36
|
+
module Modl::Parser
|
37
|
+
class Interpreter
|
38
|
+
def self.interpret(str)
|
39
|
+
parsed = Modl::Parser::Parser.parse str
|
40
|
+
interpreted = parsed.extract_json
|
41
|
+
ClassProcessor.instance.process(parsed.global, interpreted)
|
42
|
+
return interpreted if interpreted.is_a? String
|
43
|
+
JSON.generate interpreted
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
## Development
|
50
|
+
|
51
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
52
|
+
|
53
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/MODLanguage/antlr4-ruby-runtime. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
58
|
+
|
59
|
+
## License
|
60
|
+
|
61
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
62
|
+
|
63
|
+
## Code of Conduct
|
64
|
+
|
65
|
+
Everyone interacting in the Antlr4::Runtime project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/antlr4-runtime/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "antlr4/runtime/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "antlr4-runtime"
|
8
|
+
spec.version = Antlr4::Runtime::VERSION
|
9
|
+
spec.authors = ["Tony Walmsley"]
|
10
|
+
spec.email = ["tony@aosd.co.uk"]
|
11
|
+
|
12
|
+
spec.summary = %q{ANTLR4 Runtime for Ruby language target lexers and parsers.}
|
13
|
+
spec.description = %q{This gem implements a runtime for ANTLR4 in Ruby for lexers and parsers generated using the Ruby language target.}
|
14
|
+
spec.homepage = "https://github.com/MODLanguage/antlr4-ruby-runtime"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib", "ext"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
spec.extensions = %w[ext/rumourhash/extconf.rb]
|
30
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "antlr4/runtime"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,264 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
+
V = 0
|
6
|
+
Q1 = $(V:1=)
|
7
|
+
Q = $(Q1:0=@)
|
8
|
+
ECHO1 = $(V:1=@ :)
|
9
|
+
ECHO = $(ECHO1:0=@ echo)
|
10
|
+
NULLCMD = :
|
11
|
+
|
12
|
+
#### Start of system configuration section. ####
|
13
|
+
|
14
|
+
srcdir = .
|
15
|
+
topdir = /Users/tonywalmsley/.rvm/rubies/ruby-2.5.3/include/ruby-2.5.0
|
16
|
+
hdrdir = $(topdir)
|
17
|
+
arch_hdrdir = /Users/tonywalmsley/.rvm/rubies/ruby-2.5.3/include/ruby-2.5.0/x86_64-darwin18
|
18
|
+
PATH_SEPARATOR = :
|
19
|
+
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
20
|
+
prefix = $(DESTDIR)/Users/tonywalmsley/.rvm/rubies/ruby-2.5.3
|
21
|
+
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
22
|
+
rubyarchprefix = $(rubylibprefix)/$(arch)
|
23
|
+
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
24
|
+
exec_prefix = $(prefix)
|
25
|
+
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
26
|
+
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
27
|
+
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
28
|
+
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
29
|
+
sitehdrdir = $(rubyhdrdir)/site_ruby
|
30
|
+
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
31
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
32
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
33
|
+
vendordir = $(rubylibprefix)/vendor_ruby
|
34
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
35
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
36
|
+
sitedir = $(rubylibprefix)/site_ruby
|
37
|
+
rubyarchdir = $(rubylibdir)/$(arch)
|
38
|
+
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
39
|
+
sitearchincludedir = $(includedir)/$(sitearch)
|
40
|
+
archincludedir = $(includedir)/$(arch)
|
41
|
+
sitearchlibdir = $(libdir)/$(sitearch)
|
42
|
+
archlibdir = $(libdir)/$(arch)
|
43
|
+
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
44
|
+
mandir = $(datarootdir)/man
|
45
|
+
localedir = $(datarootdir)/locale
|
46
|
+
libdir = $(exec_prefix)/lib
|
47
|
+
psdir = $(docdir)
|
48
|
+
pdfdir = $(docdir)
|
49
|
+
dvidir = $(docdir)
|
50
|
+
htmldir = $(docdir)
|
51
|
+
infodir = $(datarootdir)/info
|
52
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
53
|
+
oldincludedir = $(SDKROOT)/usr/include
|
54
|
+
includedir = $(prefix)/include
|
55
|
+
localstatedir = $(prefix)/var
|
56
|
+
sharedstatedir = $(prefix)/com
|
57
|
+
sysconfdir = $(prefix)/etc
|
58
|
+
datadir = $(datarootdir)
|
59
|
+
datarootdir = $(prefix)/share
|
60
|
+
libexecdir = $(exec_prefix)/libexec
|
61
|
+
sbindir = $(exec_prefix)/sbin
|
62
|
+
bindir = $(exec_prefix)/bin
|
63
|
+
archdir = $(rubyarchdir)
|
64
|
+
|
65
|
+
|
66
|
+
CC = gcc
|
67
|
+
CXX = g++
|
68
|
+
LIBRUBY = $(LIBRUBY_SO)
|
69
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
70
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
71
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework Foundation
|
72
|
+
empty =
|
73
|
+
OUTFLAG = -o $(empty)
|
74
|
+
COUTFLAG = -o $(empty)
|
75
|
+
CSRCFLAG = $(empty)
|
76
|
+
|
77
|
+
RUBY_EXTCONF_H =
|
78
|
+
cflags = $(optflags) $(debugflags) $(warnflags)
|
79
|
+
cxxflags = $(optflags) $(debugflags) $(warnflags)
|
80
|
+
optflags = -O3
|
81
|
+
debugflags = -ggdb3
|
82
|
+
warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens
|
83
|
+
CCDLFLAGS = -fno-common
|
84
|
+
CFLAGS = $(CCDLFLAGS) $(cflags) -fno-common -pipe $(ARCH_FLAG)
|
85
|
+
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
86
|
+
DEFS =
|
87
|
+
CPPFLAGS = -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
88
|
+
CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
|
89
|
+
ldflags = -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib
|
90
|
+
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib
|
91
|
+
ARCH_FLAG =
|
92
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
93
|
+
LDSHARED = $(CC) -dynamic -bundle
|
94
|
+
LDSHAREDXX = $(CXX) -dynamic -bundle
|
95
|
+
AR = libtool -static
|
96
|
+
EXEEXT =
|
97
|
+
|
98
|
+
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
99
|
+
RUBY_SO_NAME = ruby.2.5.3
|
100
|
+
RUBYW_INSTALL_NAME =
|
101
|
+
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
102
|
+
RUBYW_BASE_NAME = rubyw
|
103
|
+
RUBY_BASE_NAME = ruby
|
104
|
+
|
105
|
+
arch = x86_64-darwin18
|
106
|
+
sitearch = $(arch)
|
107
|
+
ruby_version = 2.5.0
|
108
|
+
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
109
|
+
RUBY = $(ruby)
|
110
|
+
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
111
|
+
|
112
|
+
RM = rm -f
|
113
|
+
RM_RF = $(RUBY) -run -e rm -- -rf
|
114
|
+
RMDIRS = rmdir -p
|
115
|
+
MAKEDIRS = /usr/local/opt/coreutils/bin/gmkdir -p
|
116
|
+
INSTALL = /usr/local/opt/coreutils/bin/ginstall -c
|
117
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
118
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
119
|
+
COPY = cp
|
120
|
+
TOUCH = exit >
|
121
|
+
|
122
|
+
#### End of system configuration section. ####
|
123
|
+
|
124
|
+
preload =
|
125
|
+
libpath = . $(libdir) /usr/local/opt/libyaml/lib /usr/local/opt/readline/lib /usr/local/opt/libksba/lib /usr/local/opt/openssl@1.1/lib
|
126
|
+
LIBPATH = -L. -L$(libdir) -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib
|
127
|
+
DEFFILE =
|
128
|
+
|
129
|
+
CLEANFILES = mkmf.log
|
130
|
+
DISTCLEANFILES =
|
131
|
+
DISTCLEANDIRS =
|
132
|
+
|
133
|
+
extout =
|
134
|
+
extout_prefix =
|
135
|
+
target_prefix =
|
136
|
+
LOCAL_LIBS =
|
137
|
+
LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
|
138
|
+
ORIG_SRCS = rumourhash.c
|
139
|
+
SRCS = $(ORIG_SRCS)
|
140
|
+
OBJS = rumourhash.o
|
141
|
+
HDRS =
|
142
|
+
LOCAL_HDRS =
|
143
|
+
TARGET = rumourhash
|
144
|
+
TARGET_NAME = rumourhash
|
145
|
+
TARGET_ENTRY = Init_$(TARGET_NAME)
|
146
|
+
DLLIB = $(TARGET).bundle
|
147
|
+
EXTSTATIC =
|
148
|
+
STATIC_LIB =
|
149
|
+
|
150
|
+
TIMESTAMP_DIR = .
|
151
|
+
BINDIR = $(bindir)
|
152
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
153
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
154
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
155
|
+
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
156
|
+
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
157
|
+
TARGET_SO_DIR =
|
158
|
+
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
159
|
+
CLEANLIBS = $(TARGET_SO)
|
160
|
+
CLEANOBJS = *.o *.bak
|
161
|
+
|
162
|
+
all: $(DLLIB)
|
163
|
+
static: $(STATIC_LIB)
|
164
|
+
.PHONY: all install static install-so install-rb
|
165
|
+
.PHONY: clean clean-so clean-static clean-rb
|
166
|
+
|
167
|
+
clean-static::
|
168
|
+
clean-rb-default::
|
169
|
+
clean-rb::
|
170
|
+
clean-so::
|
171
|
+
clean: clean-so clean-static clean-rb-default clean-rb
|
172
|
+
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
173
|
+
|
174
|
+
distclean-rb-default::
|
175
|
+
distclean-rb::
|
176
|
+
distclean-so::
|
177
|
+
distclean-static::
|
178
|
+
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
179
|
+
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
180
|
+
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
181
|
+
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
182
|
+
|
183
|
+
realclean: distclean
|
184
|
+
install: install-so install-rb
|
185
|
+
|
186
|
+
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
|
187
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
188
|
+
clean-static::
|
189
|
+
-$(Q)$(RM) $(STATIC_LIB)
|
190
|
+
install-rb: pre-install-rb do-install-rb install-rb-default
|
191
|
+
install-rb-default: pre-install-rb-default do-install-rb-default
|
192
|
+
pre-install-rb: Makefile
|
193
|
+
pre-install-rb-default: Makefile
|
194
|
+
do-install-rb:
|
195
|
+
do-install-rb-default:
|
196
|
+
pre-install-rb-default:
|
197
|
+
@$(NULLCMD)
|
198
|
+
$(TIMESTAMP_DIR)/.sitearchdir.time:
|
199
|
+
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
200
|
+
$(Q) $(TOUCH) $@
|
201
|
+
|
202
|
+
site-install: site-install-so site-install-rb
|
203
|
+
site-install-so: install-so
|
204
|
+
site-install-rb: install-rb
|
205
|
+
|
206
|
+
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
207
|
+
|
208
|
+
.cc.o:
|
209
|
+
$(ECHO) compiling $(<)
|
210
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
211
|
+
|
212
|
+
.cc.S:
|
213
|
+
$(ECHO) translating $(<)
|
214
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
215
|
+
|
216
|
+
.mm.o:
|
217
|
+
$(ECHO) compiling $(<)
|
218
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
219
|
+
|
220
|
+
.mm.S:
|
221
|
+
$(ECHO) translating $(<)
|
222
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
223
|
+
|
224
|
+
.cxx.o:
|
225
|
+
$(ECHO) compiling $(<)
|
226
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
227
|
+
|
228
|
+
.cxx.S:
|
229
|
+
$(ECHO) translating $(<)
|
230
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
231
|
+
|
232
|
+
.cpp.o:
|
233
|
+
$(ECHO) compiling $(<)
|
234
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
235
|
+
|
236
|
+
.cpp.S:
|
237
|
+
$(ECHO) translating $(<)
|
238
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
239
|
+
|
240
|
+
.c.o:
|
241
|
+
$(ECHO) compiling $(<)
|
242
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
243
|
+
|
244
|
+
.c.S:
|
245
|
+
$(ECHO) translating $(<)
|
246
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
247
|
+
|
248
|
+
.m.o:
|
249
|
+
$(ECHO) compiling $(<)
|
250
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
251
|
+
|
252
|
+
.m.S:
|
253
|
+
$(ECHO) translating $(<)
|
254
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
255
|
+
|
256
|
+
$(TARGET_SO): $(OBJS) Makefile
|
257
|
+
$(ECHO) linking shared-object $(DLLIB)
|
258
|
+
-$(Q)$(RM) $(@)
|
259
|
+
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
260
|
+
$(Q) $(POSTLINK)
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
$(OBJS): $(HDRS) $(ruby_headers)
|