Expose `start` and `end` fields in SourceLocation

master
Yury Kurlykov 2020-04-28 04:39:50 +10:00
parent 6b4865af8d
commit 041f4c31fb
Signed by: t1meshift
GPG Key ID: B133F3167ABF94D8
1 changed files with 4 additions and 0 deletions

View File

@ -180,6 +180,10 @@ class SourceLocation:
self.start = start
self.end = end
@property
def fields(self):
return OrderedDict({"start": self.start, "end": self.end})
def __str__(self):
src = "" if self.source is None else f"{self.source}:"
return f"{src}{str(self.start)}"