File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1
- namespace Ara3D . Parakeet
1
+ using Ara3D . Utils ;
2
+
3
+ namespace Ara3D . Parakeet
2
4
{
3
5
/// <summary>
4
6
/// An abstract notion of location.
@@ -13,4 +15,13 @@ public class Location : ILocation
13
15
{
14
16
public ParserRange GetRange ( ) => null ;
15
17
}
18
+
19
+ public static class LocationExtensions
20
+ {
21
+ public static FileAndRange ToFileAndRange ( this ILocation location )
22
+ => location . GetRange ( ) . ToFileAndRange ( ) ;
23
+
24
+ public static FileAndRange ToFileAndRange ( this ParserRange range )
25
+ => new FileAndRange ( range . FilePath , range . BeginPosition , range . EndPosition ) ;
26
+ }
16
27
}
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
- using System . Runtime . CompilerServices ;
4
+ using Ara3D . Utils ;
5
5
6
6
namespace Ara3D . Parakeet
7
7
{
@@ -47,5 +47,11 @@ public override string ToString()
47
47
48
48
public static ParserRange Create ( ParserState begin , ParserState end )
49
49
=> new ParserRange ( begin , end ) ;
50
+
51
+ public ParserInput Input
52
+ => End . Input ;
53
+
54
+ public FilePath FilePath
55
+ => Input ? . File ;
50
56
}
51
57
}
You can’t perform that action at this time.
0 commit comments