Example #1
0
func GenerateNFA(ruleName string, regularRuleList *list.List) *automata.NFA {
	rules := make(map[string]*abnf.Rule)
	for e := regularRuleList.Front(); e != nil; e = e.Next() {
		v := e.Value.(*abnf.Rule)
		rules[v.GetRuleName().String()] = v
	}
	startState := automata.NewNFAState()
	acceptingState := automata.NewNFAState()
	rules[ruleName].GetElements().GetNFAStates(startState, acceptingState, rules)
	return automata.NewNFA2(startState, acceptingState)
}
Example #2
0
func (this *Concatenation) GetNFA(rules map[string]*Rule) *automata.NFA { //throws IllegalAbnfException {
	startState := automata.NewNFAState()
	acceptingState := automata.NewNFAState()
	this.GetNFAStates(startState, acceptingState, rules)
	return automata.NewNFA2(startState, acceptingState)
}