3 namespace CodeGen.generators
 
   11         private const string ClassFormat = 
"type {0} struct {{{1}}}{2}{3}";
 
   12         private string Indent { 
get; } = GeneratorConf.GetIndent(
true, 4);
 
   17             string fields = 
"", methods = 
"", classes = 
"";
 
   18             fields = 
@class.Fields?.Aggregate($
"\n{fields}", (current, field) => $
"{current}{GenerateField(field)}\n");
 
   19             methods = 
@class.Methods?.Aggregate($
"\n\n{methods}",
 
   20                 (current, method) => current + $
"func ({@class.Name}) {GenerateMethod(method)}\n\n");
 
   21             classes = 
@class.Classes?.Aggregate(classes, (current, cls) => current + GenerateClass(cls));
 
   22             return string.Format(ClassFormat, 
@class.Name, fields, methods, classes);
 
   30             if (field.
Access == 
"public")
 
   32                 field.Name = field.Name?.First().ToString().ToUpper() + field.
Name?.Substring(1);
 
   35             result += $
"{field.Name} {field.Type}";
 
   44             if (method.
Access == 
"public")
 
   46                 method.Name = method.Name?.First().ToString().ToUpper() + method.
Name?.Substring(1);
 
   50                 method.Name = method.Name?.First().ToString().ToLower() + method.
Name?.Substring(1);
 
   53             result += method.Name + 
'(';
 
   55             for (var i = 0; i < method.Parameters?.Length; i++)
 
   57                 result += method.Parameters[i].Name + 
' ' + method.Parameters[i].Type;
 
   66             if (method.
Type != 
"")
 
   68                 result += 
" " + method.Type;
 
   73             if (method.
Type != 
"")
 
   75                 result += $
"\n{Indent}return nil\n";
 
string Type
Represents return type of the method. Type: string 
The structure that describes class. Contains name, array of fields, methods and subclasses, parent class name, access specifier. Overrides ToString() method. 
string Name
Represents the name of the method. Type: string 
string Name
Represents the name of the variable. Type: string 
override string GenerateClass(Class @class)
Class generator: generates class with fields, methods and subclasses from given class object Class ob...
Parameter[] Parameters
Represents parameters of the method. Type: array of type Parameter 
override string GenerateMethod(Method method)
Method generator: generates method from given method object Method objectString of generated code of ...
override string GenerateField(Field field)
Field generator: generates field from given field object Field objectString of generated code of fiel...
string Access
Represents access level of the field. Type: string 
Interface of language generator 
string Access
Represents access level of the method. Type: string 
The structure that describes method. Contains name, return type, access level, const and static prope...
The structure that describes field. Contains access, const and static properties. Inherits from Varia...