IASTElement IParsable.Parse(Lexer lexer, IASTElement parent) { while (!lexer.InspectEOF()) { lexer.GobbleWhitespace(); // find a valid command IASTElement cmd = new ASTCommand(); Children.Add(cmd.Parse(lexer, this)); lexer.GobbleWhitespace(); } return(this); }
public string GetCodeForFileWrite(ASTCommand cmd) { var type = cmd.Command.ToLower(); var ops = ((ASTCompoundExpression)cmd.Operand).Expressions; var fileName = GetCodeForExpression(ops[0]); var contents = GetCodeForExpression(ops[1]); return(Target.GetComplexSnippet("commands", type, new Dictionary <string, string>() { { "fileName", fileName }, { "contents", contents } })); }