public SymScope CheckForAccess(ElementScope ss, ElementScope es)
		{
			if (es.acc_mod == access_modifer.none || es.acc_mod == access_modifer.public_modifer || es.acc_mod == access_modifer.published_modifer || es.acc_mod == access_modifer.internal_modifer)
				return es;
			if (es.acc_mod == access_modifer.private_modifer)
				//if (entry_scope == ss.sc) return es; else 
				if (es.topScope is TypeScope && CheckPrivateForBaseAccess(entry_scope,es.topScope)) return es;
			if (es.acc_mod == access_modifer.protected_modifer)
				//if (entry_scope == ss.sc || CheckForBaseAccess(entry_scope,ss.sc))
				if (es.topScope is TypeScope && CheckForBaseAccess(entry_scope,es.topScope)) return es;
				//return es;
			return null;
		}
示例#2
0
 public virtual TypeScope GetInstance(List<TypeScope> gen_args)
 {
     TypeScope ts = new TypeScope(this.kind, this.topScope, this.baseScope);
     ts.original_type = this;
     ts.loc = this.loc;
     for (int i = 0; i < gen_args.Count; i++)
     {
         ts.AddGenericParameter(gen_args[i].si.name);
         ts.AddGenericInstanciation(gen_args[i]);
     }
     ts.si.name = this.si.name;
     ts.documentation = this.documentation;
     ts.si.description = ts.GetDescription();
     if (this.elementType != null)
     {
         ts.elementType = internalInstance(this.elementType, gen_args);
     }
     if (this.indexers != null && this.indexers.Count > 0)
     {
         ts.indexers = new List<TypeScope>();
         for (int j = 0; j < this.indexers.Count; j++)
             ts.indexers.Add(internalInstance(this.indexers[j], gen_args));
     }
     Hashtable procs = new Hashtable();
     for (int i = 0; i < members.Count; i++)
     {
         SymScope ss = members[i];
         ts.members.Add(ss);
         if (ss is ElementScope)
         {
             ElementScope es = ss as ElementScope;
             ElementScope new_es = new ElementScope(new SymInfo(es.si.name, es.si.kind, es.si.name), es.sc, ts);
             ts.members[i] = new_es;
             new_es.loc = es.loc;
             new_es.documentation = es.documentation;
             new_es.si.acc_mod = es.si.acc_mod;
             new_es.si.has_doc = es.si.has_doc;
             if (es.indexers != null && es.indexers.Count > 0)
             {
                 new_es.indexers = new List<TypeScope>();
                 for (int j = 0; j < es.indexers.Count; j++)
                     new_es.indexers.Add(internalInstance(es.indexers[j], gen_args));
             }
             if (es.elementType != null)
             {
                 new_es.elementType = internalInstance(es.elementType, gen_args);
             }
             new_es.sc = internalInstance(es.sc as TypeScope, gen_args);
             new_es.MakeDescription();
         }
         else if (ss is ProcScope)
         {
             ProcScope ps = ss as ProcScope;
             ProcScope new_proc = new ProcScope(ps.si.name, ts, ps.is_constructor);
             procs[ps] = new_proc;
             new_proc.loc = ps.loc;
             new_proc.documentation = ps.documentation;
             new_proc.si.acc_mod = ps.si.acc_mod;
             new_proc.is_static = ps.is_static;
             new_proc.is_virtual = ps.is_virtual;
             new_proc.is_abstract = ps.is_abstract;
             new_proc.is_override = ps.is_override;
             new_proc.is_reintroduce = ps.is_reintroduce;
             ts.members[i] = new_proc;
             if (ps.parameters != null)
                 for (int j = 0; j < ps.parameters.Count; j++)
                 {
                     ElementScope es = ps.parameters[j];
                     ElementScope es2 = new ElementScope(new SymInfo(es.si.name, es.si.kind, es.si.name), es.sc, new_proc);
                     es2.loc = es.loc;
                     es2.cnst_val = es.cnst_val;
                     es2.si.acc_mod = es.si.acc_mod;
                     es2.param_kind = es.param_kind;
                     es2.sc = internalInstance(es.sc as TypeScope, gen_args);
                     es2.MakeDescription();
                     new_proc.AddParameter(es2);
                 }
             new_proc.return_type = internalInstance(ps.return_type, gen_args);
             new_proc.Complete();
         }
     }
     foreach (ProcScope ps in procs.Keys)
     {
         ProcScope new_ps = procs[ps] as ProcScope;
         if (ps.nextProc != null && procs[ps.nextProc] != null)
         {
             new_ps.nextProc = procs[ps.nextProc] as ProcScope;
         }
     }
     return ts;
 }
		public static string GetDocumentation(ElementScope es)
		{
			try
			{
                if (es.declaringUnit == null)
                    return "";
                CodeCompletionTools.XmlDoc xdoc = (CodeCompletionTools.XmlDoc)ht[es.declaringUnit];
				if (xdoc != null)
				{
					string s = "";
					switch (es.si.kind)
					{
						case SymbolKind.Variable : s = GetNormalHint(xdoc.GetDocumentation("V:"+es.si.name,true)); break;
						case SymbolKind.Field : s = GetNormalHint(xdoc.GetDocumentation("F:"+es.topScope.si.name+"."+es.si.name,true)); break;
						case SymbolKind.Property : s = GetNormalHint(xdoc.GetDocumentation("P:"+es.topScope.si.name+"."+es.si.name,true)); break;
						case SymbolKind.Event : s = GetNormalHint(xdoc.GetDocumentation("E:"+es.topScope.si.name+"."+es.si.name,true)); break;
						case SymbolKind.Constant : s = GetNormalHint(xdoc.GetDocumentation("C:"+es.si.name,true)); break;
					}
					return s;
				}
			}
			catch(Exception e)
			{
				
			}
			return "";
		}
        public override void visit(procedure_header _procedure_header)
        {
            //throw new Exception("The method or operation is not implemented.");
            SymScope topScope;
            ProcScope ps = null;
            bool not_def = false;
            ProcRealization pr = null;
            bool is_realization = false;
            location loc = get_location(_procedure_header);
            if (_procedure_header.name != null)
            {
                _procedure_header.name.visit(this);

                if (_procedure_header.name.class_name != null)
                {
                    topScope = null;
                    if (_procedure_header.name.ln != null && _procedure_header.name.ln.Count > 0)
                    {
                        SymScope tmp_scope = cur_scope;
                        for (int i = 0; i < _procedure_header.name.ln.Count; i++)
                        {
                            tmp_scope = tmp_scope.FindName(_procedure_header.name.ln[i].name);
                            if (tmp_scope == null)
                                break;
                        }
                        topScope = tmp_scope;
                    }
                    else
                        topScope = cur_scope.FindName(_procedure_header.name.class_name.name);
                    if (topScope != null)
                    {
                        ps = topScope.FindNameOnlyInThisType(meth_name) as ProcScope;
                        if (ps != null && ps is CompiledMethodScope)
                            ps = null;
                        if (ps == null)
                        {
                            ps = new ProcScope(meth_name, topScope);
                            ps.head_loc = loc;
                            bool ext = false;
                            if (topScope is CompiledScope || topScope is ArrayScope || topScope is TypeSynonim && ((topScope as TypeSynonim).actType is CompiledScope || (topScope as TypeSynonim).actType is ArrayScope || (topScope as TypeSynonim).actType is DiapasonScope))
                                ext = true;
                            else if (!(topScope is TypeSynonim) && !(topScope is PointerScope) && !(topScope is SetScope) && !(topScope is FileScope))
                                ext = true;
                            if (ext)
                            {
                                not_def = true;
                                ps.is_extension = true;
                                ps.AddName("self", new ElementScope(new SymInfo("self", SymbolKind.Parameter, "self"), topScope, cur_scope));
                                ps.declaringType = topScope as TypeScope;
                                TypeScope ts = topScope as TypeScope;
                                if (topScope is TypeSynonim)
                                    ts = (ts as TypeSynonim).actType;
                                this.entry_scope.AddExtensionMethod(meth_name, ps, ts);
                                topScope.AddExtensionMethod(meth_name, ps, ts);
                            }
                        }
                        //while (ps != null && ps.already_defined) ps = ps.nextProc;
                        else ps = select_function_definition(ps, _procedure_header.parameters, null, topScope as TypeScope);
                        if (ps == null)
                        {
                            ps = new ProcScope(meth_name, cur_scope);
                            ps.head_loc = loc;
                        }
                        if (ps.parameters.Count != 0 && _procedure_header.parameters != null && is_proc_realization)
                        {
                            ps.parameters.Clear();
                            ps.already_defined = true;
                        }
                        if (impl_scope == null)
                        {
                            pr = new ProcRealization(ps, cur_scope);
                            pr.already_defined = true;
                            ps.proc_realization = pr;
                            pr.loc = cur_loc;
                            pr.head_loc = loc;
                            is_realization = true;
                            entry_scope.AddName("$method", pr);
                        }
                        else
                        {
                            pr = new ProcRealization(ps, impl_scope);
                            pr.already_defined = true;
                            ps.proc_realization = pr;
                            pr.loc = cur_loc;
                            is_realization = true;
                            pr.head_loc = loc;
                            impl_scope.AddName("$method", pr);
                        }
                    }
                    else
                    {
                        ps = new ProcScope(meth_name, cur_scope);
                        ps.head_loc = loc;
                    }
                }
                else
                {
                    ps = new ProcScope(meth_name, cur_scope);
                    if (has_extensionmethod_attr(_procedure_header.proc_attributes.proc_attributes) && _procedure_header.parameters.params_list.Count > 0)
                    {
                        ps.is_extension = true;
                        _procedure_header.parameters.params_list[0].vars_type.visit(this);
                        topScope = returned_scope;
                        ps.declaringType = topScope as TypeScope;
                        TypeScope ts = topScope as TypeScope;
                        if (topScope is TypeSynonim)
                            ts = (ts as TypeSynonim).actType;
                        if (ts.original_type != null && ts.instances != null)
                        {
                            bool pure_instance = true;
                            foreach (TypeScope gen_arg in ts.instances)
                            {
                                if (!(gen_arg is TemplateParameterScope))
                                    pure_instance = false;
                            }
                            if (pure_instance)
                                ts = ts.original_type;
                        }
                        this.entry_scope.AddExtensionMethod(meth_name, ps, ts);
                        topScope.AddExtensionMethod(meth_name, ps, ts);
                        pr = new ProcRealization(ps, cur_scope);
                        pr.already_defined = true;
                        ps.proc_realization = pr;
                        pr.loc = cur_loc;
                        pr.head_loc = loc;
                        if (impl_scope != null)
                            impl_scope.AddName("$method", pr);
                        else
                            this.entry_scope.AddName("$method", pr);
                    }
                    ps.head_loc = loc;
                    if (!ps.is_extension)
                    {
                        if (IsForward(_procedure_header))
                        {
                            cur_scope.AddName(meth_name, ps);
                            ps.is_forward = true;
                        }
                        else
                        {
                            bool found_in_top = false;
                            SymScope ss = null;
                            if (cur_scope is ImplementationUnitScope)
                            {
                                ss = (cur_scope as ImplementationUnitScope).topScope.FindNameOnlyInThisType(meth_name);
                                if (ss != null && ss is ProcScope)
                                {
                                    //ps = ss as ProcScope;
                                    //while ((ss as ProcScope).already_defined && (ss as ProcScope).nextProc != null)
                                    //	ss = (ss as ProcScope).nextProc;
                                    ps = select_function_definition(ss as ProcScope, _procedure_header.parameters, null, null);
                                    if (ps == null)
                                    {
                                        ps = new ProcScope(meth_name, cur_scope);
                                        ps.head_loc = loc;
                                    }
                                    //ps = ss as ProcScope;
                                    if (ps.parameters.Count != 0 && _procedure_header.parameters != null)
                                    {
                                        ps.parameters.Clear();
                                        ps.already_defined = true;
                                    }
                                    pr = new ProcRealization(ps, cur_scope);
                                    pr.already_defined = true;
                                    pr.loc = cur_loc;
                                    ps.proc_realization = pr;
                                    pr.head_loc = loc;
                                    is_realization = true;
                                    cur_scope.AddName("$method", pr);
                                    found_in_top = true;
                                }
                            }
                            if (!found_in_top) //ne nashli opisanie v interface chasti modilja
                            {
                                //ss = cur_scope.FindNameOnlyInType(meth_name);
                                ss = cur_scope.FindName(meth_name);
                                if (ss != null && ss is ProcScope)
                                {
                                    if ((ss as ProcScope).is_forward)
                                    {
                                        //if ((ss as ProcScope).parameters.Count != 0 && _procedure_header.parameters != null) (ss as ProcScope).parameters.Clear();
                                        pr = new ProcRealization(ss as ProcScope, cur_scope);
                                        pr.already_defined = true;
                                        pr.loc = cur_loc;
                                        cur_scope.AddName("$method", pr);
                                        returned_scope = pr;
                                        pr.head_loc = loc;
                                        return;
                                    }
                                    else
                                    {
                                        ps = new ProcScope(meth_name, cur_scope);
                                        ps.head_loc = loc;
                                        if (ps.topScope == ss.topScope)
                                        {
                                            while ((ss as ProcScope).nextProc != null && (ss as ProcScope).nextProc.topScope == ps.topScope) ss = (ss as ProcScope).nextProc;
                                            ProcScope tmp_ps = (ss as ProcScope).nextProc;
                                            (ss as ProcScope).nextProc = ps;
                                            ps.nextProc = tmp_ps;
                                            cur_scope.AddName(meth_name, ps);
                                            ps.si.name = meth_name;
                                        }
                                        else
                                        {
                                            ps.nextProc = ss as ProcScope;
                                            cur_scope.AddName(meth_name, ps);
                                        }
                                        //ps = select_function_definition(ss as ProcScope,_procedure_header.parameters);
                                    }
                                }
                                else
                                {
                                    cur_scope.AddName(meth_name, ps);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                ps = new ProcScope("", cur_scope);
                ps.head_loc = loc;
            }
            if ((!is_realization || not_def) && ps.loc == null)
                ps.loc = cur_loc;
            //ps.head_loc = loc;
            ps.declaringUnit = entry_scope;
            if (_procedure_header.template_args != null && !ps.IsGeneric())
            {
                foreach (ident s in _procedure_header.template_args.idents)
                {
                    ps.AddTemplateParameter(s.name);
                    TemplateParameterScope tps = new TemplateParameterScope(s.name, TypeTable.obj_type, ps);
                    tps.loc = get_location(s);
                    ps.AddName(s.name, tps);
                }
            }
            SetAttributes(ps, _procedure_header.proc_attributes);
            ps.is_static = _procedure_header.class_keyword;
            if (add_doc_from_text && this.converter.controller.docs != null && this.converter.controller.docs.ContainsKey(_procedure_header))
                ps.AddDocumentation(this.converter.controller.docs[_procedure_header]);

            if (is_proc_realization) ps.already_defined = true;
            else
            {
                ps.loc = loc;
            }
            if (_procedure_header.name == null || _procedure_header.name.class_name == null)
            {
                ps.acc_mod = cur_access_mod;
                ps.si.acc_mod = cur_access_mod;
            }
            SymScope tmp = cur_scope;
            cur_scope = ps;
            if (_procedure_header.parameters != null)
                foreach (typed_parameters pars in _procedure_header.parameters.params_list)
                {
                    pars.vars_type.visit(this);

                    if (returned_scope != null)
                    {
                        if (returned_scope is ProcScope)
                            returned_scope = new ProcType(returned_scope as ProcScope);
                        foreach (ident id in pars.idents.idents)
                        {
                            ElementScope si = new ElementScope(new SymInfo(id.name, SymbolKind.Parameter, id.name), returned_scope, ps);
                            si.loc = get_location(id);
                            si.param_kind = pars.param_kind;
                            if (pars.inital_value != null)
                            {
                                pars.inital_value.visit(this);
                                si.cnst_val = cnst_val.prim_val;
                            }
                            si.MakeDescription();
                            ps.AddName(id.name, si);
                            ps.AddParameter(si);
                        }
                    }
                }
            cur_scope = tmp;
            if (cur_scope is TypeScope && !ps.is_static)
                ps.AddName("self", new ElementScope(new SymInfo("self", SymbolKind.Parameter, "self"), cur_scope, ps));
            //cur_scope = ps;
            returned_scope = ps;
            ps.Complete();
            if (pr != null && not_def)
                pr.Complete();
        }
示例#5
0
 public ProcScope GetInstance(List<TypeScope> gen_args)
 {
     if (this.template_parameters == null || this.template_parameters.Count == 0)
         return this;
     ProcScope instance = new ProcScope(this.name, this.topScope, this.is_constructor);
     instance.parameters = new List<ElementScope>(this.parameters.Count);
     int i = 0;
     foreach (ElementScope parameter in this.parameters)
     {
         i++;
         if (parameter.sc is UnknownScope || (parameter.sc is TypeScope) && (parameter.sc as TypeScope).IsGenericParameter)
         {
             int ind = this.template_parameters.IndexOf((parameter.sc as TypeScope).Name);
             ElementScope inst_param = null;
             if (gen_args.Count > ind && ind != -1)
                 inst_param = new ElementScope(parameter.si, gen_args[ind], parameter.topScope);
             else
                 inst_param = new ElementScope(parameter.si, parameter.sc, parameter.topScope);
             instance.parameters.Add(inst_param);
         }
         else
         {
             ElementScope inst_param = null;
             if ((parameter.sc as TypeScope).IsGeneric)
                 inst_param = new ElementScope(parameter.si, (parameter.sc as TypeScope).GetInstance(gen_args), parameter.topScope);
             else
                 inst_param = new ElementScope(parameter.si, parameter.sc, parameter.topScope);
             instance.parameters.Add(inst_param);
         }
         if (parameter.param_kind == parametr_kind.params_parametr && i < gen_args.Count)
             gen_args.RemoveRange(i, gen_args.Count - i);
     }
     instance.si = this.si;
     instance.return_type = this.return_type.GetInstance(gen_args);
     return instance;
 }
 public override void visit(function_lambda_definition _function_lambda_definition)
 {
     ProcScope ps = new ProcScope(_function_lambda_definition.lambda_name, this.cur_scope);
     ps.loc = get_location(_function_lambda_definition);
     cur_scope.AddName(_function_lambda_definition.lambda_name, ps);
     if (_function_lambda_definition.ident_list != null)
         foreach (ident id in _function_lambda_definition.ident_list.idents)
         {
             ElementScope es = new ElementScope(new SymInfo(id.name, SymbolKind.Parameter, ""), new UnknownScope(new SymInfo("T", SymbolKind.Type, "T")), ps);
             ps.AddName(id.name, es);
             ps.AddParameter(es);
             es.loc = get_location(id);
         }
     _function_lambda_definition.proc_body.visit(this);
     ps.return_type = returned_scope as TypeScope;
     returned_scope = new ProcType(ps);
 }
 public override void visit(PascalABCCompiler.SyntaxTree.for_node _for_node)
 {
     //throw new Exception("The method or operation is not implemented.");
     SymScope tmp = cur_scope;
     //if (_for_node.type_name != null)
     {
     	SymScope stmt_scope = new BlockScope(cur_scope);
 		cur_scope.AddName("$block_scope",stmt_scope);
 		stmt_scope.loc = get_location(_for_node);
 		returned_scope = null;
 		if (_for_node.type_name != null)
 		_for_node.type_name.visit(this);
 		if (returned_scope != null)
 		{
 			cur_scope = stmt_scope;
 			ElementScope es = new ElementScope(new SymInfo(_for_node.loop_variable.name, SymbolKind.Variable,_for_node.loop_variable.name),returned_scope,cur_scope);
 			stmt_scope.AddName(_for_node.loop_variable.name,es);
 			es.loc = get_location(_for_node.loop_variable);
 			returned_scope = null;
 		}
 		else
 		{
 			_for_node.initial_value.visit(this);
 			if (returned_scope != null)
 			{
 				cur_scope = stmt_scope;
 				if (_for_node.create_loop_variable)
 				{
 					ElementScope es = new ElementScope(new SymInfo(_for_node.loop_variable.name, SymbolKind.Variable,_for_node.loop_variable.name),returned_scope,cur_scope);
 					stmt_scope.AddName(_for_node.loop_variable.name,es);
 					es.loc = get_location(_for_node.loop_variable);
 				}
 				returned_scope = null;
 			}
 		}
     }
     if (_for_node.statements != null)
     _for_node.statements.visit(this);
     cur_scope = tmp;
 }
		private ElementScope CreateInterfaceNamespaceVariable(string name, int offset)
        {
			br.ReadInt32();
			br.ReadBoolean();
            br.ReadInt32();
            TypeScope type = GetTypeReference();
            ElementScope nv = new ElementScope(new SymInfo(name, SymbolKind.Variable,name),type,cur_scope);
            nv.declaringUnit = root_scope;
            AddMember(nv, offset);
            return nv;
        }
		private ElementScope GetParameter(ProcScope func)
		{
			int offset = (int)br.BaseStream.Position-start_pos;
			br.ReadByte();
			string s = br.ReadString();
			TypeScope tn = GetTypeReference();
			concrete_parameter_type cpt = (concrete_parameter_type)br.ReadByte();
            ElementScope p = new ElementScope(new SymInfo(s, SymbolKind.Parameter,s),tn,null,null);
            bool is_params = br.ReadBoolean();
            if (is_params) p.param_kind = parametr_kind.params_parametr;
            else
            switch (cpt)
            {
                case concrete_parameter_type.cpt_const: p.param_kind = parametr_kind.const_parametr; break;
                case concrete_parameter_type.cpt_var: p.param_kind = parametr_kind.var_parametr; break;
                case concrete_parameter_type.cpt_none: p.param_kind = parametr_kind.none; break;
            }
            br.ReadBoolean();
            if (CanReadObject())
			{
				br.ReadInt32();//CreateExpression();
			}
            br.ReadInt32();//attributes
			//members[offset] = p;           
			return p;
		}
		private ElementScope CreateInterfaceProperty(string name, int offset)
        {
            ElementScope prop = members[offset] as ElementScope;
            if (prop != null) return prop;
            int name_ref = br.ReadInt32();
            TypeScope type = GetTypeReference();
            if (br.ReadByte() == 1) br.ReadInt32();

            if (br.ReadByte() == 1) br.ReadInt32();
            int num = br.ReadInt32();
            List<ElementScope> prms = new List<ElementScope>();
            for (int i = 0; i < num; i++)
            	prms.Add(GetParameter(null));
            br.ReadInt32();
            PascalABCCompiler.SemanticTree.field_access_level fal = (PascalABCCompiler.SemanticTree.field_access_level)br.ReadByte();
            PascalABCCompiler.SemanticTree.polymorphic_state ps = (PascalABCCompiler.SemanticTree.polymorphic_state)br.ReadByte();
            //ReadDebugInfo();
            prop = new ElementScope(new SymInfo(name, SymbolKind.Property,name),type,cur_scope);
            prop.declaringUnit = root_scope;
            switch (fal)
            {
            	case PascalABCCompiler.SemanticTree.field_access_level.fal_internal : prop.acc_mod = access_modifer.internal_modifer; break;
            	case PascalABCCompiler.SemanticTree.field_access_level.fal_private : prop.acc_mod = access_modifer.private_modifer; return null;
            	case PascalABCCompiler.SemanticTree.field_access_level.fal_protected : prop.acc_mod = access_modifer.protected_modifer; break;
            	case PascalABCCompiler.SemanticTree.field_access_level.fal_public : prop.acc_mod = access_modifer.public_modifer; break;
            	
            }
            
            switch (ps)
            {
            	case PascalABCCompiler.SemanticTree.polymorphic_state.ps_static : prop.is_static = true; break;
            	case PascalABCCompiler.SemanticTree.polymorphic_state.ps_virtual : prop.is_virtual = true; break;
            }
            //members[offset] = prop;
            AddMember(prop, offset);
            
            return prop;
        }
		private ElementScope CreateInterfaceConstantDefinition(string name, int offset)
        {
            ElementScope ncd = members[offset] as ElementScope;
            if (ncd != null) return ncd;
            br.ReadBoolean();
            br.ReadInt32();
            //type_node tn = GetTypeReference();
            br.ReadInt32();//namespace
            //object en = CreateExpression();
            br.ReadInt32();//init_value
            ReadDebugInfo();
            ncd = new ElementScope(new SymInfo(name, SymbolKind.Constant,name),null,cur_scope);
            ncd.declaringUnit = root_scope;
            //???
            AddMember(ncd, offset);
            return ncd;
        }
		private ElementScope CreateInterfaceClassField(string name, int offset)
        {
            ElementScope field = members[offset] as ElementScope;
            if (field != null) return field;
            int name_off = br.ReadInt32();
            TypeScope type = GetTypeReference();
            field = new ElementScope(new SymInfo(name, SymbolKind.Field,name),type,cur_scope);
            field.declaringUnit = root_scope;
            AddMember(field, offset);
            object initv = null;
            if (CanReadObject())
                initv = CreateExpression();
            br.ReadInt32();
            PascalABCCompiler.SemanticTree.field_access_level fal = (PascalABCCompiler.SemanticTree.field_access_level)br.ReadByte();
            PascalABCCompiler.SemanticTree.polymorphic_state ps = (PascalABCCompiler.SemanticTree.polymorphic_state)br.ReadByte();
           	
            switch (fal)
            {
            	case PascalABCCompiler.SemanticTree.field_access_level.fal_internal : field.acc_mod = access_modifer.internal_modifer; break;
            	case PascalABCCompiler.SemanticTree.field_access_level.fal_private : field.acc_mod = access_modifer.private_modifer; return null;
            	case PascalABCCompiler.SemanticTree.field_access_level.fal_protected : field.acc_mod = access_modifer.protected_modifer; break;
            	case PascalABCCompiler.SemanticTree.field_access_level.fal_public : field.acc_mod = access_modifer.public_modifer; break;
            	
            }
            
            switch (ps)
            {
            	case PascalABCCompiler.SemanticTree.polymorphic_state.ps_static : field.is_static = true; break;
            	case PascalABCCompiler.SemanticTree.polymorphic_state.ps_virtual : field.is_virtual = true; break;
            }
           
            //field = new class_field(name,type,cont,ps,fal,loc);
            field.cnst_val = initv;
            //members[offset] = field;
            AddMember(field, offset);            
            return field;
        }
示例#13
0
		public SymScope CheckForAccess(SymScope ss, ElementScope es)
		{
			if (ss == null) return null;
			if (ss is ProcScope) return CheckForAccess(ss.topScope,es);
			if (ss is TypeScope) 
			if (es.topScope is TypeScope) return CheckForAccess(es.topScope as TypeScope,es);
			return es;
		}
示例#14
0
		public SymScope CheckForAccess(TypeScope ss, ElementScope es)
		{
			if (es.acc_mod == access_modifer.none || es.acc_mod == access_modifer.public_modifer || es.acc_mod == access_modifer.published_modifer || es.acc_mod == access_modifer.internal_modifer)
				return es;
			if (es.acc_mod == access_modifer.private_modifer)
				if (entry_scope == ss) return es; else if (CheckPrivateForBaseAccess(entry_scope,ss)) return es;
			if (es.acc_mod == access_modifer.protected_modifer)
				if (entry_scope == ss || CheckForBaseAccess(entry_scope,ss))
				return es;
			return null;
		}
 public override void visit(foreach_stmt _foreach_stmt)
 {
     //throw new Exception("The method or operation is not implemented.");
     SymScope tmp = cur_scope;
     if (_foreach_stmt.type_name != null)
     {
     	SymScope stmt_scope = new BlockScope(cur_scope);
 		cur_scope.AddName("$block_scope",stmt_scope);
 		stmt_scope.loc = get_location(_foreach_stmt);
         if (_foreach_stmt.type_name is no_type_foreach)
         {
             _foreach_stmt.in_what.visit(this);
             if (returned_scope != null)
                 returned_scope = returned_scope.GetElementType();
         }
         else
         {
             _foreach_stmt.type_name.visit(this);
         }
 		if (returned_scope != null)
 		{
 			cur_scope = stmt_scope;
 			ElementScope es = new ElementScope(new SymInfo(_foreach_stmt.identifier.name, SymbolKind.Variable,_foreach_stmt.identifier.name),returned_scope,cur_scope);
 			es.loc = get_location(_foreach_stmt.identifier);
 			stmt_scope.AddName(_foreach_stmt.identifier.name,es);
 		}
     }
     if (_foreach_stmt.stmt != null)
     _foreach_stmt.stmt.visit(this);
     cur_scope = tmp;
 }
 /// <summary>
 /// Выдает все типы (используется после new)
 /// </summary>
 public SymInfo[] GetTypes(expression expr, int line, int col, out SymInfo out_si)
 {
     out_si = null;
     if (stv.cur_scope == null) return null;
     SymScope si = stv.FindScopeByLocation(line + 1, col + 1);//stv.cur_scope;
     SymInfo[] elems = null;
     if (si == null) return null;
     elems = si.GetNamesInAllTopScopes(true, new ExpressionVisitor(si, stv), false);
     if (expr != null)
     {
         ExpressionVisitor ev = new ExpressionVisitor(expr, si, stv);
         si = ev.GetScopeOfExpression();
         if (si is TypeScope)
             si = new ElementScope(si);
     }
     List<SymInfo> result_names = new List<SymInfo>();
     if (elems == null) return null;
     for (int i = 0; i < elems.Length; i++)
     {
         if (!elems[i].name.StartsWith("$") && (elems[i].kind == SymbolKind.Class || elems[i].kind == SymbolKind.Namespace) && elems[i].kind != SymbolKind.Interface)
         {
             if (expr != null && si != null && si is ElementScope &&
             string.Compare(elems[i].name, (si as ElementScope).sc.si.name, true) == 0)
             {
                 out_si = elems[i];
                 //out_si = new SymInfo(elems[i].name,elems[i].kind,elems[i].describe);
                 string s = CodeCompletionController.CurrentParser.LanguageInformation.GetSimpleDescriptionWithoutNamespace((si as ElementScope).sc as PascalABCCompiler.Parsers.ITypeScope);
                 if (s != out_si.name)
                     out_si.addit_name = s;
                 //        				if (((si as ElementScope).sc as TypeScope).TemplateArguments != null)
                 //        				{
                 //        					SymInfo tmp_si = new SymInfo(null,elems[i].kind,elems[i].describe);
                 //        					StringBuilder sb = new StringBuilder();
                 //        					string[] template_args = ((si as ElementScope).sc as TypeScope).TemplateArguments;
                 //        					sb.Append(elems[i].name);
                 //        					sb.Append('<');
                 //        					for (int j=0; j<template_args.Length; j++)
                 //        					{
                 //        						sb.Append(template_args[j]);
                 //        						if (j<template_args.Length-1)
                 //        							sb.Append(',');
                 //        					}
                 //        					sb.Append('>');
                 //        					elems[i] = tmp_si;
                 //        					out_si = tmp_si;
                 //        				}
             }
             result_names.Add(elems[i]);
         }
     }
     if (out_si == null && expr != null && si != null && si is ElementScope)
     {
         out_si = (si as ElementScope).sc.si;
         if (!out_si.name.StartsWith("$") && out_si.kind != SymbolKind.Interface)
         {
             out_si.name = (si as ElementScope).sc.GetFullName();
             result_names.Add(out_si);
         }
         else
         {
             out_si = null;
         }
     }
     return result_names.ToArray();
 }
        public override void visit(var_def_statement _var_def_statement)
        {
        	try
        	{
        		returned_scope = null;
        		if (_var_def_statement.vars_type != null)
        			_var_def_statement.vars_type.visit(this);
        		if (_var_def_statement.vars_type == null && _var_def_statement.inital_value != null || _var_def_statement.inital_value is function_lambda_definition)
        		{
        			_var_def_statement.inital_value.visit(this);
        		}
           		// if (si == null) dn = compiled_type_node.get_type_node(PascalABCCompiler.NetHelper.NetHelper.FindType((_var_def_statement.vars_type as named_type_reference).names[0].name,unl));
           
            	if (returned_scope == null) return;
                if (returned_scope is ProcScope)
                {
                    if (_var_def_statement.vars_type != null)
                        returned_scope = new ProcType(returned_scope as ProcScope);
                    else
                        returned_scope = (returned_scope as ProcScope).return_type;
                }

            	if (_var_def_statement.vars != null)
            	foreach (ident s in _var_def_statement.vars.idents)
            	{
           			SymInfo si = new SymInfo(s.name, SymbolKind.Variable,s.name);
           			if (cur_scope is TypeScope) si.kind = SymbolKind.Field;
           			if (_var_def_statement.is_event) si.kind = SymbolKind.Event;
           			ElementScope es = new ElementScope(si, returned_scope,cur_scope);
           			if (add_doc_from_text && this.converter.controller.docs != null && this.converter.controller.docs.ContainsKey(_var_def_statement))
           			es.AddDocumentation(this.converter.controller.docs[_var_def_statement]);
           			es.acc_mod = cur_access_mod;
           			es.is_static = _var_def_statement.var_attr == definition_attribute.Static;
           			es.si.acc_mod = cur_access_mod;
           			es.loc = get_location(s);
           			cur_scope.AddName(s.name,es);
           			es.declaringUnit = cur_scope;
            	}
        	}
        	catch(Exception e)
        	{
        		
        	}
        }
 public override void visit(typed_const_definition _typed_const_definition)
 {
     //throw new Exception("The method or operation is not implemented.");
     _typed_const_definition.const_type.visit(this);
     if (returned_scope == null) return;
     cnst_val.prim_val = null;
     SymScope cnst_type = returned_scope;
     try
     {
     	_typed_const_definition.const_value.visit(this);
     }
     catch(Exception e)
     {
     	
     }
     ElementScope es = new ElementScope(new SymInfo(_typed_const_definition.const_name.name, SymbolKind.Constant,_typed_const_definition.const_name.name),cnst_type,cnst_val.prim_val,cur_scope);
     cur_scope.AddName(_typed_const_definition.const_name.name, es);
     es.loc = get_location(_typed_const_definition);
     es.declaringUnit = entry_scope;
     if (add_doc_from_text && this.converter.controller.docs != null && this.converter.controller.docs.ContainsKey(_typed_const_definition))
 		es.AddDocumentation(this.converter.controller.docs[_typed_const_definition]);
     cnst_val.prim_val = null;
 }
 public override void visit(name_assign_expr _name_assign_expr) // SSM 27.06.13
 {
     returned_scope = null;
     _name_assign_expr.expr.visit(this);
     if (returned_scope != null)
     {
         ElementScope es = new ElementScope(new SymInfo(_name_assign_expr.name.name, SymbolKind.Property, ""), returned_scope, cur_scope);
         cur_scope.AddName(_name_assign_expr.name.name, es);
     }
 }
  private void add_standart_types(SymScope cur_scope)
  {
  	string type_name = null;
  	//obj_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.object_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.object_type_name),typeof(object));
  	cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.object_type_name,TypeTable.obj_type);
  	//int_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name),typeof(int));
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name, int_type);
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.IntType);
  	if (type_name != null) cur_scope.AddName(type_name, TypeTable.int_type);
  	//real_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name),typeof(double));
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name,real_type);
      type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.DoubleType);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.real_type);
  	//string_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name, SymbolKind.Class,PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name),typeof(string));
  	cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name,TypeTable.string_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name,
  	//new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.ShortStringTypeName),typeof(string)));
  	//char_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name),typeof(char));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.CharType);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.char_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name,char_type);
  	//bool_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name),typeof(bool));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.BoolType);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.bool_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name,bool_type);
  	//byte_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name),typeof(byte));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.ByteType);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.byte_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name,byte_type);
  	//int16_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name),typeof(short));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.ShortType);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.int16_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name,int16_type);
  	//sbyte_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name),typeof(sbyte));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.SByteType);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.sbyte_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name,sbyte_type);
  	//uint16_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name),typeof(ushort));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.UShortType);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.uint16_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name,uint16_type);
  	//uint32_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name),typeof(uint));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.UIntType);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.uint32_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name,uint32_type);
  	//int64_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name),typeof(long));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.Int64Type);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.int64_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name,int64_type);
  	//uint64_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name),typeof(ulong));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.UInt64Type);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.uint64_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name,uint64_type);
  	//float_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name),typeof(float));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.FloatType);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.float_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name,float_type);
  	//ptr_type = new CompiledScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name, SymbolKind.Type,PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name),Type.GetType("System.Void*"));
  	type_name = this.converter.controller.Parser.LanguageInformation.GetStandardTypeByKeyword(PascalABCCompiler.Parsers.KeywordKind.PointerType);
      if (type_name != null) cur_scope.AddName(type_name, TypeTable.ptr_type);
  	//cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name,ptr_type);
  	ProcScope ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.set_length_procedure_name,null);
  	ps.AddParameter(new ElementScope(new SymInfo("arr", SymbolKind.Parameter,"arr"),new ArrayScope(),null,ps));
  	ps.parameters[0].param_kind = parametr_kind.var_parametr;
  	ps.AddParameter(new ElementScope(new SymInfo("length", SymbolKind.Parameter,"length"),TypeTable.int_type,null,ps));
  	ps.Complete();
  	cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.set_length_procedure_name,ps);
  	cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name,new ElementScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name, SymbolKind.Constant,PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name),TypeTable.bool_type,true,null));
  	cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name,new ElementScope(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name, SymbolKind.Constant,PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name),TypeTable.bool_type,false,null));
 		ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.new_procedure_name,null);
 		ElementScope prm = new ElementScope(new SymInfo("p", SymbolKind.Parameter,"p"),TypeTable.ptr_type,null,ps);
 		prm.param_kind = parametr_kind.var_parametr;
 		ps.AddParameter(prm);
 		ps.Complete();
 		cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.new_procedure_name,ps);
 		ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.dispose_procedure_name,null);
 		prm = new ElementScope(new SymInfo("p", SymbolKind.Parameter,"p"),TypeTable.ptr_type,null,ps);
 		prm.param_kind = parametr_kind.var_parametr;
 		ps.AddParameter(prm);
 		ps.Complete();
 		cur_scope.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.dispose_procedure_name,ps);
 }
 private ProcScope select_function_definition(ProcScope ps, formal_parameters prms, TypeScope return_type, TypeScope declType)
 {
 	SymScope tmp = returned_scope;
 	List<ElementScope> lst = new List<ElementScope>();
 	if (prms != null)
 	{
 	foreach (typed_parameters pars in prms.params_list)
     {
     	pars.vars_type.visit(this);
     	
     	if (returned_scope != null)
     	{
     		foreach (ident id in pars.idents.idents)
     		{
     			if (returned_scope is ProcScope)
     				returned_scope = new ProcType(returned_scope as ProcScope);
     			ElementScope si = new ElementScope(new SymInfo(id.name, SymbolKind.Parameter,id.name),returned_scope,ps);
     			si.loc = get_location(id);
     			si.param_kind = pars.param_kind;
     			lst.Add(si);
     		}
     	}
     }
 	while (ps != null)
 	{
 		if (ps.parameters != null)
 		{
 			if (ps.parameters.Count == lst.Count)
 			{
 				bool eq = true;
 				for (int i=0; i<lst.Count; i++)
 				{
 					TypeScope left = ps.parameters[i].sc as TypeScope;
 					TypeScope right = lst[i].sc as TypeScope;
 					if (!left.IsEqual(right) || ps.parameters[i].param_kind != lst[i].param_kind)
 					{
 						eq = false;
 						break;
 					}
 				}
 				if (eq)
 				{
 					if (ps.return_type == null && return_type == null) return ps;
 					if (ps.return_type != null && return_type != null)
 					{
 						if ((ps.return_type as TypeScope).IsEqual(return_type))
 						return ps;
 					}
 				}
 			}
 		}
 		ps = ps.nextProc;
 	}
 	}
 	else 
 	{
 		while (ps != null)
 		{
 			if (ps.parameters == null || ps.parameters.Count == 0)
 			{
 				if (ps.return_type == null && return_type == null) return ps;
 					if (ps.return_type != null && return_type != null)
 					{
 						if ((ps.return_type as TypeScope).IsEqual(return_type))
 						return ps;
 					}
 					else return null;
 			}
 			ps = ps.nextProc;
 		}
 	}
 	returned_scope = tmp;
 	return ps;
 }
        public override void visit(simple_property _simple_property)
        {
            //throw new Exception("The method or operation is not implemented.");
            _simple_property.property_type.visit(this);
            if (returned_scope == null)
            	return;
            ElementScope es = new ElementScope(new SymInfo(_simple_property.property_name.name, SymbolKind.Property,_simple_property.property_name.name),
                                                                                   returned_scope, cur_scope);
            es.declaringUnit = entry_scope;
            if (_simple_property.array_default != null)
            {
            	TypeScope ts = cur_scope as TypeScope;
            	if (_simple_property.parameter_list != null)
            	{
            		ts.elementType = returned_scope as TypeScope;
            		for (int i=0; i<_simple_property.parameter_list.parameters.Count; i++)
            		{
            			_simple_property.parameter_list.parameters[i].type.visit(this);
            			if (returned_scope == null || !(returned_scope is TypeScope)) return;
            			for (int j=0; j<_simple_property.parameter_list.parameters[i].names.idents.Count; j++)
            				ts.AddIndexer(returned_scope as TypeScope);
            		}
            		
            	}
            }
            if (_simple_property.parameter_list != null)
            {
            	es.elementType = returned_scope as TypeScope;
            	for (int i=0; i<_simple_property.parameter_list.parameters.Count; i++)
            	{
            		_simple_property.parameter_list.parameters[i].type.visit(this);
            		if (returned_scope == null || !(returned_scope is TypeScope)) return;
            		for (int j=0; j<_simple_property.parameter_list.parameters[i].names.idents.Count; j++)
            			es.AddIndexer(returned_scope as TypeScope);
            	}
            	es.MakeDescription();
            }
            es.loc = get_location(_simple_property);
			if (add_doc_from_text && this.converter.controller.docs != null && this.converter.controller.docs.ContainsKey(_simple_property))
        		es.AddDocumentation(this.converter.controller.docs[_simple_property]);
			if (_simple_property.attr == definition_attribute.Static)
				es.is_static = true;
            es.acc_mod = cur_access_mod;
            es.si.acc_mod = cur_access_mod;
            cur_scope.AddName(_simple_property.property_name.name,es);
            
        }
