Skip to content

Commit 12081ab

Browse files
committed
Working on better error reporting in Plato code viewer, and Unity mesh updates.
1 parent 1ea8750 commit 12081ab

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Parakeet/ILocation.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Ara3D.Parakeet
1+
using Ara3D.Utils;
2+
3+
namespace Ara3D.Parakeet
24
{
35
/// <summary>
46
/// An abstract notion of location.
@@ -13,4 +15,13 @@ public class Location : ILocation
1315
{
1416
public ParserRange GetRange() => null;
1517
}
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+
}
1627
}

Parakeet/ParserRange.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
using System.Runtime.CompilerServices;
4+
using Ara3D.Utils;
55

66
namespace Ara3D.Parakeet
77
{
@@ -47,5 +47,11 @@ public override string ToString()
4747

4848
public static ParserRange Create(ParserState begin, ParserState end)
4949
=> new ParserRange(begin, end);
50+
51+
public ParserInput Input
52+
=> End.Input;
53+
54+
public FilePath FilePath
55+
=> Input?.File;
5056
}
5157
}

0 commit comments

Comments
 (0)