//Form public frmMain() { InitializeComponent(); //Load files // ReSharper disable CoVariantArrayConversion string s = Properties.Settings.Default.Source_Paths; if (!string.IsNullOrEmpty(s)) { cbPath.Items.Clear(); cbPath.Items.AddRange(s.Split('\n')); } cbPath.SelectedIndex = 0; s = Properties.Settings.Default.Run_Paths; if (s != "") { cbRun_Path.Items.Clear(); cbRun_Path.Items.AddRange(s.Split('\n')); } cbRun_Path.SelectedIndex = 0; // ReSharper restore CoVariantArrayConversion _ide.SourceRTF = tbParse_Source; _ide.CompiledRTF = tbCompiled; _ide.GetSourceFile = GetSourceFile; _parser = _ide.Parser; _compiler = _ide.Compiler; _source_tp = _ide.SourceAnnotations; _compile_tp = _ide.CompiledAnnotations; tbParse_Source_TextChanged(null, null); }
/// <summary> /// Parse Source for grammar /// </summary> /// <returns> /// True if the grammar tree can be updated, False if unrecoverable errors occurred /// ParseError.Count indicates success or failure /// </returns> public bool Parse() { //Clear structures Clear(); if ((IDE == null) || (IDE.GrammarTree == null)) return false; IDE.GrammarTree.Clear(); Functions = IDE.GrammarTree.Functions; SourceCodeAnnotations = IDE.SourceAnnotations; IDE.ClearSourceSyntaxOccurences(); if (SourceCodeAnnotations != null) SourceCodeAnnotations.Clear(); //Prepare caret _caret.SyntaxOccurences = IDE.ParseSyntaxOccurences; _caret.Initialize(IDE.SourceText); //Parse the file if (!ParseImports()) return false; if (!ParseFunctions()) return false; ResolveUndefinedFunctionCalls(); //Infere the return types and do type checking foreach (var fun in Functions) fun.Block.GetReturnType(); return true; }