示例#23
0
 public override void AddParameter(ElementScope par)
 {
     def_proc.AddParameter(par);
 }
 public override void visit(enum_type_definition _enum_type_definition)
 {
     bool is_tuple = false;
     template_type_reference tuple = new template_type_reference();
     tuple.name = new named_type_reference(new ident_list(new ident("System"), new ident("Tuple")).idents);
     template_param_list tpl = new template_param_list();
     tuple.params_list = tpl;
     if (_enum_type_definition.enumerators != null)
         foreach (enumerator en in _enum_type_definition.enumerators.enumerators)
         {
             if (!(en.name is named_type_reference))
             {
                 is_tuple = true;
             }
             else
             {
                 named_type_reference ntr = en.name as named_type_reference;
                 if (ntr.names.Count > 1 || ntr.names.Count == 0)
                 {
                     is_tuple = true;
                 }
                 else
                 {
                     SymScope ss = cur_scope.FindName(ntr.FirstIdent.name);
                     if (ss != null && ss is TypeScope)
                     {
                         is_tuple = true;
                     }
                 }
             }
             tpl.Add(en.name);
         }
     if (is_tuple)
     {
         tuple.visit(this);
         return;
     }
     //throw new Exception("The method or operation is not implemented.");
     EnumScope enum_scope = new EnumScope(SymbolKind.Enum, cur_scope,
                                  TypeTable.get_compiled_type(new SymInfo(typeof(Enum).Name, SymbolKind.Enum, typeof(Enum).FullName), typeof(Enum)));
     enum_scope.loc = get_location(_enum_type_definition);
     enum_scope.topScope = cur_scope;
     List<ElementScope> elems = new List<ElementScope>();
     if (_enum_type_definition.enumerators != null)
         foreach (enumerator en in _enum_type_definition.enumerators.enumerators)
         {
             var name = (en.name as named_type_reference).FirstIdent.name;
             ElementScope ss = new ElementScope(new SymInfo(name, SymbolKind.Constant, name),/*cur_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name)*/enum_scope, cur_scope);
             ss.is_static = true;
             ss.cnst_val = name;
             elems.Add(ss);
             ss.loc = get_location(en);
             cur_scope.AddName(name, ss);
             enum_scope.AddName(name, ss);
             enum_scope.AddEnumConstant(name);
             if (this.converter.controller.docs.ContainsKey(en))
                 ss.AddDocumentation(this.converter.controller.docs[en]);
         }
     for (int i = 0; i < elems.Count; i++)
         elems[i].MakeDescription();
     returned_scope = enum_scope;
 }
