protected override string GetDescriptionForProcedure(IProcScope scope) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (scope.ReturnType != null) sb.Append(GetSimpleDescription(scope.ReturnType)+" "); else if (!scope.IsConstructor()) sb.Append("void "); sb.Append(scope.Name); sb.Append('('); IElementScope[] parameters = scope.Parameters; for (int i=0; i<parameters.Length; i++) { sb.Append(GetSimpleDescription(parameters[i])); if (i < parameters.Length - 1) { sb.Append(", "); } } sb.Append(')'); return sb.ToString(); }
protected override string GetSimpleDescriptionForProcedure(IProcScope scope) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (scope.TopScope is ITypeScope && scope.Realization == null) sb.Append(GetTopScopeName(scope.TopScope)); sb.Append(scope.Name); sb.Append('('); IElementScope[] parameters = scope.Parameters; for (int i=0; i<parameters.Length; i++) { sb.Append(GetSimpleDescription(parameters[i])); if (i < parameters.Length - 1) { sb.Append(", "); } } sb.Append(')'); return sb.ToString(); }
public virtual string ConstructHeader(string meth, IProcScope scope, int tabCount) { int i=0; bool is_cnstr = false; StringBuilder sb = new StringBuilder(); if (scope.IsStatic) sb.Append("class "); while (i < meth.Length && char.IsLetterOrDigit(meth[i])) { sb.Append(meth[i++]); } if (sb.ToString().ToLower() == "constructor") is_cnstr = true; sb.Append(' '); while (i < meth.Length && !(char.IsLetterOrDigit(meth[i]) || meth[i] == '_' || meth[i] == '(' || meth[i] == ';')) if (meth[i] == '{') while (i<meth.Length && meth[i] != '}') i++; else i++; if (i < meth.Length) { if (scope.TopScope is ITypeScope && ((scope.TopScope as ITypeScope).ElemKind == SymbolKind.Class || (scope.TopScope as ITypeScope).ElemKind == SymbolKind.Struct)) sb.Append(GetSimpleDescriptionForType(scope.TopScope as ITypeScope)+"."); //if (meth[i] == '(' || meth[i] == ';') sb.Append(scope.Name); sb.Append(GetGenericString(scope.TemplateParameters)); while (i < meth.Length && (char.IsLetterOrDigit(meth[i]) || meth[i] == '_')) i++; while (i < meth.Length && meth[i] != ';' && meth[i] != '(' && meth[i] != ':') if (meth[i] == '{') while (i<meth.Length && meth[i] != '}') i++; else i++; if (meth[i] == '(') { sb.Append('('); bool in_kav = false; Stack<char> sk_stack = new Stack<char>(); sk_stack.Push('(');i++; while (i < meth.Length && sk_stack.Count > 0) { if (meth[i] == '\'') in_kav = !in_kav; else if (meth[i] == '(') {if (!in_kav) sk_stack.Push('(');} else if (meth[i] == ')') {if (!in_kav) sk_stack.Pop();} sb.Append(meth[i]); i++; } while (i<meth.Length && meth[i] != ':' && meth[i] != ';') if (meth[i] == '{') while (i<meth.Length && meth[i] != '}') i++; else sb.Append(meth[i++]); //sb.Append(')'); } if (meth[i] == ':') { bool in_kav = false; while (i < meth.Length && !(meth[i] == ';' && !in_kav)) { if (meth[i] == '{' && !in_kav) while (i<meth.Length && meth[i] != '}') i++; else if (meth[i] == '\'') in_kav = !in_kav; sb.Append(meth[i]); i++; } } sb.Append(';'); } sb.AppendLine(); sb.AppendLine("begin"); for (int j=0; j<tabCount; j++) sb.Append(' '); sb.AppendLine(); sb.AppendLine("end;"); return sb.ToString(); }
public virtual string ConstructOverridedMethodHeader(IProcScope scope, out int off) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (scope.AccessModifier != access_modifer.internal_modifer) sb.Append(GetAccessModifier(scope.AccessModifier)+" "); if (scope.ReturnType == null) sb.Append("procedure "); else sb.Append("function "); off = sb.Length; sb.Append(scope.Name); sb.Append(GetGenericString(scope.TemplateParameters)); if (!(scope is ICompiledMethodScope)) { IElementScope[] parameters = scope.Parameters; if (parameters != null && parameters.Length > 0) { sb.Append('('); for (int i=0; i<scope.Parameters.Length; i++) { sb.Append(GetSimpleDescription(parameters[i])); if (i < parameters.Length - 1) { sb.Append("; "); } } sb.Append(')'); } } else { ParameterInfo[] pis = (scope as ICompiledMethodScope).CompiledMethod.GetParameters(); if (pis.Length > 0) { sb.Append('('); for (int i = 0; i < pis.Length; i++) { if (pis[i].ParameterType.IsByRef) sb.Append("var "); else if (is_params(pis[i])) sb.Append("params "); sb.Append(pis[i].Name); sb.Append(": "); if (!pis[i].ParameterType.IsByRef) sb.Append(GetFullTypeName(pis[i].ParameterType)); else sb.Append(GetFullTypeName(pis[i].ParameterType.GetElementType())); if (i < pis.Length - 1) sb.Append("; "); } sb.Append(')'); } } if (scope.ReturnType != null) sb.Append(": "+GetSimpleDescription(scope.ReturnType)); sb.Append("; override;"); return sb.ToString(); }
public string GetSynonimDescription(IProcScope scope) { return "type "+scope.Name+" = "+scope.Description; }
protected virtual string GetDescriptionForProcedure(IProcScope scope) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (scope.IsExtension) sb.Append("("+StringResources.Get("CODE_COMPLETION_EXTENSION")+") "); if (scope.IsStatic) sb.Append("class "); if (scope.IsConstructor()) sb.Append("constructor "); else if (scope.ReturnType == null) sb.Append("procedure "); else sb.Append("function "); if (!scope.IsConstructor()) { sb.Append(GetTopScopeName(scope.TopScope)); sb.Append(scope.Name); } else { sb.Append(GetTopScopeNameWithoutDot(scope.TopScope)); } /*string[] template_args = scope.TemplateParameters; if (template_args != null) { sb.Append('<'); for (int i=0; i<template_args.Length; i++) { sb.Append(template_args[i]); if (i < template_args.Length-1) sb.Append(','); } sb.Append('>'); }*/ sb.Append(GetGenericString(scope.TemplateParameters)); sb.Append('('); IElementScope[] parameters = scope.Parameters; for (int i=0; i<parameters.Length; i++) { sb.Append(GetSimpleDescription(parameters[i])); if (i < parameters.Length - 1) { sb.Append("; "); } } sb.Append(')'); if (scope.ReturnType != null && !scope.IsConstructor()) sb.Append(": "+GetSimpleDescription(scope.ReturnType)); //if (scope.IsStatic) sb.Append("; static"); if (scope.IsVirtual) sb.Append("; virtual"); else if (scope.IsAbstract) sb.Append("; abstract"); else if (scope.IsOverride) sb.Append("; override"); else if (scope.IsReintroduce) sb.Append("; reintroduce"); sb.Append(';'); return sb.ToString(); }
protected override string GetDescriptionForProcedure(IProcScope scope) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (scope.IsStatic) sb.Append("Shared "); else if (scope.IsVirtual) sb.Append("Overridable "); else if (scope.IsAbstract) sb.Append("MustOverride "); else if (scope.IsOverride) sb.Append("Overrides "); else if (scope.IsReintroduce) sb.Append("Shadows "); if (scope.IsConstructor()) sb.Append("New"); else if (scope.ReturnType == null) sb.Append("Sub "); else sb.Append("Function "); sb.Append(scope.Name); sb.Append('('); IElementScope[] parameters = scope.Parameters; for (int i = 0; i < parameters.Length; i++) { sb.Append(GetSimpleDescription(parameters[i])); if (i < parameters.Length - 1) { sb.Append(", "); } } sb.Append(')'); if (scope.ReturnType != null && !scope.IsConstructor()) sb.Append(" As " + GetSimpleDescription(scope.ReturnType)); return sb.ToString(); }