Exemple #1
0
        internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
        {
            // Create and return the IOneOf representing the current object
            IOneOf oneOf = elementFactory.CreateOneOf(parent, rule);

            foreach (GrammarBuilderBase item in Items)
            {
                ItemElement newItem = item as ItemElement;
                if (newItem == null)
                {
                    newItem = new ItemElement(item);
                }

                IItem element = (IItem)newItem.CreateElement(elementFactory, oneOf, rule, ruleIds);
                element.PostParse(oneOf);
                elementFactory.AddItem(oneOf, element);
            }
            return(oneOf);
        }
Exemple #2
0
 internal void CreateChildrenElements(IElementFactory elementFactory, IItem parent, IRule rule, IdentifierCollection ruleIds)
 {
     foreach (GrammarBuilderBase builder in Items)
     {
         IElement element = builder.CreateElement(elementFactory, parent, rule, ruleIds);
         if (element != null)
         {
             element.PostParse(parent);
             elementFactory.AddElement(parent, element);
         }
     }
 }
Exemple #3
0
 internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
 {
     return(CreatePhraseElement(elementFactory, parent));
 }
 internal abstract IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds);
        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));
        }
Exemple #6
0
        internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
        {
            // Create the children elements
            IItem item = parent as IItem;

            if (item != null)
            {
                CreateChildrenElements(elementFactory, item, rule, ruleIds);
            }
            else
            {
                if (parent == rule)
                {
                    CreateChildrenElements(elementFactory, rule, ruleIds);
                }
                else
                {
                    System.Diagnostics.Debug.Assert(false);
                }
            }

            // Create the tag element at the end only if there were some children
            IPropertyTag tag = elementFactory.CreatePropertyTag(parent);

            tag.NameValue(parent, null, _value);
            return(tag);
        }
Exemple #7
0
        internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
        {
            IItem item = parent as IItem;

            if (item != null)
            {
                CreateChildrenElements(elementFactory, item, rule, ruleIds);
            }
            else if (parent == rule)
            {
                CreateChildrenElements(elementFactory, rule, ruleIds);
            }
            IPropertyTag propertyTag = elementFactory.CreatePropertyTag(parent);

            propertyTag.NameValue(parent, null, _value);
            return(propertyTag);
        }
Exemple #8
0
        internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
        {
            IItem item = elementFactory.CreateItem(parent, rule, _minRepeat, _maxRepeat, 0.5f, 1f);

            CreateChildrenElements(elementFactory, item, rule, ruleIds);
            return(item);
        }
Exemple #9
0
 internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
 {
     // Return the IRuleRef to the dictation grammar
     return(CreateRuleRefToDictation(elementFactory, parent));
 }
Exemple #10
0
 internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
 {
     if (_rule == null)
     {
         IGrammar grammar = elementFactory.Grammar;
         _ruleName = ruleIds.CreateNewIdentifier(Name);
         _rule     = grammar.CreateRule(_ruleName, RulePublic.False, RuleDynamic.NotSet, false);
         CreateChildrenElements(elementFactory, _rule, ruleIds);
         _rule.PostParse(grammar);
     }
     return(_rule);
 }
        internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
        {
            // Create the rule associated with this key
            _ruleRef.Rule.CreateElement(elementFactory, parent, rule, ruleIds);

            // Create the ruleRef
            IElement ruleRef = _ruleRef.CreateElement(elementFactory, parent, rule, ruleIds);

            return(ruleRef);
        }
Exemple #12
0
 internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
 {
     return(elementFactory.CreateRuleRef(parent, new Uri("#" + Rule.RuleName, UriKind.Relative), _semanticKey, null));
 }
Exemple #13
0
        internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
        {
            // Create and return the real item (the item including the grammar)
            // for the current grammar
            IItem item = elementFactory.CreateItem(parent, rule, _minRepeat, _maxRepeat, 0.5f, 1f);

            // Create the children elements
            CreateChildrenElements(elementFactory, item, rule, ruleIds);

            return(item);
        }
        internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
        {
            // Return a ruleref to Garbage
            IRuleRef ruleRef = elementFactory.Garbage;

            elementFactory.InitSpecialRuleRef(parent, ruleRef);

            return(ruleRef);
        }
        internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
        {
            IRuleRef garbage = elementFactory.Garbage;

            elementFactory.InitSpecialRuleRef(parent, garbage);
            return(garbage);
        }