private IRuleRef ParseRuleRef(SrgsRuleRef srgsRuleRef, IElement parent)
        {
            IRuleRef ruleRef = null;
            bool     flag    = true;

            if (srgsRuleRef == SrgsRuleRef.Null)
            {
                ruleRef = _parser.Null;
            }
            else if (srgsRuleRef == SrgsRuleRef.Void)
            {
                ruleRef = _parser.Void;
            }
            else if (srgsRuleRef == SrgsRuleRef.Garbage)
            {
                ruleRef = _parser.Garbage;
            }
            else
            {
                ruleRef = _parser.CreateRuleRef(parent, srgsRuleRef.Uri, srgsRuleRef.SemanticKey, srgsRuleRef.Params);
                flag    = false;
            }
            if (flag)
            {
                _parser.InitSpecialRuleRef(parent, ruleRef);
            }
            ruleRef.PostParse(parent);
            return(ruleRef);
        }
Esempio n. 2
0
        private IRuleRef CreateRuleRefToDictation(IElementFactory elementFactory, IElement parent)
        {
            Uri ruleUri;

            if (!string.IsNullOrEmpty(_category) && _category == "spelling")
            {
                ruleUri = new Uri("grammar:dictation#spelling", UriKind.RelativeOrAbsolute);
            }
            else
            {
                ruleUri = new Uri("grammar:dictation", UriKind.RelativeOrAbsolute);
            }

            return(elementFactory.CreateRuleRef(parent, ruleUri, null, null));
        }
Esempio n. 3
0
 internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
 {
     // Create the new rule and add the reference to the item
     return(elementFactory.CreateRuleRef(parent, new Uri("#" + Rule.RuleName, UriKind.Relative), _semanticKey, null));
 }
        private IRuleRef CreateRuleRefToDictation(IElementFactory elementFactory, IElement parent)
        {
            Uri srgsUri = (string.IsNullOrEmpty(_category) || !(_category == "spelling")) ? new Uri("grammar:dictation", UriKind.RelativeOrAbsolute) : new Uri("grammar:dictation#spelling", UriKind.RelativeOrAbsolute);

            return(elementFactory.CreateRuleRef(parent, srgsUri, null, null));
        }
        internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
        {
            Uri ruleUri = new(_uri, UriKind.RelativeOrAbsolute);

            return(elementFactory.CreateRuleRef(parent, ruleUri, null, null));
        }