public IsExpression(Source source, object obj, object type) : base(source) { this.obj = (Expression) obj; this.type = (Expression) type; }
public WhileStatement(Source source, object condition, object body) : base(source) { this.condition = (Expression) condition; this.body = (Statement) body; }
public EqualityExpression(Source source, object a, object b) : base(source) { this.a = (Expression) a; this.b = (Expression) b; }
public MultiplyExpression(Source source, object a, object b) : base(source) { this.a = (Expression) a; this.b = (Expression) b; }
public GreaterOrEqualExpression(Source source, object a, object b) : base(source) { this.a = (Expression) a; this.b = (Expression) b; }
public DivideExpression(Source source, object a, object b) : base(source) { this.a = (Expression) a; this.b = (Expression) b; }
public NewExpression(Source source, object type, object parameters) : base(source) { this.type = (Expression) type; this.parameters = (List<object>) parameters; }
public SubtractExpression(Source source, object a, object b) : base(source) { this.a = (Expression) a; this.b = (Expression) b; }
public MemberExpression(Source source, object obj, object member) : base(source) { this.obj = (Expression) obj; this.member = (Name) member; }
public CallExpression(Source source, object callable, object parameters) : base(source) { this.callable = (Expression) callable; this.parameters = (List<object>) parameters; }
public AssignExpression(Source source, object to, object from) : base(source) { this.from = (Expression) from; this.to = (Expression) to; }
public SetPrecedenceStatement(Source source, object a, object relation, object b) : base(source) { this.a = (Expression) a; this.relation = (string) relation; this.b = (Expression) b; }
public IfStatement(Source source, object condition, object trueBody, object falseBody) : base(source) { this.condition = (Expression) condition; this.trueBody = (Statement) trueBody; this.falseBody = (Statement) falseBody; }
public TryStatement(Source source, object tryBody, object catchVariable, object catchBody) : base(source) { this.tryBody = (Statement) tryBody; this.catchVariable = (Expression) catchVariable; this.catchBody = (Statement) catchBody; }
public ClassStatement(Source source, object name, object baseType, object members) : base(source) { this.name = (Name) name; this.baseType = (Expression) baseType; this.members = (List<object>) members; }
public ThrowStatement(Source source, object exception) : base(source) { this.exception = (Expression) exception; }
public ReferencePatternExpression(Source source, object name) : base(source) { this.name = (Expression) name; }
public ExpressionStatement(Source source, object expression) : base(source) { this.expression = (Expression) expression; }
public NotExpression(Source source, object a) : base(source) { this.a = (Expression) a; }
public ParenExpression(Source source, object body) : base(source) { this.body = (Expression) body; }
public Option(Source source, object optionKey, object optionValue) : base(source) { this.optionKey = (Name) optionKey; this.optionValue = (Expression) optionValue; }
public void Define(RuntimeState state) { AbstractPattern basePattern; Type baseType; if (this.baseType != null) { baseType = (Type) this.baseType.Get(state); basePattern = (AbstractPattern) Pattern.PatternForType(baseType); } else { baseType = typeof(RuntimeObject); basePattern = null; } ClassBuilder classBuilder = new ClassBuilder( state.Runtime.CompilerModule, state.Scope.GetModule(), name.name, baseType); // Go through members if (members != null) { foreach (object member in members) ((Member) member).Build(state, classBuilder); } UserDefinedNode userDefined = null;; if (classBuilder.Pattern == null) { bool parseMethod = false;; foreach (Method method in classBuilder.Methods) if (method.Name == "Parse") { parseMethod = true; break; } if (parseMethod) { userDefined = new UserDefinedNode(Source, null); classBuilder.Pattern = new ConcretePattern(Source, name.name, userDefined); } else classBuilder.Pattern = new AbstractPattern(Source, classBuilder.TypeBuilder.Name); } // Create the class, which closes the pattern, and define the pattern Type type = classBuilder.CreateType(); state.Runtime.Grammar.PatternDefined(classBuilder.Pattern); state.Scope.SetName(name.name, type); if (userDefined != null) userDefined.Type = type; // Add a concrete class as an alt to its abstract if (basePattern != null) { basePattern.AddAltPattern(classBuilder.Pattern); basePattern.Updated(); } }