当前位置: 首页>>代码示例>>C#>>正文


C# SymbolTable.AddSymbol方法代码示例

本文整理汇总了C#中SymbolTable.AddSymbol方法的典型用法代码示例。如果您正苦于以下问题:C# SymbolTable.AddSymbol方法的具体用法?C# SymbolTable.AddSymbol怎么用?C# SymbolTable.AddSymbol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SymbolTable的用法示例。


在下文中一共展示了SymbolTable.AddSymbol方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetReferenceSymbolTableByLocation

        public static ISymbolTable GetReferenceSymbolTableByLocation(IPsiServices psiServices, string name, IProject project)
        {
            var mvcCache = psiServices.GetComponent<MvcCache>();
            var symbolTable = new SymbolTable(psiServices);
            try
            {
                bool hasExtension = Path.HasExtension(name);

                foreach (string location in mvcCache.GetLocations(project, MvcUtil.GetViewLocationType(MvcKind.View, null)))
                {
                    string path = string.Format(location, name, null, null);
                    if (hasExtension)
                    {
                        path = Path.ChangeExtension(path, null);
                    }
                    symbolTable.AddSymbol(new PathDeclaredElement(psiServices, FileSystemPath.Parse(path)));
                }
            }
            catch (InvalidPathException)
            {
            }

            return symbolTable.Distinct(PathInfoComparer.Instance);
        }
开发者ID:jimmason,项目名称:Nancy.ReSharper,代码行数:24,代码来源:NancyReferenceSymbolTableUtil.cs

示例2: GetSymbolTable

        public ISymbolTable GetSymbolTable(params string[] referenceNames)
        {
            ISymbolTable tableFromGlobal = GlobalQualifier.GetSymbolTable(referenceNames);
            SymbolTable aliasesTable = new SymbolTable(false);

            foreach (KeyValuePair<string, IDeclaredElement> pair in GetAliases())
            {
                aliasesTable.AddSymbol(pair.Key, pair.Value, EmptySubstitution.INSTANCE, null, 0);
            }

            var table = new MergedTable(tableFromGlobal, aliasesTable);
            return table;
        }
开发者ID:willrawls,项目名称:arp,代码行数:13,代码来源:NHGlobalQualifier.cs

