Package monq.jfa
package monq.jfa
Main entry point to implement Finite Automata, deterministic and nondeterministic and use them for matching. There is an example program available.
A typical use of this package involves the following steps.
- Creation of an NFA with an
NfaBuilder:NfaBuilder<String> b = new NfaBuilder<>() .matchRegex("[a-z]+", "ALPHA") .or("[0-9]+", "NUM"); - Compilation into a DFA with
NfaBuilder.compileToDfa().Dfa
dfa = b.compileToDfa() - Text matching with the
Dfamethods:assertEquals("NUM", dfa.matchesAtStart("1234 bla bla")) - Or text filtering
with
DfaFilter.
Alternatively, for matching without the need to retrieve a value, see Regexp.
-
ClassDescriptionasd;kfj alsdkjf lasdkjf laksdjf laksjdf laksjdf laskjdf lakdsjfalsdjf laskdjf lasdkjf lasdkfj alsdjkf alsdfjk asldfjk asdlfkjdefines the the character source from which automaton matching reads the data.CharTrans<T>Interface of a data structure to map non-overlapping character ranges like 'a'-'f' to non-
nullobjects.A function to map onecharto another.Represents things that go wrong during compilation of an Nfa into a Dfa.Dfa<T>A deterministic finite automaton, with convenience methods to match text and/or lookup values stored for a matching text.Contains a static function to output a finite automaton as a graph to be printed by the dot utility.Intervals<D>Used to constructCharTransobjects of different implementations.Miscellaneous static functions.Nfa<T>Merely a holder for a start and a stop state as produced byNfaBuilder.pop().NfaBuilder<T>A builder for non-deterministic finite automata along the lines of Thompson's Construction and a compilation method to get a deterministic finite automaton.NfaState<T>PairStack<T>PlainSet<E>an implementation ofSetbased on a simple hashing scheme.RangeEntry<T>Abstraction over the type of key/value pair stored in aCharTranswhere the key is a character range given by its inclusive borders.Wraps a Reader or an input stream to provide a CharSource.Implements the regular expression syntax classically used bymonq.jfa.A matcher looping onDfa.transition(monq.jfa.CharSource), recording character positions when traversing a state which teststruefor a given predicate.Convenience class for matching regular expressions with aDfa.Defines the interface of a regular expression parser used byNfaBuilder.matchRegex(java.lang.CharSequence)and configured withNfaBuilder(ReParser, StateValueMerger, double)is thrown whenever a syntax error is found in a regular expression.Merges a list of values into one result.ACharSourcefor aStringor a part of it.