Package EasyExtend :: Package trail :: Module nfatools
[hide private]
[frames] | no frames]

Module nfatools

Functions [hide private]
 
is_token(s)
 
symbols(lst)
 
collect_symbols(nfas)
 
keywords(used_symbols)
 
terminals(used_symbols, keywords)
 
reduced_nfa(nfas, start)
Computes a nfa while skipping any skippable labels.
 
last_set(nfas, reachables)
The EndTrans(A) = { A_t1, ..., A_tk } is the set of "end transitions" of A i.e.
 
first_set(nfas, r)
 
expanded_transitions(nfas, r)
 
all_selections(nfas, r, full=True)
 
cyclefree_traces(nfas, nonterminals)
 
span_traces(nfas, nonterminals)
 
flatten_list(lst)
 
reachables(nfas)
 
terminal_ancestors(reachables)
 
lexnfa2regex(nfa, pseudo_token)
Constructs a set of regular expressions from an nfa :
Function Details [hide private]

last_set(nfas, reachables)

 

The EndTrans(A) = { A_t1, ..., A_tk } is the set of "end transitions" of A i.e. those transitions that contain (None,'-',A). The LastSet(A) of A is defined recursively by EndTrans(A) together with the EndTrans of each element in EndTrans(A). Often LastSet(A) is just {None}. In those cases we do not care.

This function computes the LastSets of all nodes in the NFA set.

lexnfa2regex(nfa, pseudo_token)

 

Constructs a set of regular expressions from an nfa :

   If NFA = {L1:T1, ..., Ln:Tn} is given we try to construct a regex for each label L
   that matches the same string as an NFALexer would match following the standard parsing
   routine.