bel 0.3.2-x64-mingw32 → 0.3.3-x64-mingw32
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/CHANGELOG.md +39 -0
- data/README.md +1 -1
- data/bel.gemspec +4 -4
- data/ext/mri/extconf.rb +20 -6
- data/lib/bel.rb +4 -3
- data/lib/bel/libbel.rb +141 -177
- data/lib/bel/libbel/bel_ast_structs.rb +150 -148
- data/lib/bel/libbel/bel_token.rb +29 -27
- data/lib/bel/libbel/bel_token_list.rb +28 -26
- data/lib/bel/{2.0 → libbel/ext/2.0}/libbel.so +0 -0
- data/lib/bel/{2.1 → libbel/ext/2.1}/libbel.so +0 -0
- data/lib/bel/{2.2 → libbel/ext/2.2}/libbel.so +0 -0
- data/lib/bel/libbel/ext/java/darwin/x86_64/libbel.bundle +0 -0
- data/lib/bel/libbel/ext/java/linux/x86_64/libbel.so +0 -0
- data/lib/bel/libbel/ext/java/mswin/i686/2.0/libbel.so +0 -0
- data/lib/bel/libbel/ext/java/mswin/i686/2.1/libbel.so +0 -0
- data/lib/bel/libbel/ext/java/mswin/i686/2.2/libbel.so +0 -0
- data/lib/bel/libbel/ext/java/mswin/x86_64/2.0/libbel.so +0 -0
- data/lib/bel/libbel/ext/java/mswin/x86_64/2.1/libbel.so +0 -0
- data/lib/bel/libbel/ext/java/mswin/x86_64/2.2/libbel.so +0 -0
- data/lib/bel/libbel/ext/mingw/i686/2.0/libbel.so +0 -0
- data/lib/bel/libbel/ext/mingw/i686/2.1/libbel.so +0 -0
- data/lib/bel/libbel/ext/mingw/i686/2.2/libbel.so +0 -0
- data/lib/bel/libbel/ext/mingw/x86_64/2.0/libbel.so +0 -0
- data/lib/bel/libbel/ext/mingw/x86_64/2.1/libbel.so +0 -0
- data/lib/bel/libbel/ext/mingw/x86_64/2.2/libbel.so +0 -0
- data/lib/bel/libbel/library_load_error.rb +30 -0
- data/lib/bel/libbel/library_resolver.rb +103 -0
- data/lib/bel/libbel/node_test.rb +29 -27
- data/lib/bel/libbel/node_transformation.rb +24 -22
- data/lib/bel/libbel/node_traversal.rb +79 -77
- data/lib/bel/libbel/platform_support_error.rb +23 -0
- data/lib/bel/version.rb +1 -1
- metadata +23 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6289572fa7b3143e26f810a1eafb1c0aba04d6ce
|
4
|
+
data.tar.gz: e23d121d97eb104122798b2d8d9cf7ca6e5aa5bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0ac2c4745eef30fbf1758d72a867d4ba439c1237c660e612ccaee9921ced7493dba6ec50872817bf7294b955ed13e2c1268d3e1b8b23642006a6fbedf41b3cb
|
7
|
+
data.tar.gz: a45322766823b1e3c57bca6322b1ad8fcb840a910682f52e19282719c8061981ab863357071fe174089392f6f64550c88e0420f32d11d73973ff21772a7e1e2c
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to bel.rb will be documented in this file. The curated log begins at changes to version 0.3.2.
|
3
|
+
|
4
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
|
+
|
6
|
+
## [0.3.3][0.3.3] - 2015-08-07
|
7
|
+
### Fixed
|
8
|
+
- ResourceIndex integration test causes intermittent timeouts ([Issue #61][61]).
|
9
|
+
- Support running on JRuby, including libbel native library ([Issue #68][68]).
|
10
|
+
|
11
|
+
## [0.3.2][0.3.2] - 2015-07-31
|
12
|
+
### Fixed
|
13
|
+
- Allow whitespace (space/tab) within blank lines ([Issue #13][13]).
|
14
|
+
- Parse CRLF line terminators (i.e. Windows) when parsing BEL Script ([Issue #21][21]).
|
15
|
+
- Allow whitespace before BEL Script records ([Issue #25][25]).
|
16
|
+
- Support RDF conversion of unicode string literals ([Issue #40][40]).
|
17
|
+
- Support translation from and to RDF ([Issue #51][51]).
|
18
|
+
- (Regression) Unable to parse BEL files on Windows ([Issue #59][59]).
|
19
|
+
- RDF "hasConcept" property triple is missing namespace ([Issue #64][64]).
|
20
|
+
|
21
|
+
### Changed
|
22
|
+
- Updates defined namespaces to reflect the [20150611][20150611] resources.
|
23
|
+
- Full support for all BEL functions and relationships during RDF conversion.
|
24
|
+
|
25
|
+
### Added
|
26
|
+
- Development gem dependencies (i.e. byebug, pry, pry-byebug) for debugging.
|
27
|
+
|
28
|
+
[0.3.2]: https://github.com/OpenBEL/bel.rb/compare/0.3.1...0.3.2
|
29
|
+
[0.3.3]: https://github.com/OpenBEL/bel.rb/compare/0.3.2...0.3.3
|
30
|
+
[13]: https://github.com/OpenBEL/bel.rb/issues/13
|
31
|
+
[21]: https://github.com/OpenBEL/bel.rb/issues/21
|
32
|
+
[25]: https://github.com/OpenBEL/bel.rb/issues/25
|
33
|
+
[40]: https://github.com/OpenBEL/bel.rb/issues/40
|
34
|
+
[51]: https://github.com/OpenBEL/bel.rb/issues/51
|
35
|
+
[59]: https://github.com/OpenBEL/bel.rb/issues/59
|
36
|
+
[61]: https://github.com/OpenBEL/bel.rb/issues/61
|
37
|
+
[64]: https://github.com/OpenBEL/bel.rb/issues/64
|
38
|
+
[68]: https://github.com/OpenBEL/bel.rb/issues/68
|
39
|
+
[20150611]: http://resource.belframework.org/belframework/20150611/
|
data/README.md
CHANGED
data/bel.gemspec
CHANGED
@@ -25,9 +25,11 @@ Gem::Specification.new do |spec|
|
|
25
25
|
'whayes@selventa.com'
|
26
26
|
]
|
27
27
|
spec.files = [
|
28
|
-
Dir.glob(
|
29
|
-
Dir.glob(
|
28
|
+
Dir.glob('lib/**/*.rb'),
|
29
|
+
Dir.glob('ext/**/*.{c,h,def}'),
|
30
|
+
Dir.glob('lib/bel/libbel/ext/{java,mingw}/**/*.{so,bundle}'),
|
30
31
|
__FILE__,
|
32
|
+
'CHANGELOG.md',
|
31
33
|
'LICENSE',
|
32
34
|
'INSTALL.md',
|
33
35
|
'INSTALL_RUBY.md',
|
@@ -63,9 +65,7 @@ Gem::Specification.new do |spec|
|
|
63
65
|
spec.add_development_dependency 'uuid', '~> 2.3'
|
64
66
|
|
65
67
|
# development gems
|
66
|
-
spec.add_development_dependency 'byebug', '~> 5.0'
|
67
68
|
spec.add_development_dependency 'minitest', '~> 5.7'
|
68
|
-
spec.add_development_dependency 'pry-byebug', '~> 3.2'
|
69
69
|
spec.add_development_dependency 'rake', '~> 10.4'
|
70
70
|
spec.add_development_dependency 'rake-compiler', '~> 0.9'
|
71
71
|
spec.add_development_dependency 'rdoc', '~> 4.2'
|
data/ext/mri/extconf.rb
CHANGED
@@ -1,8 +1,22 @@
|
|
1
|
-
|
1
|
+
if RUBY_PLATFORM =~ /java/i
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
|
3
|
+
# Don't do anything when run in JRuby; this allows gem installation to pass.
|
4
|
+
# We need to write a dummy Makefile so that RubyGems doesn't think compilation
|
5
|
+
# failed.
|
6
|
+
File.open('Makefile', 'w') do |f|
|
7
|
+
f.puts "all:"
|
8
|
+
f.puts "\t@true"
|
9
|
+
f.puts "install:"
|
10
|
+
f.puts "\t@true"
|
11
|
+
end
|
12
|
+
exit 0
|
13
|
+
else
|
7
14
|
|
8
|
-
|
15
|
+
require 'mkmf'
|
16
|
+
# if set in environment, set compiler for make
|
17
|
+
# example:
|
18
|
+
# CC=gcc-4.8 gem install bel.rb
|
19
|
+
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
|
20
|
+
|
21
|
+
create_makefile('bel/libbel/ext/libbel')
|
22
|
+
end
|
data/lib/bel.rb
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
require_relative 'bel/version'
|
2
|
-
require_relative 'bel/libbel.rb'
|
3
|
-
require_relative 'bel/parser'
|
4
|
-
require_relative 'bel/completion'
|
5
2
|
require_relative 'bel/language'
|
6
3
|
require_relative 'bel/namespace'
|
7
4
|
require_relative 'bel/util'
|
@@ -13,6 +10,10 @@ require_relative 'bel/format'
|
|
13
10
|
|
14
11
|
require_relative 'bel/script'
|
15
12
|
|
13
|
+
require_relative 'bel/libbel.rb'
|
14
|
+
require_relative 'bel/parser'
|
15
|
+
require_relative 'bel/completion'
|
16
|
+
|
16
17
|
include BEL::Language
|
17
18
|
include BEL::Namespace
|
18
19
|
|
data/lib/bel/libbel.rb
CHANGED
@@ -1,200 +1,164 @@
|
|
1
|
-
|
1
|
+
require_relative 'libbel/library_load_error'
|
2
|
+
require_relative 'libbel/library_resolver'
|
2
3
|
|
3
|
-
|
4
|
+
module BEL
|
5
|
+
module LibBEL
|
4
6
|
|
5
|
-
|
6
|
-
defined?(RUBY_ENGINE) && ("rbx" == RUBY_ENGINE)
|
7
|
-
end
|
7
|
+
extend LibraryResolver
|
8
8
|
|
9
|
-
|
10
|
-
# Determines the correct extension path for your ruby version
|
11
|
-
def extension_path(ruby_version = RUBY_VERSION)
|
12
|
-
version =
|
13
|
-
case ruby_version
|
14
|
-
when /^2\.0/
|
15
|
-
'2.0'
|
16
|
-
when /^2\.1/
|
17
|
-
'2.1'
|
18
|
-
when /^2\.2/
|
19
|
-
'2.2'
|
20
|
-
else
|
21
|
-
fail RuntimeError.new("Do not support Ruby #{RUBY_VERSION}.")
|
22
|
-
end
|
9
|
+
class << self
|
23
10
|
|
24
|
-
|
25
|
-
|
11
|
+
def rubinius?
|
12
|
+
defined?(RUBY_ENGINE) && ("rbx" == RUBY_ENGINE)
|
13
|
+
end
|
26
14
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
15
|
+
# @api_private
|
16
|
+
# Determine FFI constant for this ruby engine.
|
17
|
+
def find_ffi
|
18
|
+
if rubinius?
|
19
|
+
# Use ffi gem instead of rubinius-bundled FFI
|
20
|
+
# Rubinius 2.5.2 does not seem to support FFI::ManagedStruct
|
21
|
+
require "ffi"
|
22
|
+
::FFI
|
23
|
+
else # mri, jruby, etc
|
24
|
+
require "ffi"
|
25
|
+
::FFI
|
26
|
+
end
|
38
27
|
end
|
39
|
-
end
|
40
28
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
29
|
+
# @api_private
|
30
|
+
# Extend with the correct ffi implementation.
|
31
|
+
def load_ffi
|
32
|
+
ffi_module = BEL::LibBEL::find_ffi
|
33
|
+
extend ffi_module::Library
|
34
|
+
ffi_module
|
35
|
+
end
|
36
|
+
|
37
|
+
# @api_private
|
38
|
+
# Loads the libbel shared library.
|
39
|
+
def load_libBEL
|
40
|
+
ffi_module = find_ffi
|
41
|
+
extend ffi_module::Library
|
42
|
+
|
43
|
+
lib_path = resolve_library('libbel')
|
48
44
|
|
49
|
-
# @api_private
|
50
|
-
# Loads the libbel shared library.
|
51
|
-
def load_libBEL
|
52
|
-
ffi_module = find_ffi
|
53
|
-
extend ffi_module::Library
|
54
|
-
|
55
|
-
# libbel.so: Linux and MinGW
|
56
|
-
# libbel.bundle: Mac OSX
|
57
|
-
messages = []
|
58
|
-
library_loaded = ['libbel.so', 'libbel.bundle'].map { |library_file|
|
59
|
-
[
|
60
|
-
library_file,
|
61
|
-
File.join(
|
62
|
-
File.expand_path(File.dirname(__FILE__)),
|
63
|
-
library_file
|
64
|
-
)
|
65
|
-
]
|
66
|
-
}.any? do |library_file, library_path|
|
67
|
-
# Try loading top-level shared library.
|
68
45
|
begin
|
69
|
-
ffi_lib
|
46
|
+
ffi_lib lib_path
|
70
47
|
true
|
71
|
-
rescue LoadError =>
|
72
|
-
|
73
|
-
|
74
|
-
ffi_lib File.join(extension_path, library_file)
|
75
|
-
true
|
76
|
-
rescue LoadError => exception2
|
77
|
-
messages << exception1.to_s
|
78
|
-
messages << exception2.to_s
|
79
|
-
false
|
80
|
-
end
|
48
|
+
rescue LoadError => err
|
49
|
+
raise LibraryLoadError.new('libbel', err)
|
50
|
+
false
|
81
51
|
end
|
82
52
|
end
|
83
|
-
|
84
|
-
if !library_loaded
|
85
|
-
msg = messages.map { |msg| " #{msg}" }.join("\n")
|
86
|
-
fail LoadError.new("Failed to load libbel library. Details:\n#{msg}")
|
87
|
-
end
|
88
53
|
end
|
89
|
-
end
|
90
54
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
55
|
+
# Constant holding the FFI module for this ruby engine.
|
56
|
+
FFI = BEL::LibBEL::load_ffi
|
57
|
+
BEL::LibBEL::load_libBEL
|
58
|
+
|
59
|
+
# typedef enum bel_token_type
|
60
|
+
enum :bel_token_type, [
|
61
|
+
:IDENT, 0,
|
62
|
+
:STRING,
|
63
|
+
:O_PAREN,
|
64
|
+
:C_PAREN,
|
65
|
+
:COLON,
|
66
|
+
:COMMA,
|
67
|
+
:SPACES
|
68
|
+
]
|
69
|
+
|
70
|
+
enum :bel_ast_node_type, [
|
71
|
+
:BEL_TOKEN, 0,
|
72
|
+
:BEL_VALUE
|
73
|
+
]
|
74
|
+
|
75
|
+
enum :bel_ast_token_type, [
|
76
|
+
:BEL_TOKEN_STATEMENT, 0,
|
77
|
+
:BEL_TOKEN_SUBJECT,
|
78
|
+
:BEL_TOKEN_OBJECT,
|
79
|
+
:BEL_TOKEN_REL,
|
80
|
+
:BEL_TOKEN_TERM,
|
81
|
+
:BEL_TOKEN_ARG,
|
82
|
+
:BEL_TOKEN_NV
|
83
|
+
]
|
84
|
+
|
85
|
+
enum :bel_ast_value_type, [
|
86
|
+
:BEL_VALUE_FX, 0,
|
87
|
+
:BEL_VALUE_REL,
|
88
|
+
:BEL_VALUE_PFX,
|
89
|
+
:BEL_VALUE_VAL
|
90
|
+
]
|
91
|
+
|
92
|
+
require_relative 'libbel/bel_ast_structs'
|
93
|
+
require_relative 'libbel/bel_token'
|
94
|
+
require_relative 'libbel/bel_token_iterator'
|
95
|
+
require_relative 'libbel/bel_token_list'
|
96
|
+
|
97
|
+
# bel ast
|
98
|
+
attach_function :bel_ast_as_string, [:pointer ], :string
|
99
|
+
attach_function :bel_copy_ast_node, [:pointer ], :pointer
|
100
|
+
attach_function :bel_free_ast, [:pointer ], :void
|
101
|
+
attach_function :bel_free_ast_node, [:pointer ], :void
|
102
|
+
attach_function :bel_new_ast, [ ], :pointer
|
103
|
+
attach_function :bel_new_ast_node_token, [:bel_ast_token_type ], :pointer
|
104
|
+
attach_function :bel_new_ast_node_value, [:bel_ast_value_type, :string ], :pointer
|
105
|
+
attach_function :bel_print_ast, [:pointer ], :void
|
106
|
+
attach_function :bel_print_ast_node, [:pointer, :string ], :void
|
107
|
+
attach_function :bel_set_value, [:pointer, :string ], :pointer
|
108
|
+
|
109
|
+
# bel token
|
110
|
+
attach_function :bel_new_token, [:bel_token_type, :pointer, :pointer, :pointer], :pointer
|
111
|
+
attach_function :bel_new_token_iterator, [:pointer ], :pointer
|
112
|
+
attach_function :bel_new_token_list, [:int ], :pointer
|
113
|
+
attach_function :bel_print_token, [:pointer ], :void
|
114
|
+
attach_function :bel_print_token_list, [:pointer ], :void
|
115
|
+
attach_function :bel_token_iterator_end, [:pointer ], :int
|
116
|
+
attach_function :bel_token_iterator_get, [:pointer ], :pointer
|
117
|
+
attach_function :bel_token_iterator_next, [:pointer ], :void
|
118
|
+
attach_function :free_bel_token, [:pointer ], :void
|
119
|
+
attach_function :free_bel_token_iterator, [:pointer ], :void
|
120
|
+
attach_function :free_bel_token_list, [:pointer ], :void
|
121
|
+
|
122
|
+
# tokenize
|
123
|
+
attach_function :bel_tokenize_term, [:string ], :pointer
|
124
|
+
|
125
|
+
# parse
|
126
|
+
attach_function :bel_parse_statement, [:string ], :pointer
|
127
|
+
attach_function :bel_parse_term, [:string ], :pointer
|
128
|
+
|
129
|
+
def self.parse_statement(bel_string)
|
130
|
+
BEL::LibBEL::BelAst.new(BEL::LibBEL::bel_parse_statement(bel_string))
|
131
|
+
end
|
168
132
|
|
169
|
-
|
170
|
-
|
171
|
-
|
133
|
+
def self.parse_term(bel_string)
|
134
|
+
BEL::LibBEL::BelAst.new(BEL::LibBEL::bel_parse_term(bel_string))
|
135
|
+
end
|
172
136
|
|
173
|
-
|
174
|
-
|
175
|
-
|
137
|
+
def self.tokenize_term(bel_string)
|
138
|
+
BEL::LibBEL::BelTokenList.new(self.bel_tokenize_term(bel_string))
|
139
|
+
end
|
176
140
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
141
|
+
def self.copy_ast(bel_ast)
|
142
|
+
copy_root = self.copy_ast_node(bel_ast.root)
|
143
|
+
new_ast = BEL::LibBEL::BelAst.new(BEL::LibBEL::bel_new_ast())
|
144
|
+
new_ast.root = copy_root
|
145
|
+
new_ast
|
146
|
+
end
|
183
147
|
|
184
|
-
|
185
|
-
|
186
|
-
|
148
|
+
def self.copy_ast_node(bel_ast_node)
|
149
|
+
BEL::LibBEL::BelAstNode.new(BEL::LibBEL::bel_copy_ast_node(bel_ast_node))
|
150
|
+
end
|
187
151
|
|
188
|
-
|
189
|
-
|
190
|
-
|
152
|
+
def self.print_ast(bel_ast)
|
153
|
+
BEL::LibBEL::bel_print_ast(bel_ast)
|
154
|
+
end
|
191
155
|
|
192
|
-
|
193
|
-
|
194
|
-
|
156
|
+
def self.print_token(token)
|
157
|
+
self.bel_print_token(token.pointer)
|
158
|
+
end
|
195
159
|
|
196
|
-
|
197
|
-
|
160
|
+
def self.print_token_list(list)
|
161
|
+
self.bel_print_token_list(list.pointer)
|
162
|
+
end
|
198
163
|
end
|
199
164
|
end
|
200
|
-
|