protected AbsParser(ParserOption option, ScopeTag tag) { Option = option; Tag = tag; Code = Option.SourceCode.Exists ? new StringBuilder(File.ReadAllText(Option.SourceCode.FullName, Encoding.UTF8)) : new StringBuilder(""); Indexes = new List<ScopeIndex>(); Results = new List<StringBuilder>(); }
protected AbsInvoker(ParserOption options, string sourceCode) { Options = options; SourceCode = sourceCode; OutputParser = new ScopeParser(options, new ScopeTag {BeginTag = "<$@", CloseTag = "@$>"}); OutputParameterParser = new ScopeParser(options, new ScopeTag {BeginTag = "@(", CloseTag = ")", BeginDropInNextSpace = true}); if (Cached == null) Cached = new Dictionary<Guid, CompilerResults>(); }
internal virtual ParserOption BuildOption() { var options = new ParserOption(); var currentAssembly = GetType().Assembly; var name = new FileInfo(currentAssembly.Location).Name; var namespaces = currentAssembly.GetTypes().Select(t => t.Namespace).Distinct().ToArray(); options.Namesapces.AddRange(namespaces); options.References.Add("System.dll"); options.References.Add(@".\" + name); options.VariableCollection.Add("Namespace", string.IsNullOrEmpty(Parameters.Namespace) ? "" : Parameters.Namespace); return options; }
public ParamParser(ParserOption option) : base(option, new ScopeTag {BeginTag = "<#=", CloseTag = "#>"}) { Init(); var data = Option.VariableParameter.Convert(); @params.Add(data); foreach (string variable in Option.VariableCollection) { if (string.IsNullOrEmpty(data[variable])) { @params.Add(variable, Option.VariableCollection[variable]); } else { @params[variable] = Option.VariableCollection[variable]; } } }
public Parser(ParserOption options) { Options = options; }