public void Render(TaskAbstract parent,TokenLine tokens,StreamWriter fs) { var t = tokens.Find(Token.Create(TokenKind.ReservedWord,SubKindCSharp.Class)); if (t== null) { fs.Write("//ERROR No class found"); return; } var clase = t.Next; if (clase== null) { fs.Write("//ERROR No class name found"); return; } Variables.AddOrReplace(parent?.Variables); Variables.AddOrReplace("$class",clase.Value.Value); Variables.AddOrReplace("$stripclass", clase.Value.Value.RemoveLeft("_",No)); Variables.AddOrReplace("$accessmodified",tokens.FirstOrDefault(to => to.IsSubKind(TokenKind.ReservedWord, SubKindCSharp.AccessModifier))?.Value); Variables.AddOrReplace("$static", tokens.FirstOrDefault(to => to.Value=="static")?.Value); foreach(var c in Code) { var cad = c.ReplaceAll(Variables, Yes); fs.WriteLine(cad); } }
public void Render(TaskAbstract parent, TokenLine tokens, StreamWriter fs) { var ret = tokens.Find(Token.ANY(TokenKind.Word)); if (ret == null) { fs.Write("//ERROR No return type found"); return; } var name = ret.Next; Variables.AddOrReplace(parent.Variables); Variables.AddOrReplace("$accessmodified", tokens.FirstOrDefault(to => to.IsSubKind(TokenKind.ReservedWord, SubKindCSharp.AccessModifier))?.Value); Variables.AddOrReplace("$static", tokens.FirstOrDefault(to => to.Value == "static")?.Value); Variables.AddOrReplace("$returntype", ret.Value.Value); Variables.AddOrReplace("$name", name.Value.Value); Variables.AddOrReplace("$stripname", name.Value.Value.RemoveLeft("_",No)); foreach (var c in Code) { var cad = c.ReplaceAll(Variables, Yes); fs.WriteLine(cad); } }