public void Process(ChunkReader reader, Machine machine, ICompiler compiler) { if (this.count > 0) for (int k = 0; k < this.count; k++) this.process(machine, compiler, reader.GetChunk()); else for (string text = reader.GetChunk(); text != null; text = reader.GetChunk()) if (string.IsNullOrEmpty(text.Trim())) return; else this.process(machine, compiler, text); }
public void LoadAndExecute(Machine machine) { string blocktext; blocktext = this.GetBlockText(); while (blocktext != null) { bool isprocessor = false; string trimmed = blocktext.Trim(); if (trimmed.StartsWith("!")) { trimmed = trimmed.Substring(1); isprocessor = true; } if (String.IsNullOrEmpty(trimmed)) { blocktext = this.GetBlockText(); continue; } Block block = this.compiler.CompileBlock(trimmed); var value = block.Execute(machine, null); if (isprocessor) ((ChunkReaderProcessor)value).Process(this.reader, machine, this.compiler); blocktext = this.GetBlockText(); } this.reader.Close(); this.reader = null; }
public Loader(string filename, ICompiler compiler) { this.reader = new ChunkReader(filename); this.compiler = compiler; }
public Loader(TextReader reader, ICompiler compiler) { this.reader = new ChunkReader(reader); this.compiler = compiler; }