예제 #1
0
        public string Compile(ParsedCode code)
        {
            var output = code.Output; //we cannot clone

            if (code.Variables != null)
            {
                foreach (var kv in code.Variables)
                {
                    Context.Variables[kv.Key] = kv.Value;
                }
            }

            foreach (var globalVariable in GlobalVariables)
            {
                Context.Variables[globalVariable.Key] = globalVariable.Value;
            }

            foreach (var action in code.ParseActions)
            {
                CompileAction(action, code.ParseActions);
            }

            return(output.Combine(code.Options));
        }
예제 #2
0
 /// <summary>
 ///     Compiles the given code and stores the variables in current <see cref="Context"/>.
 /// </summary>
 public void CompileGlobal(ParsedCode parsed)
 {
     //handle global blocks
     Compile(parsed); //and we just ignore outputs, leaving all variables inside the context.
 }