49 $
"######################################\nDebug Step at {Position.GetPositionInfo()}\n\nStepSource: {StepSource}\n\nContext: {Context.Scope.Name}: {Context.Scope}\n\n######################################\n";
61 public string GetSourceView(
int[] breakpoints, out
int topInSource, out
int lineInSource,
int lineDelta = 4)
63 return GetSourceView(lineDelta, lineDelta, breakpoints, out topInSource, out lineInSource);
76 public string GetSourceView(
int top,
int bottom,
int[] breakpoints, out
int topInSource, out
int lineInSource)
78 StringBuilder sb =
new StringBuilder($
"File: {Position.FileName}\n");
79 string[] lines =
GetLines(top, bottom, out topInSource, out lineInSource);
81 for (
int i = 0; i < lines.Length; i++)
83 int ln = topInSource + i;
84 string line = lines[i];
85 string prefix = ln.ToString();
87 if (ln == lineInSource)
93 if (breakpoints.Any(breakpoint => ln == breakpoint))
99 sb.AppendLine($
"{prefix}\t| {line}");
102 return sb.ToString();
122 public string[]
GetLines(
int top,
int bottom, out
int topInSource, out
int lineInSource)
134 topInSource = Math.Max(1, lineInSource - top);
139 List<string> lns =
new List<string>();
141 for (
int i = topInSource - 1;
142 i < topInSource - 1 + Math.Min(top + bottom, lines.Length - (topInSource - 1));
148 return lns.ToArray();
188 return left.
Equals(right);
199 return !left.
Equals(right);
Describes a specific position inside a source file.
int Index
The Start Index of the Position.
string Source
The Source Code.
The Execution Context. Every execution of a script needs a context the script is running in....
Implements Combination of HashCode Functions Taken from decompiled source of System....
Contains Shared Data Structures and Functionality.
Contains the debugging abstractions for the BadScript2 Runtime.
Contains the Runtime Implementation.
Contains Utility Functions and Classes.
Represents a Debugging Step.
string GetInfo()
Returns a string representation of the Step.
string GetSourceView(int[] breakpoints, out int topInSource, out int lineInSource, int lineDelta=4)
Returns a line listing of the Step.
readonly BadExecutionContext Context
The Execution Context of where the Step was executed.
static bool operator!=(BadDebuggerStep left, BadDebuggerStep right)
Implements the != operator.
bool Equals(BadDebuggerStep other)
Returns true if the Step is equal to another object.
override int GetHashCode()
Returns the Hash Code of the Step.
override string ToString()
Returns string representation of the Step.
BadDebuggerStep(BadExecutionContext context, BadSourcePosition position, object? stepSource)
Creates a new Debugger Step.
readonly? object StepSource
The Source of the Step.
string GetSourceView(int top, int bottom, int[] breakpoints, out int topInSource, out int lineInSource)
Returns a line listing of the Step.
readonly BadSourcePosition Position
The Source Position of the Step.
override bool Equals(object? obj)
Returns true if the Step is equal to another object.
static bool operator==(BadDebuggerStep left, BadDebuggerStep right)
Implements the == operator.
string[] GetLines(int top, int bottom, out int topInSource, out int lineInSource)
Returns a line excerpt of the Step.