Representation of a point in a source file.
(vl-location filename line col) → loc
- filename — Guard (stringp filename).
- line — Guard (posp line).
- col — Guard (natp col).
- loc — Type (vl-location-p loc).
A vl-location structure represents some location in a source
code file. These locations are attached to characters and module items to
provide context during error reporting.
Historically, vl-location was an ordinary, tagged defprod with
three fields: a filename, line number, and column number. Because there are
many locations, this representation used a lot of memory.
We now instead represent locations using a custom structure, essentially of
(linecol . (:vl-location . filename))
Where the line and column number typically are only a single fixnum; see
vl-linecol. It looks like this takes 2 conses, but we hons the
(:vl-location . filename) pair so that we only need one such cons per
file. So for all practical purposes, each vl-location really only costs
us a single cons.
Despite this fancy representation, the interface to locations still acts as
though it is a defprod with just a filename, line, and column number.
You can use the ordinary b* binders and make/change macros to access and
create locations, as you would expect.
A downside of this representation is that vl-location structures are no
longer very readable when you encounter them in traces, etc. However, the
:vl-location tag is still there, which allows vl-fmt to understand
when it has encountered a location, and to print these locations in a readable
- Recognizer for vl-location structures.
- (vl-location-between-p x min max) is true exactly when x is in the
same file as min and max, and inclusively falls between these
- Given a string, extract all text that occurs between two vl-location-ps.
- Traverse a string to determine the position of a vl-location-p.
- Packed representation of a line number and column number.
- Convert an vl-location-p into a string.
- Fixing function for vl-location structures.
- Get the filename from a vl-location.
- Get the line number from a vl-location.
- Get the column number from a vl-location.
- A list of vl-location-p objects.
- A "fake" vl-location-p which we use when generating our
own extended-characters and module items.