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


C# SymbolTable类代码示例

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


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

示例1: Render

 public override void Render(SymbolTable symbols, TextWriter tw, object item)
 {
     foreach (var child in Children)
     {
         child.Render(symbols, tw, item);
     }
 }
开发者ID:jeffreyabecker,项目名称:template,代码行数:7,代码来源:Parser.cs

示例2: ProcessExpression

        private bool ProcessExpression(SymbolTable symbolTable)
        {
            // TODO: If there are performance problems, we could find a faster way to detect expressions than doing a full parse
            var tokenSequence = new TokenSequence(XValue);

            if (tokenSequence.RequiresProcessing)
            {
                if (tokenSequence.RequiresTemplateArguments)
                {
                    var templateInstance = TemplateInstance;
                    if (templateInstance == null || templateInstance.Template == null)
                    {
                        return false;
                    }

                    XValue = tokenSequence.Process(symbolTable, templateInstance.ArgumentDictionary);
                }
                else
                {
                    XValue = tokenSequence.Process(symbolTable, null);
                }
            }

            return true;
        }
开发者ID:japj,项目名称:vulcan,代码行数:25,代码来源:BindingItem.cs

示例3: LoadLocalAddress

		internal LoadLocalAddress(SymbolTable symbols, MethodDefinition method, Instruction untyped, int index) : base(untyped, index)
		{			
			switch (untyped.OpCode.Code)
			{
				case Code.Ldloca_S:
				case Code.Ldloca:
					VariableDefinition param = untyped.Operand as VariableDefinition;
					if (param != null)
					{
						Variable = param.Index;
						Type = param.VariableType;
					}
					else
					{
						Variable = (int) untyped.Operand;
						Type = method.Body.Variables[Variable].VariableType;
					}
					Name = symbols.LocalName(method, untyped, Variable);
					break;
										
				default:
					DBC.Fail(untyped.OpCode.Code + " is not a valid LoadLocalAddress");
					break;
			}
			
			RealName = symbols.HaveLocalNames(method);
		}
开发者ID:dbremner,项目名称:smokey,代码行数:27,代码来源:LoadLocalAddress.cs

示例4: RuleBuilder

 /// <summary>
 /// Constructs an empty rule builder.
 /// </summary>
 public RuleBuilder()
 {
     var rootScope = new SymbolTable();
     _dependencyBuilder = new DependencyGroupBuilder(rootScope);
     _groupBuilder = new GroupBuilder(rootScope, GroupType.And);
     _actionGroupBuilder = new ActionGroupBuilder(rootScope);
 }
开发者ID:hebert26,项目名称:NRules,代码行数:10,代码来源:RuleBuilder.cs

示例5: Insert_Lookup_WriteTable_SymbolTableTest

        public void Insert_Lookup_WriteTable_SymbolTableTest()
        {
            var count = 0;
            var symTable = new SymbolTable();
            symTable.Printer = (val) => { count++; };

            symTable.Insert(Token.CreateToken("x", 0), 0);
            symTable.Insert(Token.CreateToken("y", 0), 0);
            symTable.Insert(Token.CreateToken("z", 0), 0);

            symTable.Lookup("x").Content = CreateVariableContent();
            symTable.Lookup("y").Content = CreateVariableContent();
            symTable.Lookup("z").Content = CreateVariableContent();

            symTable.Insert(Token.CreateToken("a", 0), 1);
            symTable.Insert(Token.CreateToken("x", 0), 1);
            symTable.Insert(Token.CreateToken("y", 0), 1);
            symTable.Insert(Token.CreateToken("z", 0), 1);

            symTable.Lookup("a").Content = CreateVariableContent();
            symTable.Lookup("x").Content = CreateVariableContent();
            symTable.Lookup("y").Content = CreateVariableContent();
            symTable.Lookup("z").Content = CreateVariableContent();

            symTable.WriteTable(0);
            Assert.AreEqual(3, count);

            count = 0;
            symTable.WriteTable(1);
            Assert.AreEqual(4, count);

            count = 0;
            symTable.WriteTable(2);
            Assert.AreEqual(0, count);
        }
开发者ID:dubeme,项目名称:Lame-Java-Compiler,代码行数:35,代码来源:SymbolTableTests.cs

