/// <summary> /// Loads this object's property values from current project. /// </summary> protected override void BindProperties() { assemblyName = ProjectMgr.GetProjectProperty(PropertyTag.AssemblyName.ToString(), true); defaultNamespace = ProjectMgr.GetProjectProperty(PropertyTag.DefaultNamespace.ToString(), true); string strTargetPlatform = ProjectMgr.GetProjectProperty(PropertyTag.TargetPlatform.ToString(), true); if (strTargetPlatform != null && strTargetPlatform.Length > 0) { try { targetPlatform = (TargetPlatform)Enum.Parse(typeof(TargetPlatform), strTargetPlatform); } catch (ArgumentException) { /* TODO: Default value? */ } } string strDynOption = ProjectMgr.GetProjectProperty(PropertyTag.DynVarOption.ToString(), true); if (strDynOption != null && strDynOption.Length > 0) { try { dynVarOption = (DynVarOption)Enum.Parse(typeof(DynVarOption), strDynOption); } catch (ArgumentException) { /* TODO: Default value? */ } } }
public void checkProjectIcon() { string dynVarOption = GetProjectProperty(PropertyTag.DynVarOption.ToString()); DynVarOption option = (DynVarOption)Enum.Parse(typeof(DynVarOption), dynVarOption); switch (option) { case DynVarOption.Managed: imageOffset = initOffset; break; case DynVarOption.EverythingStatic: imageOffset = initOffset + 1; break; case DynVarOption.EverythingDynamic: imageOffset = initOffset + 2; break; default: break; } this.ReDraw(UIHierarchyElement.Icon); }
public DynVarOption getDynamismMode() { string dynVarOption = GetProjectProperty(PropertyTag.DynVarOption.ToString()); DynVarOption option = (DynVarOption)Enum.Parse(typeof(DynVarOption), dynVarOption); return(option); }
//void _buffer_Changed(object sender, TextContentChangedEventArgs e) //{ // if (e.After != _buffer.CurrentSnapshot) // return; // OnTagsChanged(new SnapshotSpan(_buffer.CurrentSnapshot, 0, _buffer.CurrentSnapshot.Length)); //} //void OnTagsChanged(SnapshotSpan span) //{ // if (TagsChanged != null) // TagsChanged(this, new SnapshotSpanEventArgs(span)); //} public IEnumerable <ITagSpan <StaDynTokenTag> > GetTags(NormalizedSnapshotSpanCollection spans) { var currentFile = ProjectFileAST.Instance.getAstFile(FileUtilities.Instance.getCurrentOpenDocumentFilePath()); //Get the compileMode string dynOption = StaDyn.StaDynProject.ProjectConfiguration.Instance.GetProperty(PropertyTag.DynVarOption.ToString()); DynVarOption compileMode = (DynVarOption)Enum.Parse(typeof(DynVarOption), dynOption); foreach (SnapshotSpan curSpan in spans) { ITextSnapshotLine containingLine = curSpan.Start.GetContainingLine(); int curLoc = containingLine.Start.Position; int charsMatched = 0; int currentPositionInLine = 1; string tokenText = null; lexer = new StaDynLexer(containingLine.GetText()); while (curLoc < containingLine.End) { IToken StaDynToken = null; try { StaDynToken = lexer.nextToken(); } catch (Exception e) { } if (StaDynToken == null) { break; } tokenText = StaDynToken.getText(); if (!string.IsNullOrEmpty(tokenText)) { charsMatched = StaDynToken.getText().Length; currentPositionInLine += StaDynToken.getText().Length; } else { charsMatched = 0; } //Sets the line number StaDynToken.setLine(containingLine.LineNumber); StaDynToken.setColumn(currentPositionInLine); StaDynTokenTypes tokenType = lexer.getTokenType(StaDynToken.Type); //Check if the current token its a type //Needed for highlighting if (tokenType == StaDynTokenTypes.Identifier && StaDynTypeTableFunctions.Instance.CheckTokenTypeOnCurrentDocument(StaDynToken)) { tokenType = StaDynTokenTypes.TypeDefinition; } //If the compile mode is set to EverythingDynamic //We hace to check wich AST identifires are varibales declared by user //And then check if can ve dynamic else if (tokenType == StaDynTokenTypes.Identifier && compileMode == DynVarOption.EverythingDynamic) { if (currentFile == null) { break; } StaDynLanguage.Visitors.StaDynVariablesInScopeTable infoVariablesInScope = StaDynLanguage.Intellisense.StaDynIntellisenseHelper.Instance.getVariablesInCurrentScope(StaDynToken.getLine(), StaDynToken.getColumn(), _buffer.CurrentSnapshot, 0, false); for (int i = 0; i < infoVariablesInScope.Table.Count; i++) { if (infoVariablesInScope.Table[i].Count > 0) { foreach (KeyValuePair <string, AST.IdDeclaration> variable in infoVariablesInScope.Table[i]) { if (variable.Key == tokenText && variable.Value.Symbol != null) { //Only identifiers declared as var //HACK: Harcoded the "[Var if (variable.Value.Symbol.SymbolType.FullName.StartsWith("[Var")) { tokenType = StaDynTokenTypes.DynamicVar; break; } } } } } } //Atmanaged compile mode //Check if the current token its a dynamicVar //Needed for highlighting else if (tokenType == StaDynTokenTypes.Identifier && StaDynDynamicHelper.Instance.checkDynamicVar(StaDynToken.getText(), StaDynToken.getLine(), StaDynToken.getColumn(), currentFile) && compileMode == DynVarOption.Managed) { tokenType = StaDynTokenTypes.DynamicVar; } var tokenSpan = new SnapshotSpan(curSpan.Snapshot, new Span(curLoc, charsMatched)); if (tokenSpan.IntersectsWith(curSpan)) { yield return(new TagSpan <StaDynTokenTag>(tokenSpan, new StaDynTokenTag(tokenType, StaDynToken))); } curLoc += charsMatched; } } }
/// <summary> /// Execute the Build task. This will call the Inference compiler passing the files obtained in the /// Files property of this task and other received arguments. /// </summary> /// <remarks> /// Error log is stored in: [OutputPath]\ErrorLog.txt /// Type table log is stored in: [OutputPath]\TypeTable.txt /// </remarks> /// <returns>true if succesful.</returns> public override bool Execute() { if (files.Length == 0) { return(false); } string outputPath = ProjectConfiguration.Instance.GetProperty(PropertyTag.OutputPath.ToString()); if (!Path.IsPathRooted(outputPath)) { outputPath = Path.Combine(ProjectConfiguration.Instance.GetActiveProjectFilePath(), outputPath); } string debugFilesPath = outputPath; string typeTableFileName = Path.Combine(outputPath, Resources.TypeTable); //string ilasmFileName = Path.Combine(ProjectConfiguration.Instance.GetProperty("LibPath"), Resources.Ilasm); string ilasmFileName = Path.Combine(ProjectConfiguration.Instance.GetProperty("StaDynPath"), Resources.Ilasm); ErrorManager.Instance.LogFileName = Path.Combine(outputPath, Resources.ErrorLog); ErrorManager.Instance.Clear(); StaDynLanguage.Errors.ErrorPresenter.Instance.ClearErrors(); TargetPlatform targetPlatform = (TargetPlatform)Enum.Parse(typeof(TargetPlatform), Target); DynVarOption option = (DynVarOption)Enum.Parse(typeof(DynVarOption), DynVarOption); DynVarOptions.Instance.EverythingDynamic = option == StaDynLanguage_Project.DynVarOption.EverythingDynamic; DynVarOptions.Instance.EverythingStatic = option == StaDynLanguage_Project.DynVarOption.EverythingStatic; Program app = new Program(); Program.ClearMemory(); IDictionary <string, string> dictionary = new Dictionary <string, string>(); string directory = Path.GetDirectoryName(outputPath); //req.FileName.Remove(req.FileName.Length - ast.Location.FileName.Length); IDictionary <string, string> name = new Dictionary <string, string>(); //name.Add(outputPath, directory); //app.LoadFile(new FileInfo(ProjectConfiguration.Instance.GetActiveProjectFilePath()), dictionary); foreach (string file in Files) { var fileInfo = new FileInfo(file); app.LoadFile(fileInfo, dictionary); name.Add(fileInfo.FullName, directory); } string fileName = Path.GetFileName(outputFileName); string target = Path.Combine(outputPath, fileName); //app.Run(name, target + ".exe", debugFilesPath, ilasmFileName, typeTableFileName, targetPlatform, false); //app.Run(dictionary, OutputFileName + ".exe", debugFilesPath, typeTableFileName, ilasmFileName, targetPlatform, false); //app.Run(dictionary, null, debugFilesPath, typeTableFileName, null, targetPlatform, false); DirectoryInfo outputDir = new DirectoryInfo(outputPath); if (!outputDir.Exists) { outputDir.Create(); } if (ErrorManager.Instance.ErrorFound) { handleErrors(); return(false); } else { //app.Run(dictionary, OutputFileName + Resources.ExecutableExt, debugFilesPath, typeTableFileName, ilasmFileName, targetPlatform, false); app.Run(name, target + ".exe", debugFilesPath, ilasmFileName, typeTableFileName, targetPlatform, false); } if (ErrorManager.Instance.ErrorFound) { handleErrors(); return(false); } return(true); }