<# // // Copyright (c) 2010-2018 Antmicro // Copyright (c) 2011-2015 Realtime Embedded // // This file is licensed under the MIT License. // Full license text is available in 'licenses/MIT.txt'. // #> <#@ template language="C#" hostspecific="true" #> <#@ parameter type="System.String" name="BASE_PATH" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> <#@ import namespace="System.IO" #> /* This file is automatically generated. Do not modify it manually! All changes should be made in `RegisterEnumParserContent.tt` file. */ <# // This is a hack to have both: // * file easy usable in other T4 templates // * C# code that can be tested by UnitTests // // Parser code is stored in `RegisterEnumParserContent.tt` template. It is included // and used by `RegisterTemplate.tt` and by this file. // // This file simply reads content of `RegisterEnumParserContent.tt` and, with simple transformations, // writes it to `RegisterEnumParser.cs`. var usings = new List(); var content = new List(); var baseDirectoryPath = Path.GetDirectoryName(BASE_PATH); var skipLineMode = false; foreach(var line in File.ReadAllLines(baseDirectoryPath + "/RegisterEnumParserContent.tt")) { if(line.StartsWith("#" + ">") && skipLineMode) { skipLineMode = false; continue; } else if(skipLineMode) { continue; } else if(line.StartsWith("<#@ import namespace=")) { usings.Add("using " + line.Split('"')[1] + ";"); } else if(line.StartsWith("<#@") || line.StartsWith("<#+") || line.StartsWith("#" + ">")) { continue; } else if(line.StartsWith("<" + "#") && !skipLineMode) { skipLineMode = true; continue; } else { content.Add(line); } } foreach(var @using in usings) { #> <#=@using#> <# } #> namespace Antmicro.Renode.CoresSourceParser { <# foreach(var line in content) { #> <#=line#> <# } #> }