示例6: NameExpression

 public NameExpression(
     IExpression identifier,
     SymbolTable<string, IValue> symbolTable)
 {
     _identifier = identifier;
     _symbolTable = symbolTable;
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:7,代码来源:NameExpression.cs

示例7: AddValue_Correct_Test

        public void AddValue_Correct_Test()
        {
            symbolTable = new SymbolTable();
            symbolTable.AddValue(id, new Bool(false));

            Assert.IsNotNull(symbolTable.GetValue(id));
        }
开发者ID:javachengwc,项目名称:many-ql,代码行数:7,代码来源:SymbolTableTests.cs

示例8: Init

        public bool Init(ErrorHandling errorContext, SymbolTable symtable)
        {
            _runtimeBinderSymbolTable = symtable;
            Debug.Assert(_pBSymmgr != null);

#if !CSEE
            Debug.Assert(_predefSyms == null);
#else // CSEE
            Debug.Assert(predefSyms == null || aidMsCorLib != KAID.kaidNil);
#endif // CSEE

            if (_aidMsCorLib == KAID.kaidNil)
            {
                // If we haven't found mscorlib yet, first look for System.Object. Then use its assembly as
                // the location for all other pre-defined types.
                AggregateSymbol aggObj = FindPredefinedType(errorContext, PredefinedTypeFacts.GetName(PredefinedType.PT_OBJECT), KAID.kaidGlobal, AggKindEnum.Class, 0, true);
                if (aggObj == null)
                    return false;
                _aidMsCorLib = aggObj.GetAssemblyID();
            }

            _predefSyms = new AggregateSymbol[(int)PredefinedType.PT_COUNT];
            Debug.Assert(_predefSyms != null);

            return true;
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:26,代码来源:PredefinedTypes.cs

示例9: NestedProgram

 public NestedProgram(Program containingProgram)
 {
     IsNested = true;
     ContainingProgram = containingProgram;
     SymbolTable = new SymbolTable(containingProgram.SymbolTable);
     SyntaxTree.Root.SymbolTable = SymbolTable;
 }
开发者ID:osmedile,项目名称:TypeCobol,代码行数:7,代码来源:Program.cs

示例10: Instantiate

        public void Instantiate(SymbolTable symbolTable, UnboundReferences unboundReferences)
        {
            var parentEtl = ParentItem as AstEtlRootNode;
            var transformationTemplate = Template as AstTransformationTemplateNode;
            var clonedMapping = new Dictionary<IFrameworkItem, IFrameworkItem>();
            if (transformationTemplate != null && parentEtl != null)
            {
                var clonedTransformations = new List<AstTransformationNode>();
                foreach (var transformation in transformationTemplate.Transformations)
                {
                    clonedTransformations.Add((AstTransformationNode)transformation.Clone(parentEtl, clonedMapping));
                }

                parentEtl.Transformations.Replace(this, clonedTransformations);
            }

            foreach (var bindingItem in transformationTemplate.UnboundReferences)
            {
                var clonedBindingItem = new BindingItem(
                    bindingItem.BoundProperty,
                    bindingItem.XObject,
                    bindingItem.XValue,
                    clonedMapping[bindingItem.ParentItem],
                    bindingItem.BimlFile,
                    this);
                unboundReferences.Add(clonedBindingItem);
            }
        }
开发者ID:japj,项目名称:vulcan,代码行数:28,代码来源:AstTransformationTemplateInstanceNode.cs

示例11: ParseProgramOrClass

        public static void ParseProgramOrClass(TextSourceInfo textSourceInfo, ISearchableReadOnlyList<CodeElementsLine> codeElementsLines, TypeCobolOptions compilerOptions, SymbolTable customSymbols, out Program newProgram, out Class newClass, out IList<ParserDiagnostic> diagnostics)
        {
            // Create an Antlr compatible token source on top a the token iterator
            CodeElementsLinesTokenSource tokenSource = new CodeElementsLinesTokenSource(
                textSourceInfo.Name,
                codeElementsLines);

            // Init parser
            ITokenStream tokenStream = new TokensLinesTokenStream(tokenSource, Token.CHANNEL_SourceTokens);
            ProgramClassParser cobolParser = new ProgramClassParser(tokenStream);
            // -> activate full ambiguities detection
            //parser.Interpreter.PredictionMode = PredictionMode.LlExactAmbigDetection;

            // Register all parse errors in a list in memory
            DiagnosticSyntaxErrorListener errorListener = new DiagnosticSyntaxErrorListener();
            cobolParser.RemoveErrorListeners();
            cobolParser.AddErrorListener(errorListener);

            // Try to parse a Cobol program or class
            ProgramClassParser.CobolCompilationUnitContext codeElementParseTree = cobolParser.cobolCompilationUnit();

            // Visit the parse tree to build a first class object representing a Cobol program or class
            ParseTreeWalker walker = new ParseTreeWalker();
            CobolNodeBuilder programClassBuilder = new CobolNodeBuilder();
            programClassBuilder.CustomSymbols = customSymbols;
            programClassBuilder.Dispatcher = new NodeDispatcher();
            programClassBuilder.Dispatcher.CreateListeners();
            walker.Walk(programClassBuilder, codeElementParseTree);

            // Register compiler results
            newProgram = programClassBuilder.Program;
            newClass = programClassBuilder.Class;
            diagnostics = errorListener.Diagnostics;
        }
开发者ID:laurentprudhon,项目名称:TypeCobol,代码行数:34,代码来源:ProgramClassParserStep.cs

示例12: ProcessIsNullPatcherTransformations

        public static void ProcessIsNullPatcherTransformations(SymbolTable symbolTable)
        {
            var snapshotSymbolTable = new List<IReferenceableItem>(symbolTable);
            foreach (var astNamedNode in snapshotSymbolTable)
            {
                var nullPatcherNode = astNamedNode as AstIsNullPatcherNode;
                if (nullPatcherNode != null && astNamedNode.FirstThisOrParent<ITemplate>() == null)
                {
                    var astDerivedColumnListNode = new AstDerivedColumnListNode(nullPatcherNode.ParentItem)
                                                       {
                                                           Name = nullPatcherNode.Name,
                                                           ValidateExternalMetadata = nullPatcherNode.ValidateExternalMetadata
                                                       };

                    foreach (AstIsNullPatcherColumnNode patchColumn in nullPatcherNode.Columns)
                    {
                        var column = new AstDerivedColumnNode(astDerivedColumnListNode)
                                         {
                                             Name = patchColumn.Name,
                                             ReplaceExisting = true,
                                             Expression = String.Format(CultureInfo.InvariantCulture, "ISNULL({0}) ? {1} : {0}", patchColumn.Name, patchColumn.DefaultValue),
                                             DerivedColumnType = VulcanEngine.IR.Ast.ColumnType.Object
                                         };
                        astDerivedColumnListNode.Columns.Add(column);
                    }

                    Utility.Replace(nullPatcherNode, new List<AstTransformationNode> { astDerivedColumnListNode });
                }
            }
        }
开发者ID:japj,项目名称:vulcan,代码行数:30,代码来源:IsNullPatcherLowerer.cs

示例13: Execute

        public override object Execute(SymbolTable table)
        {
            base.Execute(table);
            StatementList.Execute(table);

            return null;
        }
开发者ID:realn0whereman,项目名称:MiniRE,代码行数:7,代码来源:MiniRE.cs

示例14: CreateProgram

        public void CreateProgram(string moduleName)
        {
            AssemblyName name = new AssemblyName(Path.GetFileNameWithoutExtension(moduleName));
            var asmb = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Save);

            ModuleBuilder modb = asmb.DefineDynamicModule(moduleName);

            var type = modb.DefineType("$program");

            var symbolTable = new SymbolTable(type);

            symbolTable.AddFunctionHeader("$main", MethodAttributes.Static, null, new FunctionDefinition.Argument[] { },"$program");

            var il = symbolTable.functionTable["$main"].GetILGenerator();

            Program.GenerateIL(il, symbolTable);

            il.Emit(OpCodes.Ret);

            modb.CreateGlobalFunctions();
            asmb.SetEntryPoint(symbolTable.functionTable["$main"].methodDefinition);

            symbolTable.typeTable.types[0].typeBuilder.CreateType();

            asmb.Save(moduleName);
        }
开发者ID:mirhagk,项目名称:IronTuring,代码行数:26,代码来源:Unit.cs

示例15: TypeCheckerVisitor

 public TypeCheckerVisitor(ErrorHandler errors, StmtList statements)
 {
     Errors = errors;
     SymbolTable = new SymbolTable();
     Checker = new TypeChecker(errors);
     RootStmtList = statements;
 }
开发者ID:Tuomoz,项目名称:mini-pl-interpreter,代码行数:7,代码来源:TypeCheckerVisitor.cs


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