예제 #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);
        }
예제 #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);
         }
     }
 }
예제 #3
0
 internal override IElement CreateElement(IElementFactory elementFactory, IElement parent, IRule rule, IdentifierCollection ruleIds)
 {
     return(CreatePhraseElement(elementFactory, parent));
 }
예제 #4
0
 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));
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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));
 }
예제 #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);
 }
예제 #11
0
        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);
        }
예제 #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));
 }
예제 #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);
        }