1- using System . Diagnostics ;
1+
2+ using System . Diagnostics ;
23
34namespace ExtensibleParaser ;
45
@@ -9,7 +10,7 @@ public interface ISyntaxNode
910 int EndPos { get ; }
1011 bool IsRecovery { get ; }
1112 void Accept ( ISyntaxVisitor visitor ) ;
12- ReadOnlySpan < char > AsSpan ( string input ) ;
13+ ChatRef AsSpan ( string input ) ;
1314 string ToString ( string input ) ;
1415}
1516
@@ -26,7 +27,7 @@ public interface ISyntaxVisitor
2627public abstract record Node ( string Kind , int StartPos , int EndPos , bool IsRecovery = false ) : ISyntaxNode
2728{
2829 public int Length => EndPos - StartPos ;
29- public virtual ReadOnlySpan < char > AsSpan ( string input ) => input . AsSpan ( StartPos , EndPos - StartPos ) ;
30+ public virtual ChatRef AsSpan ( string input ) => input . AsSpan ( StartPos , EndPos - StartPos ) ;
3031 public virtual string ToString ( string input ) => input [ StartPos ..EndPos ] ;
3132 public abstract void Accept ( ISyntaxVisitor visitor ) ;
3233
@@ -64,7 +65,7 @@ private sealed class DebugView(Node node)
6465
6566public record TerminalNode ( string Kind , int StartPos , int EndPos , int ContentLength , bool IsRecovery = false ) : Node ( Kind , StartPos , EndPos , IsRecovery )
6667{
67- public override ReadOnlySpan < char > AsSpan ( string input ) => input . AsSpan ( StartPos , ContentLength ) ;
68+ public override ChatRef AsSpan ( string input ) => input . AsSpan ( StartPos , ContentLength ) ;
6869 public override string ToString ( string input ) => input . Substring ( StartPos , ContentLength ) ;
6970 public override void Accept ( ISyntaxVisitor visitor ) => visitor . Visit ( this ) ;
7071 public override string ToString ( ) => $ "{ Kind } Terminal([{ StartPos } ,{ StartPos + ContentLength } ), «{ DebugContent ( ) ?? Kind } »)";
0 commit comments