示例#25
0
 public virtual void AddParameter(ElementScope par)
 {
     parameters.Add(par);
 }
        public override void visit(destructor _destructor)
        {
            //throw new Exception("The method or operation is not implemented.");
            SymScope topScope = cur_scope;
            ProcScope ps = null;
            location loc = get_location(_destructor);
            bool is_realization = false;
            _destructor.name.visit(this);
            if (_destructor.name.class_name != null)
            {
                topScope = cur_scope.FindName(_destructor.name.class_name.name);
                if (topScope != null)
                {
                    ps = topScope.FindNameOnlyInThisType(meth_name) as ProcScope;
                    if (ps == null)
                    {
                        ps = new ProcScope(meth_name, cur_scope);
                        ps.head_loc = loc;
                    }
                    else ps = select_function_definition(ps, _destructor.parameters, null, topScope as TypeScope);
                    //while (ps != null && ps.already_defined) ps = ps.nextProc;
                    if (ps == null)
                    {
                        ps = new ProcScope(meth_name, cur_scope);
                        ps.head_loc = loc;
                    }
                    if (ps.parameters.Count != 0 && _destructor.parameters != null)
                    {
                        ps.parameters.Clear();
                        ps.already_defined = true;
                    }
                    if (impl_scope == null)
                    {
                        ProcRealization pr = new ProcRealization(ps, cur_scope);
                        pr.already_defined = true;
                        ps.proc_realization = pr;
                        pr.loc = cur_loc;
                        pr.head_loc = loc;
                        is_realization = true;
                        entry_scope.AddName("$method", pr);

                    }
                    else
                    {
                        ProcRealization pr = new ProcRealization(ps, impl_scope);
                        pr.already_defined = true;
                        ps.proc_realization = pr;
                        pr.loc = cur_loc;
                        pr.head_loc = loc;
                        is_realization = true;
                        impl_scope.AddName("$method", pr);
                    }
                }
                else
                {
                    ps = new ProcScope(meth_name, cur_scope);
                    ps.head_loc = loc;
                }
            }
            else
            {
                ps = new ProcScope(meth_name, cur_scope);
                ps.head_loc = loc;
                SymScope ss = cur_scope.FindNameOnlyInThisType(meth_name);
                if (ss != null && ss is ProcScope)
                {
                    while ((ss as ProcScope).nextProc != null) ss = (ss as ProcScope).nextProc;
                    (ss as ProcScope).nextProc = ps;
                    cur_scope.AddName("$method", ps);
                    ps.si.name = meth_name;
                }
                else
                {
                    cur_scope.AddName(meth_name, ps);
                }
            }
            if (!is_realization && ps.loc == null)
                ps.loc = cur_loc;
            //ps.head_loc = loc;
            ps.declaringUnit = entry_scope;
            SetAttributes(ps, _destructor.proc_attributes);
            if (add_doc_from_text && this.converter.controller.docs != null && this.converter.controller.docs.ContainsKey(_destructor))
                ps.AddDocumentation(this.converter.controller.docs[_destructor]);
            if (is_proc_realization) ps.already_defined = true;
            else ps.loc = loc;
            if (_destructor.name == null || _destructor.name.class_name == null)
            {
                ps.acc_mod = cur_access_mod;
                ps.si.acc_mod = cur_access_mod;
            }
            if (_destructor.parameters != null)
                foreach (typed_parameters pars in _destructor.parameters.params_list)
                {
                    pars.vars_type.visit(this);
                    if (returned_scope != null)
                    {
                        if (returned_scope is ProcScope)
                            returned_scope = new ProcType(returned_scope as ProcScope);
                        foreach (ident id in pars.idents.idents)
                        {
                            ElementScope si = new ElementScope(new SymInfo(id.name, SymbolKind.Parameter, id.name), returned_scope, ps);
                            si.loc = get_location(id);
                            ps.AddName(id.name, si);
                            si.param_kind = pars.param_kind;
                            si.MakeDescription();
                            ps.AddParameter(si);
                        }
                    }
                }
            if (cur_scope is TypeScope)
                ps.AddName("self", new ElementScope(new SymInfo("self", SymbolKind.Parameter, "self"), cur_scope, ps));
            //cur_scope = ps;
            returned_scope = ps;
            ps.Complete();
        }
