- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
namespace SmalltalkPHP
{
class Model
{
internal static void CreateClass(string className)
{
ClassObject = new Class(className);
}
public static Class ClassObject { get; set; }
public class Message
{
public class Arguments
{
private SortedList arguments = new SortedList();
public void Add(String key, String name)
{
this.arguments.Add(key, name);
}
public String AsPhp()
{
String[] sb = new String[arguments.Count];
int i = 0;
foreach (DictionaryEntry arg in arguments)
{
if ((String)(arg.Value) != "") sb[i] = "$" + arg.Value;
i++;
}
return String.Join(", ", sb);
}
public String MakeFunctionName()
{
String[] sb = new String[arguments.Count];
int i = 0;
foreach (DictionaryEntry arg in arguments)
{
if ((String)(arg.Key) != "") sb[i] = (String)arg.Key;
i++;
}
return String.Join("_", sb);
}
}
public class Generic
{
public virtual string AsPhp()
{
return "nya";
}
}
public class Unary : Generic
{
public Unary(String name, Boolean isStatic = false)
{
this.Name = name;
this.Arguments = new Arguments();
this.IsStatic = isStatic;
}
public string Name { get; set; }
public Arguments Arguments { get; set; }
public Boolean IsStatic { get; set; }
public string PhpHeader
{
get
{
return String.Format("public {0}function {1}()", IsStatic ? "static " : "", Name);
}
}
public override string AsPhp()
{
return PhpHeader;
}
}
public class Keyword : Generic
{
public Keyword(Boolean isStatic = false)
{
this.Arguments = new Arguments();
this.IsStatic = isStatic;
}
public string Name { get { return Arguments.MakeFunctionName(); } }
public Arguments Arguments { get; set; }
public Boolean IsStatic { get; set; }
public string PhpHeader
{
get
{
return String.Format("public {0}function {1}({2})", IsStatic ? "static " : "", Name, Arguments.AsPhp());
}
}
public override string AsPhp()
{
return PhpHeader;
}
}
}
}
}
wvxvw 14.01.2016 18:06 # +1
bormand 14.01.2016 18:23 # +1
Дауншифтинг.
roman-kashitsyn 14.01.2016 18:25 # 0