private IElement CreatePhraseElement(IElementFactory elementFactory, IElement parent)
 {
     if (_subsetMatching)
     {
         return(elementFactory.CreateSubset(parent, _phrase, _matchMode));
     }
     if (elementFactory is SrgsElementCompilerFactory)
     {
         XmlParser.ParseText(parent, _phrase, null, null, -1f, elementFactory.CreateToken);
         return(null);
     }
     return(elementFactory.CreateText(parent, _phrase));
 }
Exemple #2
0
 private IElement CreatePhraseElement(IElementFactory elementFactory, IElement parent)
 {
     if (_subsetMatching)
     {
         // Create and return the ISubset representing the current phrase
         return(elementFactory.CreateSubset(parent, _phrase, _matchMode));
     }
     else
     {
         if (elementFactory is SrgsElementCompilerFactory)
         {
             XmlParser.ParseText(parent, _phrase, null, null, -1f, new CreateTokenCallback(elementFactory.CreateToken));
         }
         else
         {
             // Create and return the IElementText representing the current phrase
             return(elementFactory.CreateText(parent, _phrase));
         }
     }
     return(null);
 }
        private ISubset ParseSubset(SrgsSubset srgsSubset, IElement parent)
        {
            MatchMode matchMode = MatchMode.Subsequence;

            switch (srgsSubset.MatchingMode)
            {
            case SubsetMatchingMode.OrderedSubset:
                matchMode = MatchMode.OrderedSubset;
                break;

            case SubsetMatchingMode.OrderedSubsetContentRequired:
                matchMode = MatchMode.OrderedSubsetContentRequired;
                break;

            case SubsetMatchingMode.Subsequence:
                matchMode = MatchMode.Subsequence;
                break;

            case SubsetMatchingMode.SubsequenceContentRequired:
                matchMode = MatchMode.SubsequenceContentRequired;
                break;
            }
            return(_parser.CreateSubset(parent, srgsSubset.Text, matchMode));
        }