示例#1
0
 static public void Parse(PathModel path, Context context)
 {
     LibParser inst = new LibParser(path, context);
     inst.Run();
 }
示例#2
0
 public LibParser(PathModel path, Context context)
 {
     this.path = path;
     this.context = context;
 }
示例#3
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
        {
            switch (e.Type)
            {
                case EventType.ProcessArgs:
                    /*TextEvent te = e as TextEvent;
                    if (te.Value.IndexOf("$(FlexSDK)") >= 0)
                    {
                        te.Value = te.Value.Replace("$(FlexSDK)", contextInstance.GetCompilerPath());
                    }*/
                    break;

                case EventType.Command:
                    DataEvent de = e as DataEvent;
                    string action = de.Action;

                    if (PluginBase.CurrentProject == null || !(PluginBase.CurrentProject is LoomProject))
                    {
                        if (action == "ProjectManager.Project") LoomHelper.Monitor(null);
                        return;
                    }

                    if (action == "ProjectManager.OpenVirtualFile")
                    {
                        if (PluginBase.CurrentProject != null && PluginBase.CurrentProject.Language == "Loom")
                            e.Handled = OpenVirtualFileModel(de.Data as String);
                    }
                    else
                    if (action == "ProjectManager.BuildingProject"
                        && (PluginBase.CurrentProject as LoomProject).OutputType == OutputType.Application)
                    {
                        de.Handled = true;
                        PluginBase.MainForm.CallCommand("SaveAllModified", null);
                        LoomHelper.Build(PluginBase.CurrentProject as LoomProject);
                    }
                    else if (action == "ProjectManager.TestingProject" 
                             && (PluginBase.CurrentProject as LoomProject).OutputType == OutputType.Application)
                    {
                        de.Handled = true;
                        PluginBase.MainForm.CallCommand("SaveAllModified", null);
                        LoomHelper.Run(PluginBase.CurrentProject as LoomProject);
                    }
                    else if (action == "ProjectManager.Project")
                    {
                        LoomHelper.Monitor(de.Data as LoomProject);
                    }
                    break;

                case EventType.UIStarted:
                    contextInstance = new Context(settingObject);
                    ValidateSettings();
                    // Associate this context with Loom language
                    ASContext.RegisterLanguage(contextInstance, "loom");
                    break;

                case EventType.FileSave:
                case EventType.FileSwitch:
                    //if (contextInstance != null) contextInstance.OnFileOperation(e); // TODO syntax check
                    break;
            }
        }