Module: BEL::LibBEL
- Extended by:
- LibraryResolver
- Defined in:
- lib/bel/libbel.rb,
lib/bel/libbel/bel_token.rb,
lib/bel/libbel/node_test.rb,
lib/bel/libbel/bel_token_list.rb,
lib/bel/libbel/node_traversal.rb,
lib/bel/libbel/bel_ast_structs.rb,
lib/bel/libbel/library_resolver.rb,
lib/bel/libbel/library_load_error.rb,
lib/bel/libbel/node_transformation.rb,
lib/bel/libbel/platform_support_error.rb
Defined Under Namespace
Modules: LibraryResolver, NodeTest, NodeTransformation, NodeTraversal
Classes: AstNodeTypeUnion, BelAst, BelAstNode, BelAstNodeToken, BelAstNodeTypeInfo, BelAstNodeValue, BelToken, BelTokenList, LibraryLoadError, PlatformSupportError
Constant Summary
collapse
- FFI =
Constant holding the FFI module for this ruby engine.
BEL::LibBEL::load_ffi
LibraryResolver::EXT_BASE_PATH
Class Method Summary
collapse
resolve_library
Class Method Details
.copy_ast(bel_ast) ⇒ Object
138
139
140
141
142
143
|
# File 'lib/bel/libbel.rb', line 138
def self.copy_ast(bel_ast)
copy_root = self.copy_ast_node(bel_ast.root)
new_ast = BEL::LibBEL::BelAst.new(BEL::LibBEL::bel_new_ast())
new_ast.root = copy_root
new_ast
end
|
.copy_ast_node(bel_ast_node) ⇒ Object
145
146
147
|
# File 'lib/bel/libbel.rb', line 145
def self.copy_ast_node(bel_ast_node)
BEL::LibBEL::BelAstNode.new(BEL::LibBEL::bel_copy_ast_node(bel_ast_node))
end
|
.find_ffi ⇒ Object
Determine FFI constant for this ruby engine.
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/bel/libbel.rb', line 16
def find_ffi
if rubinius?
require "ffi"
::FFI
else require "ffi"
::FFI
end
end
|
.load_ffi ⇒ Object
Extend with the correct ffi implementation.
29
30
31
32
33
|
# File 'lib/bel/libbel.rb', line 29
def load_ffi
ffi_module = BEL::LibBEL::find_ffi
extend ffi_module::Library
ffi_module
end
|
.load_libBEL ⇒ Object
Loads the libbel shared library.
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/bel/libbel.rb', line 36
def load_libBEL
ffi_module = find_ffi
extend ffi_module::Library
lib_path = resolve_library('libbel')
begin
ffi_lib lib_path
true
rescue LoadError => err
raise LibraryLoadError.new('libbel', err)
false
end
end
|
.parse_statement(bel_string) ⇒ Object
126
127
128
|
# File 'lib/bel/libbel.rb', line 126
def self.parse_statement(bel_string)
BEL::LibBEL::BelAst.new(BEL::LibBEL::bel_parse_statement(bel_string))
end
|
.parse_term(bel_string) ⇒ Object
130
131
132
|
# File 'lib/bel/libbel.rb', line 130
def self.parse_term(bel_string)
BEL::LibBEL::BelAst.new(BEL::LibBEL::bel_parse_term(bel_string))
end
|
.print_ast(bel_ast) ⇒ Object
149
150
151
|
# File 'lib/bel/libbel.rb', line 149
def self.print_ast(bel_ast)
BEL::LibBEL::bel_print_ast(bel_ast)
end
|
.print_token(token) ⇒ Object
153
154
155
|
# File 'lib/bel/libbel.rb', line 153
def self.print_token(token)
self.bel_print_token(token.pointer)
end
|
.print_token_list(list) ⇒ Object
157
158
159
|
# File 'lib/bel/libbel.rb', line 157
def self.print_token_list(list)
self.bel_print_token_list(list.pointer)
end
|
.rubinius? ⇒ Boolean
11
12
13
|
# File 'lib/bel/libbel.rb', line 11
def rubinius?
defined?(RUBY_ENGINE) && ("rbx" == RUBY_ENGINE)
end
|
.tokenize_term(bel_string) ⇒ Object
134
135
136
|
# File 'lib/bel/libbel.rb', line 134
def self.tokenize_term(bel_string)
BEL::LibBEL::BelTokenList.new(self.bel_tokenize_term(bel_string))
end
|