public TokenReadError(PascalABCCompiler.ParserTools.GPBParser parser) : base(string.Format(ParserErrorsStringResources.Get("UNEXPECTED_SYMBOL{0}"), parser.LRParser.TokenText!="" ? parser.LRParser.TokenText : "(EOF)"), parser.current_file_name, parser.parsertools.GetTokenSourceContext(parser.LRParser), (syntax_tree_node)parser.prev_node) { }
private void ChangeCompilerState(ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { switch (State) { case CompilerState.CompilationFinished: if (compiler.ErrorsList.Count > 0) foreach (Errors.Error er in compiler.ErrorsList) SendErrorOrWarning(er); if (compiler.Warnings.Count > 0) foreach (Errors.Error er in compiler.Warnings) SendErrorOrWarning(er); SendCommand(ConsoleCompilerConstants.LinesCompiled, compiler.LinesCompiled.ToString()); SendCommand(ConsoleCompilerConstants.BeginOffest, compiler.BeginOffset.ToString()); SendCommand(ConsoleCompilerConstants.VarBeginOffest, compiler.VarBeginOffset.ToString()); SendCommand(ConsoleCompilerConstants.CompilerOptionsOutputType, ((int)compiler.CompilerOptions.OutputFileType).ToString()); sendWorkingSet(); break; case CompilerState.Ready: if(compilerReloading) sendWorkingSet(); break; } if (FileName != null) SendCommand(ConsoleCompilerConstants.CommandStartNumber + (int)State, FileName); else SendCommand(ConsoleCompilerConstants.CommandStartNumber + (int)State); }
public VisualEnvironmentCompiler(InvokeDegegate beginInvoke, SetFlagDelegate setCompilingButtonsEnabled, SetFlagDelegate setCompilingDebugEnabled, SetTextDelegate setStateText, SetTextDelegate addTextToCompilerMessages, ToolStripMenuItem pluginsMenuItem, ToolStrip pluginsToolStrip, ExecuteSourceLocationActionDelegate ExecuteSLAction, ExecuteVisualEnvironmentCompilerActionDelegate ExecuteVECAction, PascalABCCompiler.Errors.ErrorsStrategyManager ErrorsManager, RunManager RunnerManager, DebugHelper DebugHelper,UserOptions UserOptions,System.Collections.Hashtable StandartDirectories, Dictionary<string, CodeFileDocumentControl> OpenDocuments, IWorkbench workbench) { this.StandartDirectories = StandartDirectories; this.ErrorsManager = ErrorsManager; this.ChangeVisualEnvironmentState += new ChangeVisualEnvironmentStateDelegate(onChangeVisualEnvironmentState); SetCompilingButtonsEnabled = setCompilingButtonsEnabled; SetDebugButtonsEnabled = setCompilingDebugEnabled; SetStateText = setStateText; AddTextToCompilerMessages = addTextToCompilerMessages; this.beginInvoke = beginInvoke; this.ExecuteSLAction=ExecuteSLAction; this.ExecuteVECAction = ExecuteVECAction; PluginsMenuItem = pluginsMenuItem; PluginsToolStrip = pluginsToolStrip; PluginsController = new VisualPascalABCPlugins.PluginsController(this, PluginsMenuItem, PluginsToolStrip, workbench); this.RunnerManager = RunnerManager; this.DebugHelper = DebugHelper; DebugHelper.Starting += new DebugHelper.DebugHelperActionDelegate(DebugHelper_Starting); DebugHelper.Exited += new DebugHelper.DebugHelperActionDelegate(DebugHelper_Exited); RunnerManager.Starting += new RunManager.RunnerManagerActionDelegate(RunnerManager_Starting); RunnerManager.Exited += new RunManager.RunnerManagerActionDelegate(RunnerManager_Exited); this.CodeCompletionParserController = WorkbenchServiceFactory.CodeCompletionParserController; this.CodeCompletionParserController.visualEnvironmentCompiler = this; this.UserOptions = UserOptions; this.OpenDocuments = OpenDocuments; }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { if (!Visible) return; switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: BuildButtonsEnabled = syntaxTreeSelectComboBox.Enabled = false; this.Refresh(); break; case PascalABCCompiler.CompilerState.CompilationFinished: Errors.Clear(); if (VisualEnvironmentCompiler.Compiler.ErrorsList.Count > 0) { SyntaxError er; for (int i = 0; i < VisualEnvironmentCompiler.Compiler.ErrorsList.Count; i++) { er = VisualEnvironmentCompiler.Compiler.ErrorsList[i] as SyntaxError; if (er!=null && er.bad_node != null) Errors[er.bad_node] = i; } } UpdateSelectList(); ShowTree(); BuildButtonsEnabled = true; break; } }
public void SetOptions(PascalABCCompiler.IProjectInfo prj) { prj.DeleteEXE = this.cbDeleteExe.Checked; prj.DeletePDB = this.cbDeletePdb.Checked; prj.IncludeDebugInfo = this.cbDebugRelease.SelectedIndex == 0; prj.OutputDirectory = this.tbOutputDirectory.Text; prj.CommandLineArguments = this.tbRunArguments.Text; if (!string.IsNullOrEmpty(this.tbAppIcon.Text)) { /*if (File.Exists(this.tbAppIcon.Text)) prj.AppIcon = this.tbAppIcon.Text; else*/ prj.AppIcon = Path.Combine(prj.ProjectDirectory, this.tbAppIcon.Text); } else prj.AppIcon = null; prj.MajorVersion = Convert.ToInt32(this.tbMajor.Text); prj.MinorVersion = Convert.ToInt32(this.tbMinor.Text); prj.BuildVersion = Convert.ToInt32(this.tbBuild.Text); prj.RevisionVersion = Convert.ToInt32(this.tbRevision.Text); prj.GenerateXMLDoc = this.cbGenerateXmlDoc.Checked; prj.Product = this.tbProduct.Text; prj.Company = this.tbCompany.Text; prj.Trademark = this.tbTradeMark.Text; prj.Copyright = this.tbCopyright.Text; }
public void LoadOptions(PascalABCCompiler.IProjectInfo prj) { proj = prj; this.cbDeleteExe.Checked = prj.DeleteEXE; this.cbDeletePdb.Checked = prj.DeletePDB; if (prj.IncludeDebugInfo) this.cbDebugRelease.SelectedIndex = 0; else this.cbDebugRelease.SelectedIndex = 1; this.tbOutputDirectory.Text = prj.OutputDirectory; this.tbRunArguments.Text = prj.CommandLineArguments; if (!string.IsNullOrEmpty(prj.AppIcon)) { this.tbAppIcon.Text = prepare_icon_name(prj.AppIcon); } this.tbMajor.Text = Convert.ToString(prj.MajorVersion); this.tbMinor.Text = Convert.ToString(prj.MinorVersion); this.tbBuild.Text = Convert.ToString(prj.BuildVersion); this.tbRevision.Text = Convert.ToString(prj.RevisionVersion); this.cbGenerateXmlDoc.Checked = prj.GenerateXMLDoc; this.tbProduct.Text = prj.Product; this.tbCompany.Text = prj.Company; this.tbTradeMark.Text = prj.Trademark; this.tbCopyright.Text = prj.Copyright; }
public GPB_PABCPreprocessor2(Stream stream, PascalABCCompiler.Preprocessor2.Preprocessor2 prepr1) : base(stream) { pascal_parsertools = new pascalabc_parsertools(); parsertools = pascal_parsertools; prepr = prepr1; }
public GPB_PABCPreprocessor2(Stream stream, GoldParser.Grammar grammar, PascalABCCompiler.Preprocessor2.Preprocessor2 prepr1) : base(grammar) { pascal_parsertools = new pascalabc_parsertools(); parsertools = pascal_parsertools; prepr = prepr1; }
public override void Update(PascalABCCompiler.Parsers.SymInfo si) { ICompletionData val=null; if (dict.TryGetValue(si,out val)) { val.Description = si.description; } }
public static SourceLocation ConvertSourceContextToSourceLocation(string FileName, PascalABCCompiler.SyntaxTree.SourceContext sc) { if (sc.FileName != null) FileName = sc.FileName; return new SourceLocation(FileName, sc.begin_position.line_num, sc.begin_position.column_num, sc.end_position.line_num, sc.end_position.column_num); }
/// <summary> /// Получение имен после точки /// </summary> public SymInfo[] GetName(expression expr, string str, int line, int col, PascalABCCompiler.Parsers.KeywordKind keyword, ref SymScope root) { if (visitor.cur_scope == null) return null; if (col + 1 > str.Length) col -= str.Length; SymScope si = visitor.FindScopeByLocation(line + 1, col + 1);//stv.cur_scope; if (si == null) { si = visitor.FindScopeByLocation(line, col + 1); if (si == null) return null; } SetCurrentUsedAssemblies(); ExpressionVisitor ev = new ExpressionVisitor(expr, si, visitor); si = ev.GetScopeOfExpression(true, false); root = si; if (si is ElementScope) root = (si as ElementScope).sc; else if (si is ProcScope) root = (si as ProcScope).return_type; if (si != null) { if (!(si is TypeScope) && !(si is NamespaceScope)) { SymInfo[] syms = si.GetNamesAsInObject(ev); SymInfo[] ext_syms = null; if (si is ElementScope) ext_syms = visitor.cur_scope.GetSymInfosForExtensionMethods((si as ElementScope).sc as TypeScope); List<SymInfo> lst = new List<SymInfo>(); lst.AddRange(syms); if (ext_syms != null) lst.AddRange(ext_syms); RestoreCurrentUsedAssemblies(); List<SymInfo> lst_to_remove = new List<SymInfo>(); foreach (SymInfo si2 in lst) if (si2.name.StartsWith("operator")) lst_to_remove.Add(si2); foreach (SymInfo si2 in lst_to_remove) lst.Remove(si2); return lst.ToArray(); } else { if (si is TypeScope) { RestoreCurrentUsedAssemblies(); return (si as TypeScope).GetNames(ev, keyword, false); } else { if (ev.entry_scope.InUsesRange(line + 1, col + 1)) keyword = PascalABCCompiler.Parsers.KeywordKind.Uses; RestoreCurrentUsedAssemblies(); return (si as NamespaceScope).GetNames(ev, keyword); } } } RestoreCurrentUsedAssemblies(); return null; }
public static PABCNETCodeCompletionWindow ShowCompletionWindow(Form parent, TextEditorControl control, string fileName, ICompletionDataProvider completionDataProvider, char firstChar, bool visibleKeyPressed, bool is_by_dot,PascalABCCompiler.Parsers.KeywordKind keyw) { ICompletionData[] completionData = (completionDataProvider as VisualPascalABC.CodeCompletionProvider).GenerateCompletionDataWithKeyword(fileName, control.ActiveTextAreaControl.TextArea, firstChar, keyw); if (completionData == null || completionData.Length == 0) { return null; } PABCNETCodeCompletionWindow codeCompletionWindow = new PABCNETCodeCompletionWindow(completionDataProvider, completionData, parent, control, visibleKeyPressed, is_by_dot); codeCompletionWindow.ShowCompletionWindow(); return codeCompletionWindow; }
static void RestoreSymbols(SymbolInfo si, PascalABCCompiler.TreeRealization.wrapped_definition_node wdn, string name) { if (wdn.is_synonim) si.sym_info = wdn.PCUReader.CreateTypeSynonim(wdn.offset, name); else if (si.scope is ClassScope) si.sym_info = wdn.PCUReader.CreateInterfaceInClassMember(wdn.offset, name); else si.sym_info = wdn.PCUReader.CreateImplementationMember(wdn.offset, false); }
public static PABCNETCodeCompletionWindow ShowCompletionWindowWithFirstChar(Form parent, TextEditorControl control, string fileName, ICompletionDataProvider completionDataProvider, char firstChar, PascalABCCompiler.Parsers.KeywordKind keyw) { ICompletionData[] completionData = (completionDataProvider as VisualPascalABC.CodeCompletionProvider).GenerateCompletionDataByFirstChar(fileName, control.ActiveTextAreaControl.TextArea, firstChar, keyw); if (completionData == null || completionData.Length == 0) { return null; } (completionDataProvider as VisualPascalABC.CodeCompletionProvider).preSelection = firstChar.ToString(); PABCNETCodeCompletionWindow codeCompletionWindow = new PABCNETCodeCompletionWindow(completionDataProvider, completionData, parent, control, true, false); codeCompletionWindow.ShowCompletionWindow(); return codeCompletionWindow; }
public SymbolsViwer(ListView listView, ImageList imageList, bool showInThread, VisualPascalABCPlugins.InvokeDegegate beginInvoke, PascalABCCompiler.SourceFilesProviderDelegate sourceFilesProvider, VisualEnvironmentCompiler.ExecuteSourceLocationActionDelegate ExecuteSourceLocationAction) { this.listView = listView; this.imageList = imageList; this.showInThread = showInThread; this.beginInvoke = beginInvoke; this.sourceFilesProvider = sourceFilesProvider; this.ExecuteSourceLocationAction = ExecuteSourceLocationAction; listView.MouseDoubleClick += new MouseEventHandler(listView_MouseDoubleClick); }
public NetScope(PascalABCCompiler.TreeRealization.using_namespace_list unar,System.Reflection.Assembly assembly, SymbolTable.TreeConverterSymbolTable tcst) : base(tcst) { _unar=unar; _assembly=assembly; UnitTypes = NetHelper.init_namespaces(assembly); if (UnitTypes.Count > 0) { entry_type = GetEntryType(); } _tcst=tcst; }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: BuildButtonsEnabled = false; this.Refresh(); break; case PascalABCCompiler.CompilerState.CompilationFinished: ShowTree(); BuildButtonsEnabled = true; break; } }
//TODO: Исправить коллекцию модулей. public PascalABCCompiler.TreeRealization.common_unit_node CompileInterface(SyntaxTree.compilation_unit SyntaxUnit, PascalABCCompiler.TreeRealization.unit_node_list UsedUnits, List<Errors.Error> ErrorsList, List<Errors.CompilerWarning> WarningsList, PascalABCCompiler.Errors.SyntaxError parser_error, System.Collections.Hashtable bad_nodes, TreeRealization.using_namespace_list namespaces, Dictionary<SyntaxTree.syntax_tree_node,string> docs, bool debug, bool debugging) { //convertion_data_and_alghoritms.__i = 0; stv.parser_error=parser_error; stv.bad_nodes_in_syntax_tree = bad_nodes; stv.referenced_units=UsedUnits; //stv.comp_units=UsedUnits; //stv.visit(SyntaxUnit //stv.interface_using_list = namespaces; stv.using_list.clear(); stv.interface_using_list.clear(); stv.using_list.AddRange(namespaces); stv.current_document = new TreeRealization.document(SyntaxUnit.file_name); stv.ErrorsList = ErrorsList; stv.WarningsList = WarningsList; stv.SymbolTable.CaseSensitive = SemanticRules.SymbolTableCaseSensitive; stv.docs = docs; stv.debug = debug; stv.debugging = debugging; SystemLibrary.SystemLibrary.syn_visitor = stv; SetSemanticRules(SyntaxUnit); foreach (SyntaxTree.compiler_directive cd in SyntaxUnit.compiler_directives) cd.visit(stv); stv.DirectivesToNodesLinks = CompilerDirectivesToSyntaxTreeNodesLinker.BuildLinks(SyntaxUnit, ErrorsList); //MikhailoMMX добавил передачу списка ошибок (02.10.10) SyntaxUnit.visit(stv); /*SyntaxTree.program_module pmod=SyntaxUnit as SyntaxTree.program_module; if (pmod!=null) { stv.visit(pmod); } else { SyntaxTree.unit_module umod=SyntaxUnit as SyntaxTree.unit_module; if (umod==null) { throw new PascalABCCompiler.TreeConverter.CompilerInternalError("Undefined module type (not program and not unit)"); } stv.visit(umod); }*/ //stv.visit(SyntaxUnit); //if (ErrorsList.Count>0) throw ErrorsList[0]; return stv.compiled_unit; }
public UnexpectedToken(PascalABCCompiler.ParserTools.GPBParser parser) : base("", parser.current_file_name, parser.parsertools.GetTokenSourceContext(parser.LRParser), (syntax_tree_node)parser.prev_node) { List<GoldParser.Symbol> Symbols = parser.parsertools.GetPrioritySymbols(parser.LRParser.GetExpectedTokens()); if (Symbols.Count == 1) { string OneSybmolText = "ONE_" + Symbols[0].Name.ToUpper(); string LocOneSybmolText = StringResources.Get(OneSybmolText); if (LocOneSybmolText != OneSybmolText) { _message = string.Format(LocOneSybmolText); return; } } _message = string.Format(StringResources.Get("EXPECTED{0}"), PascalABCCompiler.FormatTools.ObjectsToString(parser.parsertools.SymbolsToStrings(Symbols.ToArray()), ",")); }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { States += State.ToString(); if (FileName != null) States += " "+System.IO.Path.GetFileName(FileName); States += Environment.NewLine; switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: FileNames.Clear(); States = ""; break; case PascalABCCompiler.CompilerState.BeginCompileFile: FileNames.Add(FileName); break; case PascalABCCompiler.CompilerState.ReadPCUFile: FileNames.Add(FileName); FileNames.Add(System.IO.Path.ChangeExtension(FileName,".pas")); break; case PascalABCCompiler.CompilerState.Ready: foreach (PascalABCCompiler.Errors.Error error in VisualEnvironmentCompiler.Compiler.ErrorsList) if (error is PascalABCCompiler.Errors.CompilerInternalError) { ReportText = DateTime.Now.ToString() + Environment.NewLine; ReportText += GetInfo()+Environment.NewLine; ReportText += "StatesList: " + Environment.NewLine + States + Environment.NewLine; for (int i = 0; i < VisualEnvironmentCompiler.Compiler.ErrorsList.Count; i++) ReportText += string.Format("Error[{0}]: {1}{2}", i, VisualEnvironmentCompiler.Compiler.ErrorsList[i].ToString(),Environment.NewLine); CompilerInternalErrorReport.ErrorMessage.Text = error.ToString(); CompilerInternalErrorReport.ReportText = ReportText; CompilerInternalErrorReport.FileNames = FileNames; CompilerInternalErrorReport.VEC = VisualEnvironmentCompiler; CompilerInternalErrorReport.ShowDialog(); return; } break; } }
//kompilacija proekta public string Compile(PascalABCCompiler.IProjectInfo project, bool rebuild, string RuntimeServicesModule, bool ForRun, bool RunWithEnvironment) { ProjectService.SaveProject(); Workbench.WidgetController.CompilingButtonsEnabled = false; Workbench.CompilerConsoleWindow.ClearConsole(); CompilerOptions1.SourceFileName = project.Path; CompilerOptions1.OutputDirectory = project.OutputDirectory; CompilerOptions1.ProjectCompiled = true; if (project.ProjectType == PascalABCCompiler.ProjectType.WindowsApp) CompilerOptions1.OutputFileType = PascalABCCompiler.CompilerOptions.OutputType.WindowsApplication; ErrorsList.Clear(); CompilerOptions1.Rebuild = rebuild; CompilerOptions1.Locale = PascalABCCompiler.StringResourcesLanguage.CurrentTwoLetterISO; CompilerOptions1.UseDllForSystemUnits = false; CompilerOptions1.RunWithEnvironment = RunWithEnvironment; bool savePCU = Workbench.VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate; if (Path.GetDirectoryName(CompilerOptions1.SourceFileName).ToLower() == ((string)WorkbenchStorage.StandartDirectories[Constants.LibSourceDirectoryIdent]).ToLower()) Workbench.VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate = false; if (RuntimeServicesModule != null) CompilerOptions1.StandartModules.Add(new PascalABCCompiler.CompilerOptions.StandartModule(RuntimeServicesModule, PascalABCCompiler.CompilerOptions.StandartModuleAddMethod.RightToMain, PascalABCCompiler.SyntaxTree.LanguageId.C | PascalABCCompiler.SyntaxTree.LanguageId.PascalABCNET | PascalABCCompiler.SyntaxTree.LanguageId.CommonLanguage)); string ofn = Workbench.VisualEnvironmentCompiler.Compile(CompilerOptions1); Workbench.VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate = savePCU; if (RuntimeServicesModule != null) CompilerOptions1.RemoveStandartModuleAtIndex(CompilerOptions1.StandartModules.Count - 1); if (Workbench.VisualEnvironmentCompiler.Compiler.ErrorsList.Count != 0 || Workbench.VisualEnvironmentCompiler.Compiler.Warnings.Count != 0) { List<PascalABCCompiler.Errors.Error> ErrorsAndWarnings = new List<PascalABCCompiler.Errors.Error>(); List<PascalABCCompiler.Errors.Error> Errors = Workbench.ErrorsManager.CreateErrorsList(Workbench.VisualEnvironmentCompiler.Compiler.ErrorsList); AddErrors(ErrorsAndWarnings, Errors); //if (!ForRun) AddWarnings(ErrorsAndWarnings, Workbench.VisualEnvironmentCompiler.Compiler.Warnings); Workbench.ErrorsListWindow.ShowErrorsSync(ErrorsAndWarnings, Errors.Count != 0 || (Workbench.VisualEnvironmentCompiler.Compiler.Warnings.Count != 0 && !ForRun)); } return ofn; }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { string text; if (State == PascalABCCompiler.CompilerState.CompilationStarting || State == PascalABCCompiler.CompilerState.Reloading) { //CompilerConsole.Clear(); dt = DateTime.Now; if (OnRebuld.Checked) VisualEnvironmentCompiler.Compiler.CompilerOptions.Rebuild = true; } text = State.ToString(); if (FileName != null) text += " " + System.IO.Path.GetFileName(FileName) + "..."; if (State == PascalABCCompiler.CompilerState.Ready) { if (VisualEnvironmentCompiler.Compiler.ErrorsList.Count > 0) text += string.Format(" [{0} errors]", VisualEnvironmentCompiler.Compiler.ErrorsList.Count); text += string.Format(" [{0}ms]", (int)(DateTime.Now - dt).TotalMilliseconds); if (sender == VisualEnvironmentCompiler.RemoteCompiler) text += string.Format(Environment.NewLine+"WorkingSet {0}", VisualEnvironmentCompiler.RemoteCompiler.RemoteCompilerWorkingSet/1024/1024); NoSavePCU.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate; NoSemantic.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.SemanticAnalysis; NoCodeGeneration.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.CodeGeneration; NoAddStandartUnits.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.AddStandartUnits; NoSkipPCUErrors.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.SkipPCUErrors; NoSkipInternalErrorsIfSyntaxTreeIsCorrupt.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.SkipInternalErrorsIfSyntaxTreeIsCorrupt; NoIncludeDebugInfoInPCU.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.IncludeDebugInfoInPCU; cbUseStandarParserForInellisense.Checked = VisualEnvironmentCompiler.Compiler.InternalDebug.UseStandarParserForIntellisense; //OnRebuld.Checked = VisualEnvironmentCompiler.Compiler.CompilerOptions.Rebuild; } text += Environment.NewLine; if (sender.CompilerType == PascalABCCompiler.CompilerType.Remote) text = "[remote]" + text; CompilerConsole.AppendText(text); CompilerConsole.SelectionStart = CompilerConsole.Text.Length; CompilerConsole.ScrollToCaret(); }
public void LoadProject(string projectName, PascalABCCompiler.IProjectInfo project) { TreeNode proj_tn = this.tvProjectExplorer.Nodes.Add(Form1StringResources.Get("MR_PROJECT")+" "+projectName); ProjectNode = proj_tn; project_item_nodes.Add(proj_tn); proj_tn.ImageIndex = ProjectImageIndex; proj_tn.SelectedImageIndex = ProjectImageIndex; TreeNode ref_tn = proj_tn.Nodes.Add(Form1StringResources.Get("PRJ_PROJECT_REFERENCES")); ReferencesNode = ref_tn; reference_nodes.Add(ref_tn); ref_tn.ImageIndex = ClosedReferencesImageIndex; foreach (PascalABCCompiler.IFileInfo fi in project.SourceFiles) { TreeNode tn = proj_tn.Nodes.Add(fi.Name); tn.ImageIndex = SourceFileImageIndex; tn.SelectedImageIndex = SourceFileImageIndex; items[tn] = fi; if (VisualPABCSingleton.MainForm.IsForm(fi.Path)) { tn.ImageIndex = FormImageIndex; tn.SelectedImageIndex = FormImageIndex; NodeInfo ni = new NodeInfo(); ni.IsForm = true; tn.Tag = ni; } source_item_nodes.Add(tn); } foreach (PascalABCCompiler.IReferenceInfo ri in project.References) { TreeNode tn = ref_tn.Nodes.Add(ri.AssemblyName); tn.ImageIndex = ReferenceImageIndex; tn.SelectedImageIndex = ReferenceImageIndex; items[tn] = ri; reference_item_nodes.Add(tn); } proj_tn.Expand(); }
public void SelectAppType(PascalABCCompiler.CompilerOptions.OutputType outputType) { Image img=null; foreach (ToolStripMenuItem mi in tstaSelect.DropDownItems) if (outputType == (PascalABCCompiler.CompilerOptions.OutputType)mi.Tag) img = mi.Image; tstaSelect.Image = img; CompilerOptions1.OutputFileType = outputType; }
internal void ExecuteErrorPos(PascalABCCompiler.SourceLocation sl) { ExecuteSourceLocationAction(sl, ErrorCursorPosStrategy); }
public void ExecuteSourceLocationAction(PascalABCCompiler.SourceLocation SourceLocation,VisualPascalABCPlugins.SourceLocationAction Action) { if (SourceLocation.FileName!=null) OpenFile(SourceLocation.FileName); ICSharpCode.TextEditor.TextEditorControl editor = CurrentSyntaxEditor.OwnEdit; Point Beg = new Point(SourceLocation.BeginPosition.Column - 1, SourceLocation.BeginPosition.Line - 1); Point End = new Point(SourceLocation.EndPosition.Column, SourceLocation.EndPosition.Line - 1); switch (Action) { case SourceLocationAction.SelectAndGotoBeg: case SourceLocationAction.SelectAndGotoEnd: if (Action == SourceLocationAction.SelectAndGotoBeg) editor.ActiveTextAreaControl.Caret.Position = Beg; else editor.ActiveTextAreaControl.Caret.Position = End; editor.ActiveTextAreaControl.SelectionManager.SetSelection(Beg,End); SetFocusToEditor(); break; case SourceLocationAction.GotoBeg: case SourceLocationAction.GotoEnd: if (Action == SourceLocationAction.GotoBeg) editor.ActiveTextAreaControl.Caret.Position = Beg; else editor.ActiveTextAreaControl.Caret.Position = End; SetFocusToEditor(); break; } CurrentSyntaxEditor.CenterView(); }
private static void ChangeCompilerState(ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { switch (State) { case CompilerState.ParserConnected: Console.WriteLine(string.Format(StringResourcesGet("CONNECTED_PARSER{0}"),sender.ParsersController.LastParser)); return; } if (DetailOut) { Console.ForegroundColor = ConsoleColor.Gray; if (FileName != null) { FileName = string.Format("[{0}]{1} {2}...", Math.Round((DateTime.Now - StartTime).TotalMilliseconds), State, System.IO.Path.GetFileName(FileName)); StartTime = DateTime.Now; Console.WriteLine(FileName); //Console.Title = FileName; } else { Console.WriteLine(string.Format("{0}.", State)); //Console.Title = State.ToString(); } } }
void Compiler_OnChangeCompilerStateSync(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { if(this.Visible) BeginInvoke(new OnChangeCompilerStateDelegate(Compiler_OnChangeCompilerState), sender, State, FileName); }
public void Add(PascalABCCompiler.Parsers.SymInfo si, ICompletionData data) { if (!dict.ContainsKey(si)) dict[si] = data; }
public ICompletionData[] GenerateCompletionDataByFirstChar(string fileName, TextArea textArea, char charTyped, PascalABCCompiler.Parsers.KeywordKind keyw) { controller = new CodeCompletion.CodeCompletionController(); int off = textArea.Caret.Offset; string text = textArea.Document.TextContent.Substring(0, textArea.Caret.Offset); //controller.Compile(fileName, text /*+ ")))));end."*/); FileName = fileName; Text = text; //System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ThreadStart(CompileInThread)); //th.Start(); //while (th.ThreadState == System.Threading.ThreadState.Running) {} ICompletionData[] data = GetCompletionDataByFirst(off, text, textArea.Caret.Line, textArea.Caret.Column, charTyped, keyw); CodeCompletion.AssemblyDocCache.CompleteDocumentation(); CodeCompletion.UnitDocCache.CompleteDocumentation(); controller = null; //GC.Collect(); return data; }