Esempio n. 1
0
        List <Referent> _createReferent(string typeName, string definition)
        {
            Analyzer analyzer = null;

            if (!m_AnalByType.TryGetValue(typeName, out analyzer))
            {
                return(null);
            }
            SourceOfAnalysis sf = new SourceOfAnalysis(definition);
            AnalysisResult   ar = m_Processor._process(sf, true, true, null, null);

            if (ar == null || ar.FirstToken == null)
            {
                return(null);
            }
            Referent r0 = ar.FirstToken.GetReferent();
            Token    t  = null;

            if (r0 != null)
            {
                if (r0.TypeName != typeName)
                {
                    r0 = null;
                }
            }
            if (r0 != null)
            {
                t = ar.FirstToken;
            }
            else
            {
                ReferentToken rt = analyzer.ProcessOntologyItem(ar.FirstToken);
                if (rt == null)
                {
                    return(null);
                }
                r0 = rt.Referent;
                t  = rt.EndToken;
            }
            for (t = t.Next; t != null; t = t.Next)
            {
                if (t.IsChar(';') && t.Next != null)
                {
                    Referent r1 = t.Next.GetReferent();
                    if (r1 == null)
                    {
                        ReferentToken rt = analyzer.ProcessOntologyItem(t.Next);
                        if (rt == null)
                        {
                            continue;
                        }
                        t  = rt.EndToken;
                        r1 = rt.Referent;
                    }
                    if (r1.TypeName == typeName)
                    {
                        r0.MergeSlots(r1, true);
                        r1.Tag = r0;
                    }
                }
            }
            if (r0 == null)
            {
                return(null);
            }
            r0.Tag = r0;
            r0     = analyzer.PersistAnalizerData.RegisterReferent(r0);
            m_Processor._createRes(ar.FirstToken.Kit, ar, null, true);
            List <Referent> res = new List <Referent>();

            res.Add(r0);
            foreach (Referent e in ar.Entities)
            {
                if (e.Tag == null)
                {
                    res.Add(e);
                }
            }
            return(res);
        }