示例3: init_procedures

		private void init_procedures(convertion_data_and_alghoritms conv,SymbolTable.Scope susc)
		{
			pseudo_function break_procedure=new pseudo_function(compiler_string_consts.break_procedure_name,
				new pseudo_function_algorithm(conv.syntax_tree_visitor.make_break_node));

			susc.AddSymbol(compiler_string_consts.break_procedure_name,new SymbolInfo(break_procedure));

			pseudo_function continue_procedure=new pseudo_function(compiler_string_consts.continue_procedure_name,
				new pseudo_function_algorithm(conv.syntax_tree_visitor.make_continue_node));

			susc.AddSymbol(compiler_string_consts.continue_procedure_name,new SymbolInfo(continue_procedure));
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:12,代码来源:SystemLibInitializer.cs

示例4: init_temp_methods

		private void init_temp_methods(SymbolTable.Scope sc)
		{
			//TODO: Сделано по быстрому. Переделать.
			Type tp=typeof(Console);
			compiled_function_node cfn;
			System.Type[] arr=new System.Type[1];
			System.Reflection.MethodInfo mi;
			
			arr[0]=typeof(int);
			mi=tp.GetMethod("WriteLine",arr);
			cfn=new compiled_function_node(mi);
			cfn.parameters.Clear();
			cfn.parameters.Add(new common_parameter("val",_integer_type,SemanticTree.parameter_type.value,null));
			sc.AddSymbol("writeln",new SymbolInfo(cfn));

			arr[0]=typeof(double);
			mi=tp.GetMethod("WriteLine",arr);
			cfn=new compiled_function_node(mi);
			cfn.parameters.Clear();
			cfn.parameters.Add(new common_parameter("val",_real_type,SemanticTree.parameter_type.value,null));
			sc.AddSymbol("writeln",new SymbolInfo(cfn));

			arr[0]=typeof(char);
			mi=tp.GetMethod("WriteLine",arr);
			cfn=new compiled_function_node(mi);
			cfn.parameters.Clear();
			cfn.parameters.Add(new common_parameter("val",_char_type,SemanticTree.parameter_type.value,null));
			sc.AddSymbol("writeln",new SymbolInfo(cfn));

			arr[0]=typeof(bool);
			mi=tp.GetMethod("WriteLine",arr);
			cfn=new compiled_function_node(mi);
			cfn.parameters.Clear();
			cfn.parameters.Add(new common_parameter("val",_bool_type,SemanticTree.parameter_type.value,null));
			sc.AddSymbol("writeln",new SymbolInfo(cfn));

			arr[0]=typeof(string);
			mi=tp.GetMethod("WriteLine",arr);
			cfn=new compiled_function_node(mi);
			cfn.parameters.Clear();
			cfn.parameters.Add(new common_parameter("val",_string_type,SemanticTree.parameter_type.value,null));
			sc.AddSymbol("writeln",new SymbolInfo(cfn));

			mi=tp.GetMethod("ReadLine",new System.Type[0]);
			cfn=new compiled_function_node(mi);
			cfn.parameters.Clear();
			cfn.return_value_type=_string_type;
			sc.AddSymbol("readline",new SymbolInfo(cfn));

			make_assign_operator(_string_type,SemanticTree.basic_function_type.objassign);

			tp=typeof(int);
			arr[0]=typeof(string);
			mi=tp.GetMethod("Parse",arr);
			cfn=new compiled_function_node(mi);
			cfn.parameters.Clear();
			cfn.parameters.Add(new common_parameter("val",_string_type,SemanticTree.parameter_type.value,null));
			cfn.return_value_type=_integer_type;
			sc.AddSymbol("parseint",new SymbolInfo(cfn));

			tp=typeof(double);
			arr[0]=typeof(string);
			mi=tp.GetMethod("Parse",arr);
			cfn=new compiled_function_node(mi);
			cfn.parameters.Clear();
			cfn.parameters.Add(new common_parameter("val",_string_type,SemanticTree.parameter_type.value,null));
			cfn.return_value_type=_real_type;
			sc.AddSymbol("parsereal",new SymbolInfo(cfn));

			tp=typeof(bool);
			arr[0]=typeof(string);
			mi=tp.GetMethod("Parse",arr);
			cfn=new compiled_function_node(mi);
			cfn.parameters.Clear();
			cfn.parameters.Add(new common_parameter("val",_string_type,SemanticTree.parameter_type.value,null));
			cfn.return_value_type=_bool_type;
			sc.AddSymbol("parsebool",new SymbolInfo(cfn));

			tp=typeof(char);
			arr[0]=typeof(string);
			mi=tp.GetMethod("Parse",arr);
			cfn=new compiled_function_node(mi);
			cfn.parameters.Clear();
			cfn.parameters.Add(new common_parameter("val",_string_type,SemanticTree.parameter_type.value,null));
			cfn.return_value_type=_char_type;
			sc.AddSymbol("parsechar",new SymbolInfo(cfn));
			common_namespace_function_node cnfn = new common_namespace_function_node("New",null);
			cnfn.parameters.Clear();
			cnfn.parameters.Add(new common_parameter("ptr",_pointer_type,SemanticTree.parameter_type.value,null));
			sc.AddSymbol("new",new SymbolInfo(cnfn));
			
			cnfn = new common_namespace_function_node("Dispose",null);
			cnfn.parameters.Clear();
			cnfn.parameters.Add(new common_parameter("ptr",_pointer_type,SemanticTree.parameter_type.value,null));
			sc.AddSymbol("dispose",new SymbolInfo(cnfn));
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:96,代码来源:SystemLibInitializer.cs

示例5: init_constants

		private void init_constants(SymbolTable.Scope sc)
		{
			_true_constant=new bool_const_node(true,_bool_type);
			_false_constant=new bool_const_node(false,_bool_type);

			_true_constant_definition=new constant_definition_node(compiler_string_consts.true_const_name,_true_constant);
			_false_constant_definition=new constant_definition_node(compiler_string_consts.false_const_name,_false_constant);

			sc.AddSymbol(compiler_string_consts.true_const_name,new SymbolInfo(_true_constant_definition));
			sc.AddSymbol(compiler_string_consts.false_const_name,new SymbolInfo(_false_constant_definition));
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:11,代码来源:SystemLibInitializer.cs

示例6: AddNames

        private void AddNames(NameRef[] names, SymbolTable.Scope Scope)
        {
            for (int i = 0; i < names.Length; i++)
            {
                SymbolInfo si = new SymbolInfo();

                si.symbol_kind = names[i].symbol_kind;
                wrapped_definition_node wdn = new wrapped_definition_node(names[i].offset, this);
                si.sym_info = wdn;
                if (names[i].special_scope == 0)
                {
                    //PCUReturner.AddPCUReader((wrapped_definition_node)si.sym_info, this);
                    //si.access_level = access_level.al_public;
                    SymbolInfo si2 = (cun.scope as WrappedUnitInterfaceScope).FindWithoutCreation(names[i].name);
                    si.Next = si2;
                    Scope.AddSymbol(names[i].name, si);
                }
                else
                {
                    
                    type_node tn = GetSpecialTypeReference(names[i].offset);
                    if (tn is compiled_type_node)
                        (tn as compiled_type_node).scope.AddSymbol(names[i].name, si);
                    else if (tn is generic_instance_type_node)
                        tn.Scope.AddSymbol(names[i].name, si);
                    else if (tn is common_type_node)
                        (tn as common_type_node).scope.AddSymbol(names[i].name, si);
                    else
                        throw new NotSupportedException();
                }
            }
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:32,代码来源:PCUReader.cs

示例7: AddTypeSynonyms

 private void AddTypeSynonyms(int offset, SymbolTable.Scope scope)
 {
     int pos = (int)br.BaseStream.Position;
     br.BaseStream.Seek(start_pos + offset, SeekOrigin.Begin);
     int count = br.ReadInt32();
     for (int i = 0; i < count; i++)
     {
         //type_synonym ts = CreateTypeSynonym();//ploho!! nado sozdavat zaglushki
         //scope.AddSymbol(ts.name, new SymbolInfo(ts.original_type));
         wrapped_type_synonym wts = CreateTypeSynonym();
         SymbolInfo si = new SymbolInfo();
         si.sym_info = wts;
         scope.AddSymbol(wts.name, si);
     }
     br.BaseStream.Seek(pos, SeekOrigin.Begin);
 }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:16,代码来源:PCUReader.cs

示例8: GetReferenceSymbolTable

    public static ISymbolTable GetReferenceSymbolTable(IPathReference pathReference, bool useReferenceName, bool includeHttpHandlers = true)
    {
      var propertiesSearcher =
        pathReference.GetTreeNode().GetSolution().GetComponent<MSBuildPropertiesCache>();

      string productHomeDir = propertiesSearcher.GetProjectPropertyByName(pathReference.GetTreeNode().GetProject(),
        "ProductHomeDir");
      var basePath = new FileSystemPath(productHomeDir);
      if (basePath.IsEmpty)
      {
        return EmptySymbolTable.INSTANCE;
      }

      FolderQualifierInfo folderQualifierInfo = null;
      IPsiServices psiServices = pathReference.GetTreeNode().GetPsiServices();
      var baseProjectFolder = psiServices.Solution.FindProjectItemsByLocation(basePath).FirstOrDefault() as IProjectFolder;
      if (baseProjectFolder != null)
      {
        folderQualifierInfo = new FolderQualifierInfo(baseProjectFolder);
      }

      FileSystemPath websiteRoot = GetRootPath(pathReference);
      IQualifier qualifier = pathReference.GetQualifier();
      if (useReferenceName)
      {
        PathDeclaredElement target = null;
        string name = pathReference.GetName();
        switch (name)
        {
          case PathDeclaredElement.CURRENT_DIR_NAME:
            target = new PathDeclaredElement(PathDeclaredElement.CURRENT_DIR_NAME, psiServices, basePath);
            break;
          case PathDeclaredElement.LEVEL_UP_NAME:
            target = new PathDeclaredElement(PathDeclaredElement.LEVEL_UP_NAME, psiServices, basePath.Directory);
            break;
          case PathDeclaredElement.ROOT_NAME:
            if (qualifier != null)
            {
              goto default;
            }
            target = new PathDeclaredElement(PathDeclaredElement.ROOT_NAME, psiServices, websiteRoot);
            break;
          default:
            try
            {
              string parserGenOutputBase =
                propertiesSearcher.GetProjectPropertyByName(pathReference.GetTreeNode().GetProject(), "ParserGenOutputBase");
              FileSystemPath path = basePath.Combine(parserGenOutputBase + "\\" + name);
              target = new PathDeclaredElement(name, psiServices, path);
            }
            catch (InvalidPathException)
            {
            }
            catch (ArgumentException)
            {
            }
            break;
        }
        var table = new SymbolTable(psiServices, folderQualifierInfo != null ? new SymbolTableDependencySet(folderQualifierInfo) : null);
        if (target != null)
        {
          table.AddSymbol(target, EmptySubstitution.INSTANCE, 1);
        }
        return table;
      }

      FileSystemPath rootPath = (qualifier == null) ? websiteRoot : FileSystemPath.Empty;
      ISymbolTable symbolTableByPath = PathReferenceUtil.GetSymbolTableByPath(basePath, psiServices, basePath.Directory, rootPath, true);
      FileSystemPath basePathBeforeMapping = GetBasePathBeforeMapping(pathReference);
      if (!basePathBeforeMapping.IsNullOrEmpty())
      {
        IWebProjectPathMapping pathMapping = WebPathMappingManager.GetPathMapping(pathReference);
        List<FileSystemPath> mappedPaths = pathMapping.GetAllPathPartsIn(basePathBeforeMapping).ToList();
        if (mappedPaths.Any())
        {
          var mappedPathsTable = new SymbolTable(psiServices, folderQualifierInfo != null ? new SymbolTableDependencySet(folderQualifierInfo) : null);
          foreach (FileSystemPath mappedPath in mappedPaths)
          {
            var declaredElement = new PathDeclaredElement(psiServices, mappedPath);
            mappedPathsTable.AddSymbol(declaredElement, EmptySubstitution.INSTANCE, 1);
          }
          symbolTableByPath = symbolTableByPath.Merge(mappedPathsTable);
        }
      }

      if (!includeHttpHandlers)
      {
        return symbolTableByPath;
      }

      var httpHandlersTable = new SymbolTable(psiServices);

      return httpHandlersTable.Merge(symbolTableByPath);
    }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:94,代码来源:PsiPathReferenceUtil.cs

示例9: Install

		private static void Install(SymbolTable table,
		                            IEnumerable<Symbol> symbols) {
			foreach (Symbol i in symbols)
				table.AddSymbol(i);
		}
开发者ID:Bamistro,项目名称:openvisualizationplatform,代码行数:5,代码来源:ScriptingEnvironment.cs


注:本文中的SymbolTable.AddSymbol方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。