예제 #1
0
파일: MainForm.cs 프로젝트: jj-jabb/TinyPG
        private void MainForm_Load(object sender, EventArgs e)
        {
            headerEvaluator.Activate(textInput);
            headerEvaluator.CloseClick += new EventHandler(headerEvaluator_CloseClick);
            headerOutput.Activate(tabOutput);
            headerOutput.CloseClick += new EventHandler(headerOutput_CloseClick);

            DockExtender = new DockExtender(this);
            inputFloaty = DockExtender.Attach(panelInput, headerEvaluator, splitterBottom);
            outputFloaty = DockExtender.Attach(panelOutput, headerOutput, splitterRight);

            inputFloaty.Docking += new EventHandler(inputFloaty_Docking);
            outputFloaty.Docking += new EventHandler(inputFloaty_Docking);
            inputFloaty.Hide();
            outputFloaty.Hide();

            textOutput.Text = AssemblyInfo.ProductName + " v" + Application.ProductVersion + "\r\n";
            textOutput.Text += AssemblyInfo.CopyRightsDetail + "\r\n\r\n";

            marker = new TextMarker(textEditor);
            checker = new SyntaxChecker(marker); // run the syntax checker on seperate thread

            // create the syntax update checker event handler and remember its reference
            syntaxUpdateChecker = new EventHandler(checker_UpdateSyntax);
            checker.UpdateSyntax += syntaxUpdateChecker; // listen for events
            System.Threading.Thread thread = new System.Threading.Thread(checker.Start);
            thread.Start();

            TextChangedTimer = new Timer();
            TextChangedTimer.Tick += new EventHandler(TextChangedTimer_Tick);

            // assign the auto completion function to this editor
            // autocomplete form will take care of the rest
            codecomplete = new AutoComplete(textEditor);
            codecomplete.Enabled = false;
            directivecomplete = new AutoComplete(textEditor);
            directivecomplete.Enabled = false;
            directivecomplete.WordList.Items.Add("@ParseTree");
            directivecomplete.WordList.Items.Add("@Parser");
            directivecomplete.WordList.Items.Add("@Scanner");
            directivecomplete.WordList.Items.Add("@TextHighlighter");
            directivecomplete.WordList.Items.Add("@TinyPG");
            directivecomplete.WordList.Items.Add("Generate");
            directivecomplete.WordList.Items.Add("Language");
            directivecomplete.WordList.Items.Add("Namespace");
            directivecomplete.WordList.Items.Add("OutputPath");
            directivecomplete.WordList.Items.Add("TemplatePath");

            // setup the text highlighter (= text coloring)
            highlighterScanner = new TinyPG.Highlighter.Scanner();
            textHighlighter = new TinyPG.Highlighter.TextHighlighter(textEditor, highlighterScanner, new TinyPG.Highlighter.Parser(highlighterScanner));
            textHighlighter.SwitchContext += new TinyPG.Highlighter.ContextSwitchEventHandler(TextHighlighter_SwitchContext);

            LoadConfig();

            if (GrammarFile == null)
                NewGrammar();
        }
예제 #2
0
 public SyntaxChecker(TextMarker marker)
 {
     UpdateSyntax = null;
     this.marker = marker;
     disposing = false;
 }