private string kind_of_param(IElementScope scope) { /*switch (scope.ParamKind) * { * case PascalABCCompiler.SyntaxTree.parametr_kind.var_parametr: return "VAR "; * case PascalABCCompiler.SyntaxTree.parametr_kind.params_parametr: return "ParamArray "; * case PascalABCCompiler.SyntaxTree.parametr_kind.out_parametr: return "ByRef "; * }*/ return(""); }
protected override string GetSimpleDescriptionForElementScope(IElementScope scope) { string type_name = GetSimpleDescription(scope.Type); if (type_name.StartsWith("$")) { type_name = type_name.Substring(1, type_name.Length - 1); } return(scope.Name + ": " + type_name); }
protected override string GetDescriptionForElementScope(IElementScope scope) { string type_name = null; StringBuilder sb = new StringBuilder(); if (scope.Type == null) { type_name = ""; } else { type_name = GetSimpleDescription(scope.Type); } if (type_name.StartsWith("$")) { type_name = type_name.Substring(1, type_name.Length - 1); } switch (scope.ElemKind) { case SymKind.Variable: sb.Append("VAR " + scope.Name + ": " + type_name); break; case SymKind.Parameter: sb.Append(kind_of_param(scope) + "PARAMETER " + scope.Name + ": " + type_name); break; case SymKind.Constant: { if (scope.ConstantValue == null) { sb.Append("CONST " + scope.Name + ": " + type_name); } else { sb.Append("CONST " + scope.Name + " = " + scope.ConstantValue.ToString()); } } break; } return(sb.ToString()); }
protected override string GetDescriptionForElementScope(IElementScope scope) { string type_name = null; StringBuilder sb = new StringBuilder(); if (scope.Type == null) type_name = ""; else type_name = GetSimpleDescription(scope.Type); if (type_name.StartsWith("$")) type_name = type_name.Substring(1, type_name.Length - 1); switch (scope.ElemKind) { case SymKind.Variable: sb.Append("VAR " + scope.Name + ": " + type_name); break; case SymKind.Parameter: sb.Append(kind_of_param(scope) + "PARAMETER " + scope.Name + ": " + type_name); break; case SymKind.Constant: { if (scope.ConstantValue == null) sb.Append("CONST " + scope.Name + ": " + type_name); else sb.Append("CONST " + scope.Name + " = " + scope.ConstantValue.ToString()); } break; } return sb.ToString(); }
private string kind_of_param(IElementScope scope) { /*switch (scope.ParamKind) { case PascalABCCompiler.SyntaxTree.parametr_kind.var_parametr: return "VAR "; case PascalABCCompiler.SyntaxTree.parametr_kind.params_parametr: return "ParamArray "; case PascalABCCompiler.SyntaxTree.parametr_kind.out_parametr: return "ByRef "; }*/ return ""; }
protected override string GetSimpleDescriptionForElementScope(IElementScope scope) { string type_name = GetSimpleDescription(scope.Type); if (type_name.StartsWith("$")) type_name = type_name.Substring(1, type_name.Length - 1); return scope.Name + ": " + type_name; }
protected override string GetDescriptionForElementScope(IElementScope scope) { string type_name=null; string s=""; StringBuilder sb = new StringBuilder(); if (scope.Type == null) type_name = ""; else type_name = GetSimpleDescription(scope.Type); if (type_name.StartsWith("$")) type_name = type_name.Substring(1,type_name.Length-1); switch (scope.ElemKind) { case SymbolKind.Variable : sb.Append(type_name+" "+scope.Name); break; case SymbolKind.Parameter : sb.Append("parameter "+type_name+" "+scope.Name); break; case SymbolKind.Constant : { if (scope.ConstantValue == null) sb.Append("const "+ scope.Name); else sb.Append("const "+ scope.Name+" = "+scope.ConstantValue.ToString()); } break; case SymbolKind.Event : sb.Append(get_access_modifier(scope.AccessModifier)); append_modifiers(sb,scope); sb.Append("event "+ type_name + " "+GetTopScopeName(scope.TopScope)+scope.Name); break; case SymbolKind.Field : sb.Append(get_access_modifier(scope.AccessModifier)); append_modifiers(sb,scope); sb.Append(type_name+" "+GetTopScopeName(scope.TopScope)+scope.Name ); break; case SymbolKind.Property : sb.Append(get_access_modifier(scope.AccessModifier)); append_modifiers(sb,scope); sb.Append(type_name + " "+GetTopScopeName(scope.TopScope)+scope.Name + get_index_description(scope)); break; } return sb.ToString(); }
private void append_modifiers(StringBuilder sb, IElementScope scope) { if (scope.IsVirtual) sb.Append("virtual "); if (scope.IsStatic) sb.Append("static "); }
protected virtual string GetSimpleDescriptionForElementScope(IElementScope scope) { string type_name = GetSimpleDescription(scope.Type); if (type_name.StartsWith("$")) type_name = type_name.Substring(1,type_name.Length-1); return kind_of_param(scope) + scope.Name + ": "+type_name + (scope.ConstantValue!=null?(":="+scope.ConstantValue.ToString()):""); }
protected virtual string GetDescriptionForElementScope(IElementScope scope) { string type_name=null; string s=""; StringBuilder sb = new StringBuilder(); if (scope.Type == null) type_name = ""; else type_name = GetSimpleDescription(scope.Type); if (type_name.StartsWith("$")) type_name = type_name.Substring(1,type_name.Length-1); switch (scope.ElemKind) { case SymbolKind.Variable : sb.Append("var "+ GetTopScopeName(scope.TopScope)+scope.Name + ": "+type_name); break; case SymbolKind.Parameter : sb.Append(kind_of_param(scope) + "parameter "+scope.Name + ": "+type_name+(scope.ConstantValue!=null?(":="+scope.ConstantValue.ToString()):"")); break; case SymbolKind.Constant : { if (scope.ConstantValue == null) sb.Append("const "+ GetTopScopeName(scope.TopScope)+scope.Name + ": "+type_name); else sb.Append("const "+GetTopScopeName(scope.TopScope)+scope.Name+ ": "+ type_name + " = "+scope.ConstantValue.ToString()); } break; case SymbolKind.Event : if (scope.IsStatic) sb.Append("class "); sb.Append("event "+ GetTopScopeName(scope.TopScope)+scope.Name + ": "+type_name); append_modifiers(sb,scope); break; case SymbolKind.Field : if (scope.IsStatic) sb.Append("class "); else sb.Append("var "); sb.Append(GetTopScopeName(scope.TopScope)+scope.Name + ": "+type_name); append_modifiers(sb,scope); //if (scope.IsStatic) sb.Append("; static"); if (scope.IsReadOnly) sb.Append("; readonly"); break; case SymbolKind.Property : if (scope.IsStatic) sb.Append("class "); sb.Append("property "+ GetTopScopeName(scope.TopScope)+scope.Name + get_index_description(scope) + ": "+type_name); append_modifiers(sb,scope); break; } sb.Append(';'); return sb.ToString(); }
private void append_modifiers(StringBuilder sb, IElementScope scope) { if (scope.IsVirtual) sb.Append("; virtual"); if (scope.IsAbstract) sb.Append("; abstract"); if (scope.IsOverride) sb.Append("; override"); //if (scope.IsStatic) sb.Append("; static"); if (scope.IsReintroduce) sb.Append("; reintroduce"); }
protected virtual string get_index_description(IElementScope scope) { ITypeScope[] indexers = scope.Indexers; if (indexers == null || indexers.Length == 0) return ""; StringBuilder sb = new StringBuilder(); sb.Append('['); for (int i=0; i<indexers.Length; i++) { sb.Append(indexers[i].Name); if (i <indexers.Length-1) sb.Append(','); } sb.Append(']'); return sb.ToString(); }
private string kind_of_param(IElementScope scope) { switch (scope.ParamKind) { case PascalABCCompiler.SyntaxTree.parametr_kind.const_parametr : return "const "; case PascalABCCompiler.SyntaxTree.parametr_kind.var_parametr : return "var "; case PascalABCCompiler.SyntaxTree.parametr_kind.params_parametr : return "params "; case PascalABCCompiler.SyntaxTree.parametr_kind.out_parametr : return "out "; } return ""; }
private string get_index_description(IElementScope scope) { ITypeScope[] indexers = scope.Indexers; if (indexers == null) return ""; StringBuilder sb = new StringBuilder(); sb.Append('('); for (int i = 0; i < indexers.Length; i++) { sb.Append(indexers[i].Name); if (i < indexers.Length - 1) sb.Append(','); } sb.Append(')'); return sb.ToString(); }
private string get_other_modifier(IElementScope scope) { if (scope.IsVirtual) return "Overridable "; if (scope.IsAbstract) return "MustOverride "; if (scope.IsStatic) return "Shared "; if (scope.IsOverride) return "Overrides "; if (scope.IsReintroduce) return "Shadows "; return ""; }