module Fa
Namespace for the libfa bindings
Constants
- VERSION
Public Class Methods
[](rx)
click to toggle source
Compiles rx
into a finite automaton @param [String] rx a regular expression @return [Fa::Automaton] the finite automaton
# File lib/fa.rb, line 229 def self.[](rx) compile(rx) end
compile(rx)
click to toggle source
Compiles rx
into a finite automaton @param [String] rx a regular expression @return [Fa::Automaton] the finite automaton
# File lib/fa.rb, line 219 def self.compile(rx) faptr = ::FFI::MemoryPointer.new :pointer r = FFI::compile(rx, rx.size, faptr) raise Error if r != 0 # REG_NOERROR is 0, at least for glibc Automaton.new(faptr.get_pointer(0)) end
make_basic(kind)
click to toggle source
Makes a basic finite automaton, either an empty, epsilon, or total finite automaton. Those match no words, only the empty word, or all words. @param [:empty, :epsilon, :total] kind @return [Fa::Automaton] the finite automaton
# File lib/fa.rb, line 238 def self.make_basic(kind) faptr = FFI::make_basic(kind) raise OutOfMemoryError if faptr.null? Automaton.new(faptr) end