BasicMatchingAutomaton

fauto.spad line 92 [edit on github]

This domain implements nondeterministic finite automaton using Thompson algorithm for matching. Currently only supports creation of very simple automaton, but representation and matching algorithm supports general nondeterministic finite automaton.

do_match: (%, String) -> Boolean

do_match(a, s) returns true if and only if a matches s.

make_automaton: (List String, Boolean, Boolean) -> %

make_automaton(ls, pre_wild, post_wild) builds automaton matching pattern consisting of alternating strings and stars, where strings are taken from ls, star match any sequence of character. If pre_wild it true, then there is star at the start of the pattern, otherwise pattern starts with the first string of ls. If post_wild it true, then there is star at the end of the pattern, otherwise pattern ends with the last string of ls.