private void Clear()
 {
     Fields.Clear();
     Consts.Clear();
     Enums.Clear();
     SyntaxTree = null;
 }
Пример #2
0
    public void Parse(string dir, bool clear = false)
    {
        if (clear)
        {
            Enums.Clear();
            Consts.Clear();
            Messages.Clear();
            Tables.Clear();
            Classes.Clear();
        }
        TypeManager.PushAssembly(typeof(Scorpio.Commons.FileUtil).Assembly);
        TypeManager.PushAssembly(GetType().Assembly);
        Script.LoadLibraryV1();
        var global     = Script.Global;
        var globalKeys = global.GetKeys();
        var files      = Directory.Exists(dir) ? Directory.GetFiles(dir, "*.sco", SearchOption.AllDirectories) : (File.Exists(dir) ? new string[] { dir } : new string[0]);

        foreach (var file in files)
        {
            Script.LoadFile(file);
        }
        var keys = global.GetKeys();

        foreach (var name in keys)
        {
            if (globalKeys.Contains(name))
            {
                continue;
            }
            var table = global.GetValue(name).Get <ScriptMap>();
            if (table == null)
            {
                continue;
            }
            if (name.StartsWith(ENUM_KEYWORD))                  //枚举类型
            {
                ParseEnum(name, table);
            }
            else if (name.StartsWith(CONST_KEYWORD))            //常量类型
            {
                ParseConst(name, table);
            }
            else
            {
                ParseClass(name, table);
            }
        }
    }
Пример #3
0
 private void Clear()
 {
     Fields.Clear();
     Consts.Clear();
 }