Liking cljdoc? Tell your friends :D

com.yetanalytics.persephone.pattern.fsm


accepted?clj/s

(accepted? state-info)
source

alphatize-statesclj/s

(alphatize-states fsm-coll)

Rename all states in a collection of FSMs such that no two states share the same name. Renames all map keys for the :states metadata value if provided.

Rename all states in a collection of FSMs such that no two states
share the same name. Renames all map keys for the `:states` metadata
value if provided.
sourceraw docstring

alphatize-states-fsmclj/s

(alphatize-states-fsm fsm)

Rename all states in a single FSM. Renames all map keys for the :states metadata value if provided.

Rename all states in a single FSM. Renames all map keys for the `:states`
metadata value if provided.
sourceraw docstring

concat-nfaclj/s

(concat-nfa nfa-coll)
(concat-nfa nfa-coll meta?)

Concat a collection of NFAs in sequential order. The function throws an exception on empty collections. If meta? is true, then assoc the alphatized :states metadata to the NFA.

Concat a collection of NFAs in sequential order. The function throws
an exception on empty collections. If `meta?` is true, then assoc the
alphatized `:states` metadata to the NFA.
sourceraw docstring

epsilon-closureclj/s

(epsilon-closure {nfa-transitions :transitions :as _nfa} init-state)

Given an NFA with transitions and an init-state, returns the epsilon closure for that state.

Given an NFA with transitions and an `init-state`, returns the
epsilon closure for that state.
sourceraw docstring

kleene-nfaclj/s

(kleene-nfa nfa)
(kleene-nfa {:keys [symbols states start accepts transitions] :as nfa} meta?)

Apply the Kleene star operation on an NFA (the "*" regex symbol), which means the NFA can be taken zero or more times. If meta is true, copy the original :states metadata.

Apply the Kleene star operation on an NFA (the "*" regex symbol),
which means the NFA can be taken zero or more times. If `meta` is true,
copy the original `:states` metadata.
sourceraw docstring

minimize-dfaclj/s

(minimize-dfa dfa)

Minimize the DFA using Brzozowski's Algorithm, which reverses and determinizes the DFA twice.

Minimize the DFA using Brzozowski's Algorithm, which reverses and
determinizes the DFA twice.
sourceraw docstring

nfa->dfaclj/s

(nfa->dfa {start :start :as nfa})

Given an NFA with epsilon transitions, perform the powerset construction in order to (semi)-determinize it and remove epsilon transitions.

Given an NFA with epsilon transitions, perform the powerset
construction in order to (semi)-determinize it and remove
epsilon transitions.
sourceraw docstring

optional-nfaclj/s

(optional-nfa nfa)
(optional-nfa {:keys [symbols states start accepts transitions] :as nfa} meta?)

Apply the optional operation on an NFA (the "?" regex symbol), which means the NFA may or may not be taken. If meta is true, copy the original :states metadata.

Apply the optional operation on an NFA (the "?" regex symbol), which
means the NFA may or may not be taken. If `meta` is true, copy the
original `:states` metadata.
sourceraw docstring

plus-nfaclj/s

(plus-nfa nfa)
(plus-nfa {:keys [symbols states start accepts transitions] :as nfa} meta?)

Apply the Kleene plus operation on an NFA (the "+" regex symbol), which means the NFA can be taken one or more times. If meta is true, copy the original :states metadata.

Apply the Kleene plus operation on an NFA (the "+" regex symbol),
which means the NFA can be taken one or more times. If `meta` is true,
copy the original `:states` metadata.
sourceraw docstring

(read-next fsm state-info input)
(read-next fsm start-opts state-info input)

Given a compiled fsm, the current state-info, and input, let the FSM read that input; this function returns updated state info. The state info is a set of maps with the following fields:

:state The states arrived at in the FSM after reading the input. :accepted? True if the FSM as arrived at an accept state after reading the input; false otherwise. In addition to the required args, the optional start-opts map can be passed. Valid options include:

:record-visits? If true, each state info map will contain an extra :visited value that is a list of visited transition IDs. If state-info is nil, the function starts at the start state, with start-opts applied as needed. As indicated by its name, start-opts not applied when state-info is not nil.

If state-info is #{} is empty, it is returned as-is, since an empty set indicates that no more states can be matched.

Given a compiled `fsm`, the current `state-info`, and `input`, let
the FSM read that input; this function returns updated state info.
The state info is a set of maps with the following fields:
  
  :state     The states arrived at in the FSM after reading the input.
  :accepted? True if the FSM as arrived at an accept state
             after reading the input; false otherwise.
In addition to the required args, the optional `start-opts` map
can be passed. Valid options include:

  :record-visits? If true, each state info map will contain an extra
                  `:visited` value that is a list of visited
                  transition IDs.
If `state-info` is `nil`, the function starts at the start state,
with `start-opts` applied as needed. As indicated by its name,
`start-opts` not applied when `state-info` is not `nil`.

If `state-info` is `#{}` is empty, it is returned as-is, since an
empty set indicates that no more states can be matched.
sourceraw docstring

rejected?clj/s

(rejected? state-info)
source

transition-nfaclj/s

(transition-nfa fn-symbol f)
(transition-nfa fn-symbol f meta?)

Create an NFA that accepts a single input. If meta? is true, then associate :states metadata to the NFA.

Create an NFA that accepts a single input. If `meta?` is true, then
associate `:states` metadata to the NFA.
sourceraw docstring

union-nfaclj/s

(union-nfa nfa-coll)
(union-nfa nfa-coll meta?)

Construct a union of NFAs (corresponding to the "|" regex symbol.) If meta? is true, then assoc the alphatized :states metadata to the NFA.

Construct a union of NFAs (corresponding to the "|" regex symbol.)
If `meta?` is true, then assoc the alphatized `:states` metadata to
the NFA.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close