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


C# SyntaxTree.expression类代码示例

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


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

示例1: NewAsIsConstexpr

        public typecast_node NewAsIsConstexpr(expression constterm, op_typecast typecastop, type_definition tdef, LexLocation loc)
        {
            var naic = new typecast_node(constterm as addressed_value, tdef, typecastop, loc); 
			if (!(constterm is addressed_value))
                parsertools.errors.Add(new bad_operand_type(parsertools.CurrentFileName, constterm.source_context, naic));
            return naic;
        }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:7,代码来源:SemanticRules.cs

示例2: CreateWhile

 /// <summary>
 /// Создать цикл while
 /// </summary>
 /// <param name="condition">Условие цикла</param>
 /// <param name="body">Тело цикла</param>
 /// <returns></returns>
 public SyntaxTree.while_node CreateWhile(expression condition, statement body)
 {
     SyntaxTree.while_node res = new SyntaxTree.while_node();
     res.CycleType = WhileCycleType.While;
     res.expr = condition;
     res.statements = body;
     return res;
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:14,代码来源:SubtreeCreator.cs

示例3: GetName

 /// <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;
 }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:61,代码来源:DomConverter.cs

示例4: CreateVarDef

 /// <summary>
 /// Создать var-выражение
 /// </summary>
 /// <param name="name">Имя переменной</param>
 /// <param name="initialValue">Начальное значение</param>
 /// <returns></returns>
 public var_def_statement CreateVarDef(string name, expression initialValue)
 {
     ident_list list = new ident_list();
     list.idents.Add(new ident(name));
     var res = new var_def_statement();
     res.inital_value = initialValue;
     res.vars = list;
     return res;
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:15,代码来源:SubtreeCreator.cs

示例5: CreateFor

 /// <summary>
 /// Создать цикл for
 /// </summary>
 /// <param name="varName">Имя переменной цикла</param>
 /// <param name="initValue">Начальное значение переменной цикла</param>
 /// <param name="finishValue">Конечное значение переменной цикла</param>
 /// <param name="body">Тело цикла</param>
 /// <param name="type">Тип цикла(to / downto)</param>
 /// <returns></returns>
 public SyntaxTree.for_node CreateFor(string varName, expression initValue, expression finishValue, statement body, for_cycle_type type)
 {
     SyntaxTree.for_node res = new SyntaxTree.for_node();
     res.loop_variable = new ident(varName);
     res.initial_value = initValue;
     res.finish_value = finishValue;
     res.statements = body;
     res.cycle_type = type;
     return res;
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:19,代码来源:SubtreeCreator.cs

示例6: NewConstVariable

        public expression NewConstVariable(expression constvariable, expression constvariable2, LexLocation loc)
        {
            if (constvariable2 is dereference) 
				((dereference)constvariable2).dereferencing_value = (addressed_value)constvariable;
			if (constvariable2 is dot_node) 
				((dot_node)constvariable2).left = (addressed_value)constvariable;
			var ncv = constvariable2;
            ncv.source_context = loc;
            return ncv;
        }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:10,代码来源:SemanticRules.cs

示例7: Convert

 public int32_const Convert(expression expr)
 {
     if (expr == null)
         return null;
     try
     {
         expr.visit(this);
     }
     catch
     {
         return null;
     }
     if (intStack.Count == 1)
     {
         int32_const i = new int32_const(intStack.Pop());
         i.source_context = expr.source_context;
         return i;
     }
     return null;
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:20,代码来源:ConstantExpressionToConstantConvertor.cs

示例8: NameExprPair

 public NameExprPair(ident id, expression ex)
 {
     this.id = id;
     this.ex = ex;
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:5,代码来源:SemanticRules.cs

示例9: BuildShortFuncDefinition

 public static procedure_definition BuildShortFuncDefinition(formal_parameters fp, procedure_attributes_list att, method_name name, type_definition result, expression ex, SourceContext headsc)
 {
     var ff = new function_header(fp, att, name, null, result, headsc);
     procedure_definition pd = BuildShortProcFuncDefinition(ff, new assign("Result", ex, ex.source_context));
     return pd;
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:6,代码来源:NodesBuilder.cs

示例10: BuildSameType

 public static type_definition BuildSameType(expression ex)
 {
     return new same_type_node(ex);
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:4,代码来源:NodesBuilder.cs

示例11: write_expression

		public void write_expression(expression _expression)
		{
			write_statement(_expression);
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:4,代码来源:SyntaxTreeStreamWriter.cs

示例12: typed_const_definition

		///<summary>
		///Конструктор с параметрами.
		///</summary>
		public typed_const_definition(ident _const_name,expression _const_value,type_definition _const_type)
		{
			this._const_name=_const_name;
			this._const_value=_const_value;
			this._const_type=_const_type;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:9,代码来源:Tree.cs

示例13: typed_parameters

		///<summary>
		///Конструктор с параметрами.
		///</summary>
		public typed_parameters(ident_list _idents,type_definition _vars_type,parametr_kind _param_kind,expression _inital_value,SourceContext sc)
		{
			this._idents=_idents;
			this._vars_type=_vars_type;
			this._param_kind=_param_kind;
			this._inital_value=_inital_value;
			source_context = sc;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:11,代码来源:Tree.cs

示例14: NewVariable

        public expression NewVariable(addressed_value variable, expression var_specifiers, LexLocation loc)
        {
            if (var_specifiers is dot_node) 
			{
                var dn = (dot_node)var_specifiers;
				dn.left = variable;
			}
			else if (var_specifiers is template_param_list) 
			{
                var tpl = (template_param_list)var_specifiers;
				((dot_node)tpl.dereferencing_value).left = variable;
				parsertools.create_source_context(tpl.dereferencing_value, variable, tpl.dereferencing_value);
			}
			else if (var_specifiers is dereference) 
			{
				((dereference)var_specifiers).dereferencing_value = variable;
			}
			else if (var_specifiers is ident_with_templateparams) 
			{
                ((ident_with_templateparams)var_specifiers).name = (addressed_value_funcname)variable;
			}
            var_specifiers.source_context = loc;
            return var_specifiers;
        }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:24,代码来源:SemanticRules.cs

示例15: visit

		public void visit(expression _expression)
		{
			bw.Write((Int16)1);
			write_expression(_expression);
		}
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:5,代码来源:SyntaxTreeStreamWriter.cs


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