public LinedefSpecialDefinition(Statement statement,IEnumerable<LinedefSpecialAttribute> attributes) { if (statement == null) throw new ArgumentNullException("statement"); if (attributes == null) throw new ArgumentNullException("attributes"); this.statement = statement; this.attributes = new List<LinedefSpecialAttribute>(attributes); this.method = null; }
public IfStatement(Expression condition,Statement thenstatement,Statement elsestatement) { if (condition == null) throw new ArgumentNullException("condition"); if (thenstatement == null) throw new ArgumentNullException("thenstatement"); if (elsestatement == null) throw new ArgumentNullException("elsestatement"); this.condition = condition; this.thenstatement = thenstatement; this.elsestatement = elsestatement; }
public WhileStatement(Expression condition,Statement loopstatement,Statement elsestatement) { if (condition == null) throw new ArgumentNullException("condition"); if (loopstatement == null) throw new ArgumentNullException("loopstatement"); if (elsestatement == null) throw new ArgumentNullException("elsestatement"); this.condition = condition; this.loopstatement = loopstatement; this.elsestatement = elsestatement; }
public ForEachStatement(string variabletype,string variablename,Expression collection,Statement loopstatement,Statement elsestatement) { if (variabletype == null) throw new ArgumentNullException("variabletype"); if (variablename == null) throw new ArgumentNullException("variablename"); if (collection == null) throw new ArgumentNullException("collection"); if (loopstatement == null) throw new ArgumentNullException("loopstatement"); if (elsestatement == null) throw new ArgumentNullException("elsestatement"); this.variabletype = variabletype; this.variablename = variablename; this.collection = collection; this.loopstatement = loopstatement; this.elsestatement = elsestatement; }
public FunctionDefinition(string name,string returntype,string[] parametertypes,string[] parameternames,Statement statement) { if (name == null) throw new ArgumentNullException("name"); if (returntype == null) throw new ArgumentNullException("returntype"); if (parametertypes == null) throw new ArgumentNullException("parametertypes"); if (parameternames == null) throw new ArgumentNullException("parameternames"); if (statement == null) throw new ArgumentNullException("statement"); if (parametertypes.Length != parameternames.Length) throw new ArgumentException(); this.name = name; this.returntype = returntype; this.parametertypes = parametertypes; this.parameternames = parameternames; this.statement = statement; this.method = null; this.realreturntype = null; this.realparametertypes = null; }
private static Statement ParseStatement(Scanner scanner) { if (scanner.TryGetIdentifier("if")) { scanner.GetDelimiter("("); Expression condition = ParseExpression(scanner); scanner.GetDelimiter(")"); Statement thenstatement = ParseStatement(scanner); Statement elsestatement = new NullStatement(); if (scanner.TryGetIdentifier("else")) { elsestatement = ParseStatement(scanner); } return(new IfStatement(condition, thenstatement, elsestatement)); } else if (scanner.TryGetIdentifier("while")) { scanner.GetDelimiter("("); Expression condition = ParseExpression(scanner); scanner.GetDelimiter(")"); Statement loopstatement = ParseStatement(scanner); Statement elsestatement = new NullStatement(); if (scanner.TryGetIdentifier("else")) { elsestatement = ParseStatement(scanner); } return(new WhileStatement(condition, loopstatement, elsestatement)); } else if (scanner.TryGetIdentifier("foreach")) { scanner.GetDelimiter("("); string variabletype; string variablename; scanner.GetIdentifier(out variabletype); scanner.GetIdentifier(out variablename); scanner.GetIdentifier("in"); Expression collection = ParseExpression(scanner); scanner.GetDelimiter(")"); Statement loopstatement = ParseStatement(scanner); Statement elsestatement = new NullStatement(); if (scanner.TryGetIdentifier("else")) { elsestatement = ParseStatement(scanner); } return(new ForEachStatement(variabletype, variablename, collection, loopstatement, elsestatement)); } else if (scanner.TryGetIdentifier("var")) { string variablename; scanner.GetIdentifier(out variablename); scanner.GetDelimiter("="); Expression expression = ParseExpression(scanner); scanner.GetDelimiter(";"); return(new VarStatement(variablename, expression)); } else if (scanner.TryGetIdentifier("return")) { if (scanner.TryGetDelimiter(";")) { return(new ReturnStatement(null)); } else { Expression expression = ParseExpression(scanner); scanner.GetDelimiter(";"); return(new ReturnStatement(expression)); } } else if (scanner.TryGetDelimiter("{")) { return(CodeParser.ParseBlock(scanner.ScanAcross("{", "}"))); } else if (scanner.TryGetDelimiter(";")) { return(new NullStatement()); } else { Expression expression = ParseExpression(scanner); scanner.GetDelimiter(";"); return(new ExpressionStatement(expression)); } }
public ForEachStatement(string variabletype, string variablename, Expression collection, Statement loopstatement, Statement elsestatement) { if (variabletype == null) { throw new ArgumentNullException("variabletype"); } if (variablename == null) { throw new ArgumentNullException("variablename"); } if (collection == null) { throw new ArgumentNullException("collection"); } if (loopstatement == null) { throw new ArgumentNullException("loopstatement"); } if (elsestatement == null) { throw new ArgumentNullException("elsestatement"); } this.variabletype = variabletype; this.variablename = variablename; this.collection = collection; this.loopstatement = loopstatement; this.elsestatement = elsestatement; }