public static void GetBounds(this Range range, RunTimeEnvironment rte, out int start, out int count) { if (range.IsDefined) { var lowLine = new Line(range.Min, new Nop()); var highLine = new Line(range.Max, new Nop()); var lowIndex = rte.BinarySearch(lowLine); var highIndex = rte.BinarySearch(highLine); if (lowIndex < 0) { lowIndex = ~lowIndex; } if (highIndex < 0) { highIndex = ~highIndex - 1; } start = lowIndex; count = highIndex - lowIndex + 1; } else { start = 0; count = rte.Lines.Count; } }
/// <summary> /// Creates an instance of Read-Evaluate-Print loop object. /// </summary> /// <param name="rte"></param> /// <param name="parser"></param> public ReadEvaluatePrintLoop(RunTimeEnvironment rte, Parser parser) { if (rte == null) throw new ArgumentNullException(nameof(rte)); if (parser == null) throw new ArgumentNullException(nameof(parser)); this.rte = rte; this.parser = parser; }
/// <summary> /// Executes the statement of the <see cref="RunningLine"/>. /// </summary> /// <param name="rte">The run-time environment.</param> /// <returns>The result of the statement.</returns> public EvaluateResult ExecuteCurrentStatement(RunTimeEnvironment rte) { return(RunningLine.Statement.Execute(rte)); }