module volta.ir.location

Code Map

module volta.ir.location;


//! Struct representing a location in a source file.
struct Location
{
public:
	filename: string;
	line: u32;
	column: u32;
	length: u32;


public:
	fn toString() string { }
	//! Return the line pointed to by this location.
	fn errorLine() string { }
	//! Return the chunk of an errorLine that this points at, or an empty
	//! string.
	fn errorChunk() string { }
	//! Return a few lines that show where in filename this Location is
	//! pointing.
	fn locationGuide() string { }
	//! Difference between two locations. end - begin == begin ... end
	fn opSub(begin: Location) Location { }
	fn spanTo(end: Location) { }


public:
	//! Difference between two locations. end - begin == begin ... end On
	//! mismatch of filename or if begin is after end _default is returned.
	static fn difference(end: Location, begin: Location, _default: Location) Location { }
}
struct Location

Struct representing a location in a source file.

This was pretty much stolen wholesale from Daniel Keep.

fn errorLine() string

Return the line pointed to by this location.

If the location is invalid for some reason, an empty string will be returned.

fn errorChunk() string

Return the chunk of an errorLine that this points at, or an empty string.

fn locationGuide() string

Return a few lines that show where in filename this Location is pointing.

fn opSub(begin: Location) Location

Difference between two locations. end - begin == begin ... end

See also

  • difference

fn difference(end: Location, begin: Location, _default: Location) Location

Difference between two locations. end - begin == begin ... end On mismatch of filename or if begin is after end _default is returned.