void FillMembersComboBox()
        {
            ArrayList  items = new ArrayList();
            IBaseScope scope = GetCurrentSelectedClass();

            if (scope == null)
            {
                GetGlobalUnitMembers(items);
                //items.Sort(0,items.Count,new Comparer(System.Globalization.CultureInfo.InvariantCulture));
            }
            else
            {
                GetClassMembers(scope, items);
                //items.Sort(0,items.Count,new Comparer(System.Globalization.CultureInfo.InvariantCulture));
            }
            if (NeedtoUpdate(items, membersComboBox))
            {
                membersComboBox.Invoke(new Invoke_del(Member_Invoke_Update));
                membersComboBox.Invoke(new Invoke_del(Member_Invoke_Clear));
                //membersComboBox.Items.AddRange(items.ToArray());
                membersComboBox.Invoke(new Invoke_param_del(AddItemsToMembersComboboxInternal), items);
                UpdateMembersComboBox();
                membersComboBox.Invoke(new Invoke_del(Member_Invoke_EndUpdate));
            }
            else
            {
                membersComboBox.Invoke(new Invoke_del(Member_Invoke_Update));
                UpdateMembersComboBox();
                membersComboBox.Invoke(new Invoke_del(Member_Invoke_EndUpdate));
            }
        }
Esempio n. 2
0
 public ReferenceFinder(IBaseScope founded_scope, IBaseScope entry_scope, compilation_unit cu, string FileName, bool for_refactoring)
 {
     this.founded_scope = founded_scope;
     this.entry_scope = entry_scope;
     this.cur_scope = entry_scope;
     this.pos_list = new List<Position>();
     this.cu = cu;
     this.FileName = FileName;
     this.for_refactoring = for_refactoring;
 }
        private List <SymbolsViewerSymbol> InternalFindReferences(string fname, PascalABCCompiler.SyntaxTree.expression expr, int line, int col, bool for_refact)
        {
            List <PascalABCCompiler.Parsers.Position> lst = new List <PascalABCCompiler.Parsers.Position>();
            List <SymbolsViewerSymbol> svs_lst            = new List <SymbolsViewerSymbol>();

            try
            {
                CodeCompletion.DomConverter dc = CodeCompletion.CodeCompletionController.comp_modules[fname] as CodeCompletion.DomConverter;
                IBaseScope fnd_scope           = null;
                IBaseScope cur_sc = null;
                if (dc != null)
                {
                    fnd_scope = dc.GetSymDefinition(expr, line, col, keyword);
                    cur_sc    = dc.FindScopeByLocation(line, col);
                }
                if (fnd_scope != null)
                {
                    foreach (string FileName in CodeCompletionParserController.open_files.Keys)
                    {
                        CodeCompletion.CodeCompletionController controller = new CodeCompletion.CodeCompletionController();
                        string text = VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.SourceFilesProvider(FileName, PascalABCCompiler.SourceFileOperation.GetText) as string;
                        PascalABCCompiler.SyntaxTree.compilation_unit cu = controller.ParseOnlySyntaxTree(FileName, text);
                        if (cu != null)
                        {
                            dc = CodeCompletion.CodeCompletionController.comp_modules[FileName] as CodeCompletion.DomConverter;
                            CodeCompletion.ReferenceFinder rf = null;
                            if (dc != null && dc.visitor.entry_scope != null)
                            {
                                rf = new CodeCompletion.ReferenceFinder(fnd_scope, dc.visitor.entry_scope, cu, FileName, for_refact);
                                lst.AddRange(rf.FindPositions());
                            }
                        }
                    }
                    PascalABCCompiler.Parsers.Position p = fnd_scope.GetPosition();
                    bool need_add_def = !for_refact; // true
                    if (p.file_name != null && need_add_def)
                    {
                        svs_lst.Add(new SymbolsViewerSymbol(new PascalABCCompiler.SourceLocation(p.file_name, p.line, p.column, p.end_line, p.end_column), ImagesProvider.GetPictureNum(fnd_scope.SymbolInfo)));
                    }
                    foreach (PascalABCCompiler.Parsers.Position pos in lst)
                    {
                        if (pos.file_name != null)
                        {
                            svs_lst.Add(new SymbolsViewerSymbol(new PascalABCCompiler.SourceLocation(pos.file_name, pos.line, pos.column, pos.end_line, pos.end_column), ImagesProvider.IconNumberGotoText));
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
            GC.Collect();
            return(svs_lst);
            //return svs_lst.ToArray();
        }
Esempio n. 4
0
 public override void visit(statement_list _statement_list)
 {
     if (_statement_list == null || _statement_list.source_context == null) return;
     IBaseScope tmp = cur_scope;
     cur_scope = entry_scope.FindScopeByLocation(_statement_list.source_context.begin_position.line_num, _statement_list.source_context.begin_position.column_num);
     if (cur_scope == null)
         cur_scope = tmp;
     foreach (statement stmt in _statement_list.subnodes)
         stmt.visit(this);
     cur_scope = tmp;
 }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         this.textAreaControl.ActiveTextAreaControl.Caret.PositionChanged -= new EventHandler(CaretPositionChanged);
         this.membersComboBox.Dispose();
         this.classComboBox.Dispose();
         this.currentCompilationUnit = null;
         th.Abort();
     }
     base.Dispose(disposing);
 }
 public ComboBoxItem(IBaseScope item, string text, int iconIndex, bool isInCurrentPart, bool is_global)
 {
     this.item = item;
     if (item != null)
     {
         pos = item.GetPosition();
     }
     this.text            = text;
     this.iconIndex       = iconIndex;
     this.isInCurrentPart = true;
     this.is_global       = is_global;
 }
        void ChangeInternal()
        {
            bool first_comp;
            ICodeCompletionDomConverter dconv = null;
            bool tmp = true;

            while (true)
            {
                first_comp = false;
                if (this.Visible)
                {
                    try
                    {
                        if (currentCompilationUnit == null && textAreaControl.FileName != null)
                        {
                            dconv = WorkbenchServiceFactory.CodeCompletionParserController.GetConverter(textAreaControl.FileName);
                            if (dconv != null && dconv.IsCompiled)
                            {
                                currentCompilationUnit = dconv.EntryScope;
                                first_comp             = true;
                            }
                            if (clicked || tmp)
                            {
                                FillClassComboBox(true);
                                //clicked = false;
                                tmp = false;
                            }
                        }
                        if (currentCompilationUnit != null && (clicked || first_comp))
                        {
                            dconv = WorkbenchServiceFactory.CodeCompletionParserController.GetConverter(textAreaControl.FileName);
                            if (dconv != null && dconv.IsCompiled)
                            {
                                currentCompilationUnit = dconv.EntryScope;
                                FillClassComboBox(true);
                            }
                        }
                        //lock(clicked)
                        {
                            clicked = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        //MessageService.ShowError(ex);
                    }
                }
                Thread.Sleep(300);
            }
        }
        void GetClassMembers(IBaseScope scope, ArrayList items)
        {
            if (scope != null && scope.Members != null)
            {
                ArrayList meths  = new ArrayList();
                ArrayList fields = new ArrayList();
                ArrayList events = new ArrayList();
                ArrayList vars   = new ArrayList();
                ArrayList props  = new ArrayList();
                ArrayList consts = new ArrayList();
                foreach (IBaseScope el in scope.Members)
                {
                    if (el.GetPosition().file_name != null)
                    {
                        ComboBoxItem cbi = new ComboBoxItem(el, el.GetDescriptionWithoutDoc(), CodeCompletionProvider.ImagesProvider.GetPictureNum(el.SymbolInfo), true, false);
                        switch (el.SymbolInfo.kind)
                        {
                        case SymbolKind.Method: meths.Add(cbi); break;

                        case SymbolKind.Field: fields.Add(cbi); break;

                        case SymbolKind.Property: props.Add(cbi); break;

                        case SymbolKind.Variable: vars.Add(cbi); break;

                        case SymbolKind.Event: events.Add(cbi); break;

                        case SymbolKind.Constant: consts.Add(cbi); break;
                        }
                        //items.Add(new ComboBoxItem(el,el.GetDescriptionWithoutDoc(),CodeCompletionProvider.ImagesProvider.GetPictureNum(el.si),true));
                    }
                }
                meths.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
                items.AddRange(meths);
                props.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
                items.AddRange(props);
                fields.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
                items.AddRange(fields);
                vars.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
                items.AddRange(vars);
                consts.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
                items.AddRange(consts);
                events.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
                items.AddRange(events);
            }
        }
Esempio n. 9
0
        public BaseController(IBaseScope <T> scope, BaseService <T> service, Sce sce)
        {
            this.scope          = scope;
            this.service        = service;
            this.sce            = sce;
            this.scope.message  = null;
            this.scope.list     = null;
            this.scope.gridOpts = new GridOptions
            {
                data            = "list",
                pagingPageSize  = this.pageSize,
                pagingPageSizes = new List <int> {
                    10, 15, 20, 30, 50, 100, 500, 1000
                },
                useExternalPaging = true
            };
            this.scope.isGrid     = false;
            this.scope.gridAction = new GridActionExternalScope
            {
                EditAction   = row => { this.scope.model = this.OnPreLoadForm(row.entity); this.scope.isGrid = true; this.isNewItem = false; },
                RemoveAction = row => { if (confirm("Are you sure?"))
                                        {
                                            this.Delete(row.entity);
                                        }
                }
            };

            /*$
             *  this.scope.model ={ };
             *  this.scope.TrustAsHtml=this.TrustAsHtml.bind(this);
             *  this.scope.createNewItem=this.createNewItem.bind(this);
             *  this.scope.submitForm=this.submitForm.bind(this);
             *  toastr.options.extendedTimeOut = 1000;
             *  toastr.options.timeOut = 1000;
             *  toastr.options.fadeOut = 250;
             *  toastr.options.fadeIn = 250;
             *  toastr.options.positionClass = "toast-top-center";
             * $*/
        }
Esempio n. 10
0
 public override void visit(class_definition _class_definition)
 {
     IBaseScope tmp = cur_scope;
     cur_scope = entry_scope.FindScopeByLocation(_class_definition.source_context.begin_position.line_num, _class_definition.source_context.begin_position.column_num);
     if (_class_definition.class_parents != null)
         _class_definition.class_parents.visit(this);
     if (_class_definition.body != null)
         _class_definition.body.visit(this);
     cur_scope = tmp;
 }
Esempio n. 11
0
 public override void visit(with_statement _with_statement)
 {
     IBaseScope tmp = cur_scope;
     cur_scope = entry_scope.FindScopeByLocation(_with_statement.source_context.begin_position.line_num, _with_statement.source_context.begin_position.column_num);
     if (cur_scope == null)
         cur_scope = tmp;
     if (_with_statement.do_with != null)
         _with_statement.do_with.visit(this);
     if (_with_statement.what_do != null)
         _with_statement.what_do.visit(this);
     cur_scope = tmp;
 }
Esempio n. 12
0
 public override void visit(dot_node _dot_node)
 {
     _dot_node.left.visit(this);
     if (ret_tn != null)
     {
         IBaseScope left_scope = ret_tn;
         if (_dot_node.right is ident)
         {
             ret_tn = ret_tn.FindNameOnlyInType((_dot_node.right as ident).name);
         }
     }
     if (ret_tn != null && ret_tn.IsEqual(founded_scope))
         pos_list.Add(get_position(_dot_node.right));
 }
		protected virtual string GetTopScopeName(IBaseScope sc)
		{
			if (sc == null) return "";
			if (sc.Name == "" || sc.Name.Contains("$") || sc.Name == "PABCSystem") return "";
			if (sc is IProcScope) return "";
			if (sc is ITypeScope)
			{
				return sc.Name+((sc as ITypeScope).TemplateArguments != null?"<>":"")+".";
			}
			return sc.Name + ".";
		}
Esempio n. 14
0
 public override void visit(inherited_ident _inherited_ident)
 {
     ret_tn = cur_scope.FindNameInAnyOrder(_inherited_ident.name);
     if (ret_tn != null && ret_tn.IsEqual(founded_scope))
         pos_list.Add(get_position(_inherited_ident));
 }
		public virtual string GetSimpleDescription(IBaseScope scope)
		{
			if (scope == null)
				return "";
			switch (scope.Kind)
			{
				case ScopeKind.Delegate : 
				case ScopeKind.Array :
				case ScopeKind.Diapason : 
				case ScopeKind.File : 
				case ScopeKind.Pointer :
				case ScopeKind.Enum : 
				case ScopeKind.Set : 
				case ScopeKind.ShortString : 
					if (scope is ITypeScope && (scope as ITypeScope).Aliased)
						return scope.Name;
				break;
			}
			switch (scope.Kind)
			{
				case ScopeKind.Type : return GetSimpleDescriptionForType(scope as ITypeScope);
				case ScopeKind.CompiledType : return GetSimpleDescriptionForCompiledType(scope as ICompiledTypeScope);
				case ScopeKind.Delegate : return GetDescriptionForDelegate(scope as IProcType);
				case ScopeKind.TypeSynonim : return GetSimpleSynonimDescription(scope as ITypeSynonimScope);
				case ScopeKind.Array : return GetDescriptionForArray(scope as IArrayScope);
				case ScopeKind.Diapason : return GetDescriptionForDiapason(scope as IDiapasonScope);
				case ScopeKind.File : return GetDescriptionForFile(scope as IFileScope);
				case ScopeKind.Pointer : return GetDescriptionForPointer(scope as IPointerScope);
				case ScopeKind.Enum : return GetDescriptionForEnum(scope as IEnumScope);
				case ScopeKind.Set : return GetDescriptionForSet(scope as ISetScope);
				case ScopeKind.ElementScope : return GetSimpleDescriptionForElementScope(scope as IElementScope);
				case ScopeKind.CompiledField : return GetDescriptionForCompiledField(scope as ICompiledFieldScope);
				case ScopeKind.CompiledProperty : return GetDescriptionForCompiledProperty(scope as ICompiledPropertyScope);
				case ScopeKind.CompiledMethod : return GetDescriptionForCompiledMethod(scope as ICompiledMethodScope);
				case ScopeKind.Namespace : return GetDescriptionForNamespace(scope as INamespaceScope);
				case ScopeKind.Procedure : return GetSimpleDescriptionForProcedure(scope as IProcScope);
				case ScopeKind.CompiledEvent : return GetDescriptionForCompiledEvent(scope as ICompiledEventScope);
				case ScopeKind.CompiledConstructor : return GetDescriptionForCompiledConstructor(scope as ICompiledConstructorScope);
				case ScopeKind.ShortString : return GetDescriptionForShortString(scope as IShortStringScope);
				case ScopeKind.UnitInterface : return GetDescriptionForModule(scope as IInterfaceUnitScope);
				//case ScopeKind.Procedure : return GetDescriptionForProcedure(scope as IProcScope);
			}
			return "";
		}
		protected override string GetTopScopeName(IBaseScope sc)
		{
			if (sc == null) return "";
			if (sc.Name == "" || sc.Name.Contains("$") || sc.Name == "PABCSystem") return "";
			if (sc is IProcScope) return "";
			return sc.Name + "::";
		}
		public virtual string GetDescription(IBaseScope scope)
		{
			switch (scope.Kind)
			{
				case ScopeKind.Type : return GetDescriptionForType(scope as ITypeScope);
				case ScopeKind.CompiledType : return GetDescriptionForCompiledType(scope as ICompiledTypeScope);
				case ScopeKind.Delegate : return GetDescriptionForDelegate(scope as IProcType);
				case ScopeKind.TypeSynonim : return GetSynonimDescription(scope as ITypeSynonimScope);
				case ScopeKind.Array : return GetDescriptionForArray(scope as IArrayScope);
				case ScopeKind.Diapason : return GetDescriptionForDiapason(scope as IDiapasonScope);
				case ScopeKind.File : return GetDescriptionForFile(scope as IFileScope);
				case ScopeKind.Pointer : return GetDescriptionForPointer(scope as IPointerScope);
				case ScopeKind.Enum : return GetDescriptionForEnum(scope as IEnumScope);
				case ScopeKind.Set : return GetDescriptionForSet(scope as ISetScope);
				case ScopeKind.ElementScope : return GetDescriptionForElementScope(scope as IElementScope);
				case ScopeKind.CompiledField : return GetDescriptionForCompiledField(scope as ICompiledFieldScope);
				case ScopeKind.CompiledProperty : return GetDescriptionForCompiledProperty(scope as ICompiledPropertyScope);
				case ScopeKind.CompiledMethod : return GetDescriptionForCompiledMethod(scope as ICompiledMethodScope);
				case ScopeKind.Namespace : return GetDescriptionForNamespace(scope as INamespaceScope);
				case ScopeKind.Procedure : return GetDescriptionForProcedure(scope as IProcScope);
				case ScopeKind.CompiledEvent : return GetDescriptionForCompiledEvent(scope as ICompiledEventScope);
				case ScopeKind.CompiledConstructor : return GetDescriptionForCompiledConstructor(scope as ICompiledConstructorScope);
				case ScopeKind.ShortString : return GetDescriptionForShortString(scope as IShortStringScope);
				//case ScopeKind.Procedure : return GetDescriptionForProcedure(scope as IProcScope);
			}
			return "";
		}
Esempio n. 18
0
        private List <FoldMarker> GetFoldMarkers(IDocument doc, IBaseScope root, string fileName)
        {
            List <FoldMarker> foldMarkers = new List <FoldMarker>();

            if (!(root is ITypeScope))
            {
                Position pos = root.GetPosition();
                if (pos.file_name != null)
                {
                    Position   head_pos      = root.GetHeaderPosition();
                    FoldMarker newFoldMarker = null;
                    if (head_pos.file_name == null)
                    {
                        if (root is ImplementationUnitScope)
                        {
                            Position unit_pos = root.TopScope.GetPosition();
                            newFoldMarker = new FoldMarker(doc, pos.line - 1, pos.column - 1, unit_pos.end_line - 1, unit_pos.end_column, FoldType.MemberBody);
                        }
                        else
                        {
                            newFoldMarker = new FoldMarker(doc, pos.line - 1, pos.column - 1, pos.end_line - 1, pos.end_column, FoldType.MemberBody);
                        }
                    }
                    else
                    {
                        newFoldMarker = new FoldMarker(doc, head_pos.end_line - 1, head_pos.end_column - 1, pos.end_line - 1, pos.end_column, FoldType.MemberBody);
                    }
                    if (newFoldMarker.Length > 0)
                    {
                        foldMarkers.Add(newFoldMarker);
                    }
                }
                if (root.Regions != null)
                {
                    foreach (Position p in root.Regions)
                    {
                        foldMarkers.Add(new RegionFoldMarker(doc, p.line - 1, p.column, p.end_line - 1, p.end_column, FoldType.MemberBody, p.fold_text));
                    }
                }
                Position body_pos = root.GetBodyPosition();
                if (body_pos.file_name != null)
                {
                    FoldMarker newFoldMarker = null;
                    newFoldMarker = new FoldMarker(doc, body_pos.line - 1, body_pos.column - 1, body_pos.end_line - 1, body_pos.end_column, FoldType.MemberBody);
                    if (newFoldMarker.Length > 0)
                    {
                        foldMarkers.Add(newFoldMarker);
                    }
                }
            }
            foreach (IBaseScope ss in root.Members)
            {
                if (ss is ITypeScope)
                {
                    Position body_pos = ss.GetBodyPosition();
                    Position head_pos = ss.GetHeaderPosition();
                    if (head_pos.file_name == null || body_pos.file_name == null)
                    {
                        continue;
                    }
                    FoldMarker newFoldMarker = new FoldMarker(doc, head_pos.end_line - 1, head_pos.end_column - 1, body_pos.end_line - 1, body_pos.end_column, FoldType.TypeBody);
                    if (newFoldMarker.Length > 0)
                    {
                        foldMarkers.Add(newFoldMarker);
                    }
                    foldMarkers.AddRange(GetFoldMarkers(doc, ss, fileName));
                }
                else if (ss is IProcScope)
                {
                    FoldType ft       = FoldType.MemberBody;
                    Position head_pos = ss.GetHeaderPosition();
                    Position body_pos = ss.GetBodyPosition();
                    if (head_pos.file_name == null || body_pos.file_name == null)
                    {
                        continue;
                    }
                    FoldMarker newFoldMarker = new FoldMarker(doc, head_pos.end_line - 1, head_pos.end_column, body_pos.end_line - 1, body_pos.end_column, ft);
                    if (newFoldMarker.Length > 0)
                    {
                        foldMarkers.Add(newFoldMarker);
                    }
                }
                else if (ss is IImplementationUnitScope)
                {
                    foldMarkers.AddRange(GetFoldMarkers(doc, ss, fileName));
                }
            }

            return(foldMarkers);
        }
Esempio n. 19
0
 public override void visit(named_type_reference _named_type_reference)
 {
     ret_tn = cur_scope;
     for (int i = 0; i < _named_type_reference.names.Count; i++)
     {
         if (i > 0)
             ret_tn = ret_tn.FindNameOnlyInType(_named_type_reference.names[i].name);
         else ret_tn = ret_tn.FindNameInAnyOrder(_named_type_reference.names[i].name);
         if (ret_tn == null) break;
         else if (founded_scope.IsEqual(ret_tn))
             pos_list.Add(get_position(_named_type_reference));
     }
 }
Esempio n. 20
0
 public override void visit(unnamed_type_object _unnamed_type_object) // SSM 27.06.13
 {
     IBaseScope tmp = cur_scope;
     cur_scope = entry_scope.FindScopeByLocation(_unnamed_type_object.source_context.begin_position.line_num, _unnamed_type_object.source_context.begin_position.column_num);
     if (_unnamed_type_object.ne_list != null)
         _unnamed_type_object.ne_list.visit(this);
     cur_scope = tmp;
 }
Esempio n. 21
0
        public override void visit(ident _ident)
        {
            ret_tn = cur_scope.FindNameInAnyOrder(_ident.name);
            if (ret_tn == null && cur_scope.TopScope != null)
            {
                try
                {
                    ret_tn = cur_scope.TopScope.FindNameInAnyOrder(_ident.name);
                }
                catch (Exception e)
                {

                }
            }
            if (ret_tn != null && ret_tn.IsEqual(founded_scope))
                pos_list.Add(get_position(_ident));
        }
Esempio n. 22
0
 public override void visit(foreach_stmt _foreach_stmt)
 {
     ret_tn = cur_scope.FindNameInAnyOrder(_foreach_stmt.identifier.name);
     if (ret_tn != null && ret_tn.IsEqual(founded_scope))
         pos_list.Add(get_position(_foreach_stmt.identifier));
     if (_foreach_stmt.type_name != null)
         _foreach_stmt.type_name.visit(this);
     if (_foreach_stmt.in_what != null)
         _foreach_stmt.in_what.visit(this);
     if (_foreach_stmt.stmt != null)
         _foreach_stmt.stmt.visit(this);
 }
Esempio n. 23
0
 bool IBaseScope.IsEqual(IBaseScope scope)
 {
     return this == scope;
 }
Esempio n. 24
0
        private List<FoldMarker> GetFoldMarkers(IDocument doc, IBaseScope root)
        {
            List<FoldMarker> foldMarkers = new List<FoldMarker>();
            if (!(root is TypeScope))
            {
                Position pos = root.GetPosition();
                if (pos.file_name != null)
                {
                    Position head_pos = root.GetHeaderPosition();
                    FoldMarker newFoldMarker = null;
                    if (head_pos.file_name == null)
                        newFoldMarker = new FoldMarker(doc, pos.line - 1, pos.column - 1, pos.end_line - 1, pos.end_column, FoldType.MemberBody);
                    else
                        newFoldMarker = new FoldMarker(doc, head_pos.end_line - 1, head_pos.end_column - 1, pos.end_line - 1, pos.end_column, FoldType.MemberBody);
                    if (newFoldMarker.Length > 0)
                    {
                        foldMarkers.Add(newFoldMarker);
                    }
                }
                if (root.Regions != null)
                {
                    foreach (Position p in root.Regions)
                    {
                        foldMarkers.Add(new FoldMarker(doc, p.line - 1, p.column, p.end_line - 1, p.end_column, FoldType.MemberBody, p.fold_text));
                    }
                }
                Position body_pos = root.GetBodyPosition();
                if (body_pos.file_name != null)
                {
                    FoldMarker newFoldMarker = null;
                    newFoldMarker = new FoldMarker(doc, body_pos.line - 1, body_pos.column - 1, body_pos.end_line - 1, body_pos.end_column, FoldType.MemberBody);
                    if (newFoldMarker.Length > 0)
                    {
                        foldMarkers.Add(newFoldMarker);
                    }
                }

            }
            foreach (IBaseScope ss in root.Members)
            {
                if (ss is ITypeScope)
                {
                    Position body_pos = ss.GetBodyPosition();
                    Position head_pos = ss.GetHeaderPosition();
                    if (head_pos.file_name == null || body_pos.file_name == null) continue;
                    FoldMarker newFoldMarker = new FoldMarker(doc, head_pos.end_line - 1, head_pos.end_column - 1, body_pos.end_line - 1, body_pos.end_column, FoldType.TypeBody);
                    if (newFoldMarker.Length > 0)
                    {
                        foldMarkers.Add(newFoldMarker);
                    }
                    foldMarkers.AddRange(GetFoldMarkers(doc, ss));
                }
                else if (ss is IProcScope)
                {
                    FoldType ft = FoldType.MemberBody;
                    Position head_pos = ss.GetHeaderPosition();
                    Position body_pos = ss.GetBodyPosition();
                    if (head_pos.file_name == null || body_pos.file_name == null) continue;
                    FoldMarker newFoldMarker = new FoldMarker(doc, head_pos.end_line - 1, head_pos.end_column, body_pos.end_line - 1, body_pos.end_column, ft);
                    if (newFoldMarker.Length > 0)
                    {
                        foldMarkers.Add(newFoldMarker);
                    }
                }
                else if (ss is IImplementationUnitScope)
                    foldMarkers.AddRange(GetFoldMarkers(doc, ss));
            }

            return foldMarkers;
        }
		private string GetTopScopeNameWithoutDot(IBaseScope sc)
		{
			if (sc == null) return "";
			if (sc.Name == "" || sc.Name.Contains("$") || sc.Name == "PABCSystem") return "";
			if (sc is IProcScope) return "";
			if (sc is ITypeScope)
			{
				return sc.Name+((sc as ITypeScope).TemplateArguments != null?"<>":"");
			}
			return sc.Name;
		}
		public virtual string[] GetIndexerString(IBaseScope scope)
		{
			IBaseScope tmp_si = scope;
        	if (scope == null) return null;
        	if (scope is IElementScope) 
        		if ((scope as IElementScope).Indexers.Length == 0)
        		scope = (scope as IElementScope).Type;
        	if (scope is IProcScope) scope = (scope as IProcScope).ReturnType;
			if (!(scope is IElementScope))
        	{
        		ITypeScope ts = scope as ITypeScope;
        		if (ts == null) return null;
        		if (tmp_si is ITypeScope) return null;
        		ITypeScope[] indexers = ts.Indexers;
        		if (indexers == null || indexers.Length == 0) return null;
        		StringBuilder sb = new StringBuilder();
        		sb.Append("this");
        		sb.Append('[');
        		for (int i=0; i<indexers.Length; i++)
        		{
        			sb.Append(GetSimpleDescriptionWithoutNamespace(indexers[i]));
        			if (i < indexers.Length - 1)
        				sb.Append(',');
        		}
        		sb.Append("] : ");
        		sb.Append(GetSimpleDescriptionWithoutNamespace(ts.ElementType));
        		return new string[1]{sb.ToString()};
        	}
        	else
        	{
        		IElementScope es = scope as IElementScope;
        		ITypeScope[] indexers = es.Indexers;
        		if (indexers == null || indexers.Length == 0 || es.ElementType == null) return null;
        		StringBuilder sb = new StringBuilder();
        		sb.Append(es.Name);
        		sb.Append('[');
        		for (int i=0; i<indexers.Length; i++)
        		{
        			sb.Append(GetSimpleDescriptionWithoutNamespace(indexers[i]));
        			if (i < indexers.Length - 1)
        				sb.Append(',');
        		}
        		sb.Append("] : ");
        		sb.Append(GetSimpleDescriptionWithoutNamespace(es.ElementType));
        		return new string[1]{sb.ToString()};
        	}
		}
Esempio n. 27
0
 public override void visit(for_node _for_node)
 {
     if (_for_node.loop_variable != null)
     {
         ret_tn = cur_scope.FindNameInAnyOrder(_for_node.loop_variable.name);
         if (ret_tn != null && ret_tn.IsEqual(founded_scope))
             pos_list.Add(get_position(_for_node.loop_variable));
     }
     if (_for_node.type_name != null)
         _for_node.type_name.visit(this);
     if (_for_node.initial_value != null)
         _for_node.initial_value.visit(this);
     if (_for_node.finish_value != null)
         _for_node.finish_value.visit(this);
     if (_for_node.increment_value != null)
         _for_node.increment_value.visit(this);
     if (_for_node.statements != null)
         _for_node.statements.visit(this);
 }
Esempio n. 28
0
 public override void visit(roof_dereference _roof_dereference)
 {
     _roof_dereference.dereferencing_value.visit(this);
     if (ret_tn != null && ret_tn is IElementScope)
     {
         IPointerScope ts = (ret_tn as IElementScope).Type as IPointerScope;
         if (ts != null)
             ret_tn = ts.ElementType.MakeElementScope();//new ElementScope(ts.ref_type);
         else
             ret_tn = null;
     }
     else ret_tn = null;
 }
Esempio n. 29
0
        public override void visit(procedure_definition _procedure_definition)
        {
            //throw new NotImplementedException();
            IBaseScope tmp = cur_scope;
            cur_scope = entry_scope.FindScopeByLocation(_procedure_definition.source_context.begin_position.line_num, _procedure_definition.source_context.begin_position.column_num);
            if (cur_scope == null)
                cur_scope = tmp;

            with_body = true;
            _procedure_definition.proc_header.visit(this);
            with_body = false;
            if (_procedure_definition.proc_body != null)
                _procedure_definition.proc_body.visit(this);
            cur_scope = tmp;
        }
Esempio n. 30
0
 public override void visit(indexer _indexer)
 {
     _indexer.dereferencing_value.visit(this);
     if (ret_tn != null)
     {
         if (ret_tn != null)
             if (ret_tn is IElementScope && (ret_tn as IElementScope).Type is IProcScope && ((ret_tn as IElementScope).Type as IProcScope).ReturnType != null)
                 ret_tn = ((ret_tn as IElementScope).Type as IProcScope).ReturnType.GetElementType();
             else
                 ret_tn = ret_tn.GetElementType();
         IBaseScope tmp = ret_tn;
         _indexer.indexes.visit(this);
         ret_tn = tmp;
     }
 }
Esempio n. 31
0
 public override void visit(function_lambda_definition _function_lambda_definition)
 {
     IBaseScope tmp = cur_scope;
     cur_scope = entry_scope.FindScopeByLocation(_function_lambda_definition.source_context.begin_position.line_num, _function_lambda_definition.source_context.begin_position.column_num);
     if (cur_scope == null)
         cur_scope = tmp;
     foreach (ident id in _function_lambda_definition.ident_list.list)
         id.visit(this);
     _function_lambda_definition.proc_body.visit(this);
     cur_scope = tmp;
 }