Example #1
0
 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>();
 }
Example #2
0
        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>();
        }
Example #3
0
 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;
 }
Example #4
0
 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];
         }
     }
 }
Example #5
0
 public Parser(ParserOption options)
 {
     Options = options;
 }