Mercurial > projects > dang
diff src/basic/SourceLocation.d @ 207:e0551773a005
Added the correct version.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Tue, 12 Aug 2008 18:19:34 +0200 |
parents | d3c148ca429b |
children |
line wrap: on
line diff
--- a/src/basic/SourceLocation.d Tue Aug 12 18:14:56 2008 +0200 +++ b/src/basic/SourceLocation.d Tue Aug 12 18:19:34 2008 +0200 @@ -1,5 +1,7 @@ module basic.SourceLocation; +import Integer = tango.text.convert.Integer; + /// Shorter alias for SourceLocation public alias SourceLocation SLoc; @@ -62,6 +64,12 @@ return res; } + /// Get the length between two location + int opSub(SourceLocation loc) + { + return val - loc.val; + } + /// Creates a SourceLocation from a File ID static SourceLocation fromFileID(uint fileID) { @@ -71,6 +79,10 @@ return res; } + char[] toString() + { + return Integer.toString(val); + } /** Used for invalid/unknown locations. (also the default value, but this is more explicit)