public ScriptExtent(SourceSpan origSpan, int startOffset, int endOffset) { if (startOffset == 0 && endOffset == 0) { _span = origSpan; return; } // create a new span with offsets var location = origSpan.Location; // we don't adjust line and column for artifical offsets. This is hopefully okay. var newLocation = new SourceLocation(location.Position + startOffset, location.Line, location.Column); // don't forget to subtract the start offset here _span = new SourceSpan(newLocation, origSpan.Length + endOffset - startOffset); }
protected TextSpan CreateSpanFor(SourceSpan span, Source source) { return CreateSpanFor(span.Location, span.EndPosition, source); }
public void SetSpan(SourceSpan sourceSpan) { Span = sourceSpan; }
/// <summary> /// Fix the label to the given label. /// </summary> public void Fix(Label fixTo, SourceSpan span) { this.ForwardsTo = fixTo; this.Span = span; }
/// <summary> /// Fix the label to the given value. /// </summary> public void Fix(ushort value, SourceSpan span) { this.Value = value; this.Span = span; this.Fixed = true; }
public static CodeGen At(this CodeGen cg, SourceSpan span) { return cg.At(span.Location.Line + 1, span.Location.Column, span.Location.Line + 1, span.Location.Column + span.Length); }