public override FA VisitRegexpbasicChar(CASTElement currentNode) { CRegexpbasicChar charNode = currentNode as CRegexpbasicChar; FAGraphQueryInfo FAInfo; //1.Create FA m_NFA = new FA(); FAInfo = new FAGraphQueryInfo(m_NFA, FA.m_FAINFOKEY); //2.Create nodes initial-final CGraphNode init = m_NFA.CreateGraphNode <CGraphNode>(); CGraphNode final = m_NFA.CreateGraphNode <CGraphNode>(); m_NFA.M_Initial = init; m_NFA.SetFinalState(final); m_NFA.M_Alphabet.AddSet(charNode.M_CharRangeSet); //3.Draw the edge including the character CGraphEdge newEdge = m_NFA.AddGraphEdge <CGraphEdge, CGraphNode>(init, final, GraphType.GT_DIRECTED); FAInfo.Info(newEdge).M_TransitionCharSet = charNode.M_CharRangeSet; //4.Pass FA to the predecessor m_NFA.PrefixGraphElementLabels(m_currentRegularExpression.M_StatementID, GraphElementType.ET_NODE); m_ReportingServices.ExctractThompsonStep(m_NFA, @"../Debug/BasicChar_" + charNode.M_CharRangeSet.ToString() + ".dot"); m_ReportingServices.AddThompsonStepToReporting(m_NFA); return(m_NFA); }
public override FA VisitRegexpbasicChar(CASTElement currentNode) { CRegexpbasicChar charNode = currentNode as CRegexpbasicChar; CThompsonCharTemplate charTemplate = new CThompsonCharTemplate(this.GetHashCode()); m_currentNFA = charTemplate.Synthesize(charNode.M_CharRangeSet); m_currentNFA.PrefixGraphElementLabels(m_currentRegularExpression.M_StatementID, GraphElementType.ET_NODE); m_ReportingServices.ExctractThompsonStep(m_currentNFA, @"BasicChar_" + charNode.M_CharRangeSet.ToString() + ".dot", this.GetHashCode()); m_ReportingServices.AddThompsonStepToReporting(m_currentNFA, this.GetHashCode()); return(m_currentNFA); }