Esempio n. 1
0
    void ProcessTypedefs(LexSection section)
    {
        foreach (var tpd in section.typedefs)
        {
            LexClass defClass = section.FindLexSection(tpd.value) as LexClass;
            if (defClass == null)
            {
                continue;
            }

            LexClass newClass = defClass.Clone();
            string   oldName  = newClass.shortName;
            newClass.shortName = tpd.name;
            RenameClass(newClass, newClass.name, section.name + "::" + newClass.shortName);
            section.classes.Add(newClass);
            section.childSections.Add(newClass);
        }

        section.childSections.ForEach(x => ProcessTypedefs(x));
    }
Esempio n. 2
0
    void ProcessTypedefs(LexSection section)
    {
        foreach (var tpd in section.typedefs)
        {
            LexClass defClass = section.FindLexSection(tpd.value) as LexClass;
            if (defClass == null)
                continue;

            LexClass newClass = defClass.Clone();
            string oldName = newClass.shortName;
            newClass.shortName = tpd.name;
            RenameClass(newClass, newClass.name, section.name + "::" + newClass.shortName);
            section.classes.Add(newClass);
            section.childSections.Add(newClass);
        }

        section.childSections.ForEach(x => ProcessTypedefs(x));
    }
Esempio n. 3
0
 void BindUsingNamespaces(LexSection section)
 {
     section.usingNamespaces.ForEach(x => x.nspace = section.FindLexSection(x.name) as LexNamespace);
     section.childSections.ForEach(x => BindUsingNamespaces(x));
 }
Esempio n. 4
0
 void BindUsingNamespaces(LexSection section)
 {
     section.usingNamespaces.ForEach(x => x.nspace = section.FindLexSection(x.name) as LexNamespace);
     section.childSections.ForEach(x => BindUsingNamespaces(x));
 }
Esempio n. 5
0
    public LexSection FindLexSection(string name)
    {
        int delm = name.IndexOf("::");

        if (delm < 0)
        {
            LexSection fnd = classes.Find(x => x.shortName == name);

            if (fnd != null)
            {
                return(fnd);
            }

            fnd = childSections.Find(x => x.GetType() == typeof(LexNamespace) && (x as LexNamespace).name == name);

            if (fnd != null)
            {
                return(fnd);
            }

            if (GetType() == typeof(LexClass))
            {
                foreach (var baseCls in (this as LexClass).baseClasses)
                {
                    if (baseCls.lexClass == null)
                    {
                        continue;
                    }

                    fnd = baseCls.lexClass.FindLexSection(name);
                    if (fnd != null)
                    {
                        return(fnd);
                    }
                }
            }

            if (parentLexSection != null && parentLexSection.usingNamespaces.Find(x => x.nspace == this) == null)
            {
                return(parentLexSection.FindLexSection(name));
            }
        }
        else
        {
            string part = name.Substring(0, delm);

            LexSection childSec = childSections.Find(x =>
            {
                return((x.GetType() == typeof(LexNamespace) && (x as LexNamespace).name == part));
            });

            if (childSec == null)
            {
                childSec = classes.Find(x => x.shortName == part);
            }

            if (childSec != null)
            {
                return(childSec.FindLexSection(name.Substring(delm + 2)));
            }
            else
            {
                if (parentLexSection != null && parentLexSection.usingNamespaces.Find(x => x.nspace == this) == null)
                {
                    return(parentLexSection.FindLexSection(name));
                }
            }
        }

        foreach (var sps in usingNamespaces)
        {
            var res = sps.nspace.FindLexSection(name);
            if (res != null)
            {
                return(res);
            }
        }

        return(null);
    }