示例#27
0
        static TypeTable()
        {
            obj_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.object_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.object_type_name), typeof(object));

            int_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name), typeof(int));


            real_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name), typeof(double));

            string_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name, SymbolKind.Class, PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name), typeof(string));

            char_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name), typeof(char));

            bool_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name), typeof(bool));

            byte_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name), typeof(byte));

            int16_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name), typeof(short));

            sbyte_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name), typeof(sbyte));

            uint16_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name), typeof(ushort));

            uint32_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name), typeof(uint));

            int64_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name), typeof(long));

            uint64_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name), typeof(ulong));

            float_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name), typeof(float));

            ptr_type = get_compiled_type(new SymInfo(PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name, SymbolKind.Type, PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name), Type.GetType("System.Void*"));

            void_type = get_compiled_type(new SymInfo("void", SymbolKind.Type, "void"), typeof(void));

            ProcScope ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, int_type);
            int_plus = ps;
            ElementScope left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ElementScope right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = int_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, int_type);
            int_minus = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = int_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, int_type);
            int_mul = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = int_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, int_type);
            int_div = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = int_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, int_type);
            int_mod = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = int_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, int_type);
            int_shl = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = int_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, int_type);
            int_shr = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = int_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, int_type);
            int_and = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = int_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, int_type);
            int_or = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = int_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, int_type);
            int_xor = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = int_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, int_type);
            int_eq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, int_type);
            int_noteq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, int_type);
            int_sm = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, int_type);
            int_smeq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, int_type);
            int_gr = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, int_type);
            int_greq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int_type, int_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, ps);

            //byte type
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, int_plus);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, int_minus);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, int_mul);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, int_div);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, int_mod);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, int_shl);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, int_shr);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, int_eq);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, int_noteq);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, int_sm);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, int_smeq);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, int_gr);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, int_greq);
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, byte_type);
            byte_and = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), byte_type, byte_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), byte_type, byte_type);
            ps.return_type = byte_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, byte_type);
            byte_or = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), byte_type, byte_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), byte_type, byte_type);
            ps.return_type = byte_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, byte_type);
            byte_xor = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), byte_type, byte_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), byte_type, byte_type);
            ps.return_type = byte_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            byte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, ps);

            //sbyte
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, int_plus);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, int_minus);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, int_mul);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, int_div);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, int_mod);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, int_shl);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, int_shr);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, int_eq);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, int_noteq);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, int_sm);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, int_smeq);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, int_gr);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, int_greq);
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, sbyte_type);
            sbyte_and = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), sbyte_type, sbyte_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), sbyte_type, sbyte_type);
            ps.return_type = sbyte_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, sbyte_type);
            sbyte_or = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), sbyte_type, sbyte_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), sbyte_type, sbyte_type);
            ps.return_type = sbyte_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, sbyte_type);
            sbyte_xor = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), sbyte_type, sbyte_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), sbyte_type, sbyte_type);
            ps.return_type = sbyte_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            sbyte_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, ps);

            //ushort
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, int_plus);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, int_minus);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, int_mul);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, int_div);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, int_mod);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, int_shl);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, int_shr);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, int_eq);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, int_noteq);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, int_sm);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, int_smeq);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, int_gr);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, int_greq);
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, uint16_type);
            uint16_and = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint16_type, uint16_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint16_type, uint16_type);
            ps.return_type = uint16_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, uint16_type);
            uint16_or = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint16_type, uint16_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint16_type, uint16_type);
            ps.return_type = uint16_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, uint16_type);
            uint16_xor = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint16_type, uint16_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint16_type, uint16_type);
            ps.return_type = uint16_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            uint16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, ps);

            //int16
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, int_plus);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, int_minus);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, int_mul);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, int_div);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, int_mod);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, int_shl);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, int_shr);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, int_eq);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, int_noteq);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, int_sm);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, int_smeq);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, int_gr);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, int_greq);
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, uint16_type);
            int16_and = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int16_type, int16_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int16_type, int16_type);
            ps.return_type = int16_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, int16_type);
            int16_or = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int16_type, int16_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int16_type, int16_type);
            ps.return_type = int16_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, int16_type);
            int16_xor = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int16_type, int16_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int16_type, int16_type);
            ps.return_type = int16_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int16_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, ps);

            //int64
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, int64_type);
            int64_plus = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = int64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, int64_type);
            int64_minus = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = int64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, int64_type);
            int64_mul = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = int64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, int64_type);
            int64_div = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = int64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, int64_type);
            int64_mod = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = int64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, int64_type);
            int64_shl = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = int64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, int64_type);
            int64_shr = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = int64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, int64_type);
            int64_and = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = int64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, int64_type);
            int64_or = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = int64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, int64_type);
            int64_xor = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = int64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, int64_type);
            int64_eq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, int64_type);
            int64_noteq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, int64_type);
            int64_sm = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, int64_type);
            int64_smeq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, int64_type);
            int64_gr = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, int64_type);
            int64_greq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, ps);

            //uint
            //int16
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, int64_plus);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, int64_minus);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, int64_mul);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, int64_div);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, int64_mod);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, int64_shl);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, int64_shr);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, int64_eq);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, int64_noteq);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, int64_sm);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, int64_smeq);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, int64_gr);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, int64_greq);
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, uint32_type);
            uint32_and = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint32_type, uint32_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint32_type, uint32_type);
            ps.return_type = uint32_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, uint32_type);
            uint32_or = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint32_type, uint32_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint32_type, uint32_type);
            ps.return_type = uint32_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, uint32_type);
            uint32_xor = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint32_type, uint32_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint32_type, uint32_type);
            ps.return_type = uint32_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            uint32_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, ps);

            //uint64 type
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, int64_plus);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, int64_minus);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, int64_mul);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.idiv_name, int64_div);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, int64_mod);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, int64_shl);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, int64_shr);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, int64_eq);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, int64_noteq);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, int64_sm);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, int64_smeq);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, int64_gr);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, int64_greq);
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, uint64_type);
            uint64_and = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint64_type, uint64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint64_type, uint64_type);
            ps.return_type = uint64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, uint64_type);
            uint64_or = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint64_type, uint64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint64_type, uint64_type);
            ps.return_type = uint64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, uint64_type);
            uint64_xor = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint64_type, uint64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), uint64_type, uint64_type);
            ps.return_type = uint64_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            uint64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, ps);

            //real_type
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, real_type);
            real_plus = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            ps.return_type = real_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            real_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, real_type);
            real_minus = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            ps.return_type = real_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            real_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, real_type);
            real_mul = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            ps.return_type = real_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            real_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.div_name, real_type);
            real_div = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            ps.return_type = real_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            real_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.div_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, real_type);
            real_eq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            ps.return_type = real_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            real_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, real_type);
            real_noteq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            real_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, real_type);
            real_sm = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            real_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, real_type);
            real_smeq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            real_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, real_type);
            real_gr = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), real_type, real_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            real_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, int64_type);
            real_greq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), int64_type, int64_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            real_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, ps);

            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, int64_plus);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, int64_minus);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, int64_mul);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.div_name, int64_div);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mod_name, int64_mod);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shl_name, int64_shl);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.shr_name, int64_shr);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, int64_eq);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, int64_noteq);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, int64_sm);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, int64_smeq);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, int64_gr);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, int64_greq);

            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, real_plus);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, real_minus);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, real_mul);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.div_name, real_div);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, real_eq);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, real_noteq);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, real_sm);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, real_smeq);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, real_gr);
            int_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, real_greq);

            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, real_plus);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.minus_name, real_minus);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.mul_name, real_mul);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.div_name, real_div);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, real_eq);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, real_noteq);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, real_sm);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, real_smeq);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, real_gr);
            int64_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, real_greq);

            //boolean type
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, bool_type);
            bool_and = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            bool_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.and_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, bool_type);
            bool_or = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            bool_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.or_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, bool_type);
            bool_xor = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            bool_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.xor_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, bool_type);
            bool_eq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            bool_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, bool_type);
            bool_noteq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            bool_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, bool_type);
            bool_sm = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            bool_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, bool_type);
            bool_smeq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            bool_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, bool_type);
            bool_gr = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            bool_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, bool_type);
            bool_greq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), bool_type, bool_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            bool_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, ps);

            //char type
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, char_type);
            char_eq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            char_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, char_type);
            char_noteq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            char_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, char_type);
            char_sm = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            char_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, char_type);
            char_smeq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            char_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, char_type);
            char_greq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            char_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, char_type);
            char_gr = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), char_type, char_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            char_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, ps);

            //string type
            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, string_type);
            string_plus = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            ps.return_type = string_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            string_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.plus_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, string_type);
            string_eq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            string_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.eq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, string_type);
            string_noteq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            string_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.noteq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, string_type);
            string_sm = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            string_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.sm_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, string_type);
            string_smeq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            string_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.smeq_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, string_type);
            string_gr = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            string_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.gr_name, ps);

            ps = new ProcScope(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, string_type);
            string_greq = ps;
            left = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            right = new ElementScope(new SymInfo("", SymbolKind.Parameter, ""), string_type, string_type);
            ps.return_type = bool_type;
            ps.AddParameter(left);
            ps.AddParameter(right);
            string_type.AddName(PascalABCCompiler.TreeConverter.compiler_string_consts.greq_name, ps);
        }
 public override void visit(exception_handler _exception_handler)
 {
     SymScope tmp = cur_scope;
 	SymScope stmt_scope = new BlockScope(cur_scope);
 	cur_scope.AddName("$block_scope",stmt_scope);
 	stmt_scope.loc = get_location(_exception_handler);
 	stmt_scope.loc = new location(stmt_scope.loc.begin_line_num,stmt_scope.loc.begin_column_num,
 	                              _exception_handler.statements.source_context.end_position.line_num,
 	                              _exception_handler.statements.source_context.end_position.column_num,stmt_scope.loc.doc);
 	returned_scope = null;
 	if (_exception_handler.variable == null) return;
 	if (_exception_handler.type_name != null)
 	_exception_handler.type_name.visit(this);
 	else returned_scope = cur_scope.FindName(_exception_handler.variable.name);
 	if (returned_scope != null)
 	{
 		cur_scope = stmt_scope;
 		ElementScope es = new ElementScope(new SymInfo(_exception_handler.variable.name, SymbolKind.Variable,_exception_handler.variable.name),returned_scope,cur_scope);
 		es.loc = get_location(_exception_handler.variable);
 		stmt_scope.AddName(_exception_handler.variable.name,es);
 	}
 	_exception_handler.statements.visit(this);
 	cur_scope = tmp;
 }
		public static void AddDescribeToComplete(ElementScope value)
		{
			elem_cache.Add(value);
		}
 public override void visit(enum_type_definition _enum_type_definition)
 {
     //throw new Exception("The method or operation is not implemented.");
     EnumScope enum_scope = new EnumScope(SymbolKind.Enum,cur_scope,
                                          TypeTable.get_compiled_type(new SymInfo(typeof(Enum).Name, SymbolKind.Enum,typeof(Enum).FullName),typeof(Enum)));
     enum_scope.loc = get_location(_enum_type_definition);
     enum_scope.topScope = cur_scope;
     List<ElementScope> elems = new List<ElementScope>();
     if (_enum_type_definition.enumerators != null)
     foreach (enumerator en in _enum_type_definition.enumerators.enumerators)
     {
     	ElementScope ss = new ElementScope(new SymInfo(en.name.name, SymbolKind.Constant, en.name.name),/*cur_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name)*/enum_scope,cur_scope);
     	ss.is_static = true;
     	ss.cnst_val = en.name.name;
     	elems.Add(ss);
     	ss.loc = get_location(en);
     	cur_scope.AddName(en.name.name, ss);
     	enum_scope.AddName(en.name.name, ss);
     	enum_scope.AddEnumConstant(en.name.name);
     }
     for (int i=0; i<elems.Count; i++)
     	elems[i].MakeDescription();
     ret_tn = enum_scope;
 }