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


C# SemanticTree类代码示例

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


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

示例1: Convert

 public SemanticTree.IProgramNode Convert(SemanticTree.IProgramNode ProgramNode)
 {
     foreach (ISemanticTreeConverter SemanticTreeConverter in semanticTreeConverters)
     {
         ChangeState(State.Convert, SemanticTreeConverter);
         ProgramNode = SemanticTreeConverter.Convert(Compiler, ProgramNode);
     }
     return ProgramNode;
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:9,代码来源:SemanticTreeConvertersController.cs

示例2: common_event

 	public common_event(string name, type_node del_type, common_type_node cont_type, common_method_node add_method, common_method_node remove_method, common_method_node raise_method, 
 	                    SemanticTree.field_access_level fal, SemanticTree.polymorphic_state ps, location loc)
 	{
 		this._name = name;
 		this.del_type = del_type;
 		this._add_method = add_method;
 		this._remove_method = remove_method;
 		this._raise_method = raise_method;
 		this._field_access_level = fal;
 		this._polymorphic_state = ps;
 		this._cont_type = cont_type;
 		this._loc = loc;
 	}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:13,代码来源:events.cs

示例3: GetFullMethodHeaderString

 //ssyy
 public static string GetFullMethodHeaderString(SemanticTree.IFunctionNode member)
 {
     string s = member.name;
     SemanticTree.IParameterNode[] ps = member.parameters;
     if (ps.Length > 0)
     {
         s += '(';
         s += ps[0].type.name;
         for (int i = 1; i < ps.Length; i++)
         {
             s += "," + ps[i].type.name;
         }
         s += ')';
     }
     if (member.return_value_type != null)
     {
         s += ":" + member.return_value_type.name;
     }
     return s;
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:21,代码来源:Tools.cs

示例4: WriteDebugInfo

		//сохранение отлад. информации
		private void WriteDebugInfo(SemanticTree.ILocation loc)
		{
            WriteDebugInfo(bw,loc);
		}
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:5,代码来源:PCUWriter.cs

示例5: mark_byte_as_ordinal

        /*
        private static void mark_byte_as_ordinal()
        {
            basic_function_node inc_value_method = create_inc_value_method(SemanticTree.basic_function_type.binc, _byte_type);
            basic_function_node dec_value_method = create_dec_value_method(SemanticTree.basic_function_type.bdec, _byte_type);

            basic_function_node inc_method = create_inc_method(SemanticTree.basic_function_type.binc, _byte_type);
            basic_function_node dec_method = create_dec_method(SemanticTree.basic_function_type.bdec, _byte_type);

            SymbolInfo si = _byte_type.find_in_type(compiler_string_consts.greq_name);
            basic_function_node greq = (basic_function_node)si.sym_info;

            si = _byte_type.find(compiler_string_consts.smeq_name);
            basic_function_node loeq = (basic_function_node)si.sym_info;

            constant_node cn_max = new byte_const_node(byte.MaxValue, null);
            constant_node cn_min = new byte_const_node(byte.MinValue, null);

            basic_function_node i2i_method = create_emty_function(byte_type);

            ordinal_type_to_int ordinal_type_to_int = byte_to_int;

            ordinal_type_interface oti = new ordinal_type_interface(inc_method, dec_method, inc_value_method, dec_value_method,
                internal_inc_value, internal_dec_value, loeq, greq, cn_min, cn_max, i2i_method, ordinal_type_to_int);

            _byte_type.add_internal_interface(oti);
        }
        */
        private static void mark_type_as_ordinal(type_node type,
            SemanticTree.basic_function_type inc,SemanticTree.basic_function_type dec,
            SemanticTree.basic_function_type vinc, SemanticTree.basic_function_type vdec,
            constant_node lower_value, constant_node upper_value,
            function_node t2i,ordinal_type_to_int t2i_comp)
        {
            basic_function_node inc_value = create_oti_method(inc, type, SemanticTree.parameter_type.value);
            basic_function_node dec_value = create_oti_method(dec, type, SemanticTree.parameter_type.value);

            basic_function_node inc_var = create_oti_method(vinc, type, SemanticTree.parameter_type.var);
            basic_function_node dec_var = create_oti_method(vdec, type, SemanticTree.parameter_type.var);

            SymbolInfo si = type.find_in_type(compiler_string_consts.greq_name);
            basic_function_node greq = (basic_function_node)si.sym_info;
        
            si = type.find(compiler_string_consts.smeq_name);
            basic_function_node loeq = (basic_function_node)si.sym_info;
			
            si = type.find(compiler_string_consts.sm_name);
            basic_function_node lo = (basic_function_node)si.sym_info;
            
            si = type.find(compiler_string_consts.gr_name);
            basic_function_node gr = (basic_function_node)si.sym_info;
            
            ordinal_type_interface oti = new ordinal_type_interface(inc_value, dec_value, inc_var, dec_var,
                loeq, greq, lo, gr, lower_value, upper_value, t2i, t2i_comp);

            type.add_internal_interface(oti);
        }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:57,代码来源:StaticSystemLib.cs

示例6: create_oti_method

 private static basic_function_node create_oti_method(SemanticTree.basic_function_type bft, type_node type, SemanticTree.parameter_type pt)
 {
     basic_function_node bfn = new basic_function_node(bft, type, true);
     basic_parameter cp = new basic_parameter(compiler_string_consts.unary_param_name, type,
         pt, bfn);
     bfn.parameters.AddElement(cp);
     //TODO: Важен порядок вызовов.
     add_stand_type(bft, bfn);
     return bfn;
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:10,代码来源:StaticSystemLib.cs

示例7: make_type_conversion

        public static basic_function_node make_type_conversion(type_node from, type_node to, type_compare tc,
            SemanticTree.basic_function_type bft, bool is_implicit)
        {
            basic_function_node conv_method = new basic_function_node(bft, to,false);
            basic_parameter bp = new basic_parameter(compiler_string_consts.unary_param_name,
                from, SemanticTree.parameter_type.value, conv_method);
            conv_method.parameters.AddElement(bp);

            type_table.add_type_conversion_from_defined(from, to, conv_method, tc, is_implicit);
            //type_intersection_node inter_node = new type_intersection_node(tc);
            //inter_node.this_to_another = new type_conversion(conv_method,!is_implicit);
            //from.add_intersection_node(to, inter_node);
			add_stand_type(bft, conv_method);
            return conv_method;
        }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:15,代码来源:StaticSystemLib.cs

示例8: make_binary_operator

 public static basic_function_node make_binary_operator(string operator_name, type_node to, SemanticTree.basic_function_type bft)
 {
     return make_binary_operator(operator_name, to, bft, to);
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:4,代码来源:StaticSystemLib.cs

示例9: make_unary_operator

 public static basic_function_node make_unary_operator(string operator_name, type_node to,
     SemanticTree.basic_function_type bft, type_node ret_value_type)
 {
     basic_function_node bfn = new basic_function_node(bft, ret_value_type,true);
     basic_parameter par = new basic_parameter(compiler_string_consts.unary_param_name, to,
         SemanticTree.parameter_type.value, bfn);
     bfn.parameters.AddElement(par);
     to.add_name(operator_name, new SymbolInfo(bfn));
     add_stand_type(bft, bfn);
     return bfn;
 }
开发者ID:CSRedRat,项目名称:pascalabcnet,代码行数:11,代码来源:StaticSystemLib.cs

示例10: basic_function_node

        /// <summary>
        /// Конструктор узла.
        /// </summary>
        /// <param name="bft">Тип базовой функции.</param>
        /// <param name="ret_type">Тип возвращаемого значения.</param>
        /// <param name="is_overload">Перегружена-ли функция.</param>
		public basic_function_node(SemanticTree.basic_function_type bft,type_node ret_type,
            bool is_overload) :
			base(ret_type)
		{
			_basic_function_type=bft;
            _overload = is_overload;
		}
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:13,代码来源:functions.cs

示例11: set_access_level

 public void set_access_level(SemanticTree.field_access_level fal)
 {
     _field_access_level = fal;
 }
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:4,代码来源:functions.cs

示例12: common_method_node

        /// <summary>
        /// Конструктор узла.
        /// </summary>
        /// <param name="name">Имя функции.</param>
        /// <param name="ret_type"></param>
        /// <param name="loc">Расположение имени метода в программе.</param>
        /// <param name="cont_type">Тип, который содержит этот метод.</param>
        /// <param name="polymorphic_state">Обычный, виртуальный или статический метод.</param>
        /// <param name="field_access_level">Уровень доступа к методу.</param>
        /// <param name="scope">Пространство имен функции.</param>
		public common_method_node(string name,type_node ret_type, location loc, common_type_node cont_type,
            SemanticTree.polymorphic_state polymorphic_state, SemanticTree.field_access_level field_access_level, SymbolTable.Scope scope) :
			base(name,ret_type,loc,scope)
		{
			_cont_type=cont_type;
            _field_access_level = field_access_level;
            _polymorphic_state = polymorphic_state;
		}
开发者ID:Slav76,项目名称:pascalabcnet,代码行数:18,代码来源:functions.cs

示例13: visit

 /// <summary>
 /// Метод для обхода дерева посетителем.
 /// </summary>
 /// <param name="visitor">Класс - посетитель дерева.</param>
 public override void visit(SemanticTree.ISemanticVisitor visitor)
 {
     throw new PascalABCCompiler.TreeConverter.CompilerInternalError("Template class can't be visit.");
 }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:8,代码来源:templates.cs

示例14: check_for_usage_attribute

        private void check_for_usage_attribute(definition_node dn, AttributeTargets targets, string name, location loc, SemanticTree.attribute_qualifier_kind qualifier)
        {
        	switch (dn.semantic_node_type)
        	{
        		case semantic_node_type.common_type_node : 
        			{
        				common_type_node ctn = dn as common_type_node;
        				if (ctn.IsDelegate)
        				{
        					if ((targets & (AttributeTargets.Delegate)) != (AttributeTargets.Delegate))
        						AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_DELEGATE", name);
        				}
        				else
        				if (ctn.IsInterface)
        				{
        					if ((targets & AttributeTargets.Interface) != AttributeTargets.Interface)
        						AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_INTERFACE", name);
        				}
        				else
        				if (ctn.IsEnum)
        				{
        					if ((targets & (AttributeTargets.Enum)) != (AttributeTargets.Enum))
        						AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_ENUM", name);
        				}
        				else
        				if (ctn.is_value_type)
        				{
        					if ((targets & AttributeTargets.Struct) != AttributeTargets.Struct)
        						AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_STRUCT", name);
        				}
        				else
        					if ((targets & AttributeTargets.Class) != AttributeTargets.Class)
        						AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_CLASS", name);
        			}
        			break;
        		case semantic_node_type.common_method_node:
        			if ((dn as common_method_node).is_constructor)
        			{
        				if ((targets & AttributeTargets.Constructor) != AttributeTargets.Constructor)
        					AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_CONSTRUCTOR", name);
        			}
        			else
        				if ((targets & AttributeTargets.Method) != AttributeTargets.Method && qualifier != SemanticTree.attribute_qualifier_kind.return_kind)
        					AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_METHOD", name);
        			break;
        		case semantic_node_type.common_namespace_function_node:
        			if ((targets & AttributeTargets.Method) != AttributeTargets.Method && qualifier != SemanticTree.attribute_qualifier_kind.return_kind)
        				AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_METHOD", name);
        			break;
        		case semantic_node_type.class_field:
        			if ((targets & AttributeTargets.Field) != AttributeTargets.Field)
        				AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_FIELD", name);
        			break;
        		case semantic_node_type.common_property_node:
        			if ((targets & AttributeTargets.Property) != AttributeTargets.Property)
        				AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_PROPERTY", name);
        			break;
                case semantic_node_type.common_namespace_event:
        		case semantic_node_type.common_event:
        			if ((targets & AttributeTargets.Event) != AttributeTargets.Event)
        				AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_EVENT", name);
        			break;
        		case semantic_node_type.common_parameter:
        			if ((targets & AttributeTargets.Parameter) != AttributeTargets.Parameter)
                        AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_FIELD", name);
					break;
                case semantic_node_type.common_unit_node:
                    if ((targets & AttributeTargets.Assembly) != AttributeTargets.Assembly)
        				AddError(loc, "ATTRIBUTE_{0}_NOT_APPLICABLE_TO_ASSEMBLY", name);
        			break;
        	}
        }
开发者ID:PascalABC-CompilerLaboratory,项目名称:pascalabcnet,代码行数:72,代码来源:syntax_tree_visitor.cs

示例15: check_name_free

		public void check_name_free(string name,SemanticTree.ILocation name_loc)
		{
			SymbolInfo si=find_only_in_namespace(name);
			if (si==null)
			{
				return;
			}
			SemanticTree.ILocation first_loc=convertion_data_and_alghoritms.get_location(si.sym_info);
            //TODO: Можно передавать список всех повторных объявлений.
			throw new NameRedefinition(first_loc,name_loc);
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:11,代码来源:block_info.cs


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