/// <summary>
        /// Attach a semantic tag to word. If the word is a rule ref then an
        /// epsilon transition must be created
        /// </summary>
        internal void AddSemanticInterpretationTag(CfgGrammar.CfgProperty propertyInfo)
        {
            // If the word is a rule ref, an epsilon transition must be created
            if (_endArc != null && _endArc.RuleRef != null)
            {
                Arc tagTransition = _backend.EpsilonTransition(1.0f);
                _backend.AddSemanticInterpretationTag(tagTransition, propertyInfo);

                // Create a new state
                State state = _backend.CreateNewState(_rule);

                // Connect the new state with the end arc
                tagTransition.Start = state;
                _endArc.End         = state;
                _endArc             = tagTransition;
            }
            else
            {
                if (_startArc == null)
                {
                    _startArc = _endArc = _backend.EpsilonTransition(1.0f);
                }
                _backend.AddSemanticInterpretationTag(_endArc, propertyInfo);
            }
        }
 // must add the rule Id
 // _propInfo._ulId = (uint) ((ParseElement) parent).StartState._rule._iSerialize2;
 internal void AddSementicPropertyTag(CfgGrammar.CfgProperty propertyInfo)
 {
     if (_startArc == null)
     {
         _startArc = _endArc = _backend.EpsilonTransition(1.0f);
     }
     _backend.AddPropertyTag(_startArc, _endArc, propertyInfo);
 }
Example #3
0
 internal void AddSemanticInterpretationTag(CfgGrammar.CfgProperty propertyInfo)
 {
     if (_endArc != null && _endArc.RuleRef != null)
     {
         Arc arc = _backend.EpsilonTransition(1f);
         _backend.AddSemanticInterpretationTag(arc, propertyInfo);
         State end = arc.Start = _backend.CreateNewState(_rule);
         _endArc.End = end;
         _endArc     = arc;
     }
     else
     {
         if (_startArc == null)
         {
             _startArc = (_endArc = _backend.EpsilonTransition(1f));
         }
         _backend.AddSemanticInterpretationTag(_endArc, propertyInfo);
     }
 }
Example #4
0
 internal Tag(Backend be, CfgGrammar.CfgProperty property)
 {
     _be     = be;
     _cfgTag = new CfgSemanticTag(be.Symbols, property);
 }