public abstract class CExtent extends Object
These are called extents and in their general form, they can be constructed by the instantiation of parameterized extents where holes have been replaced with extents taken from other parts of the file, or from other files even. Such extents are called composite and arise during the expansion phase from a parametric grammar into a ground grammar.
a non-composite implementation of {@link CExtent}
Constructor and Description |
---|
CExtent() |
Modifier and Type | Method and Description |
---|---|
abstract int |
endPos() |
abstract String |
filename() |
abstract String |
find()
The string must be of length
realLength() . |
abstract SourceMapping.Origin |
findOrigin(int offset,
int length)
Finding the origin in a composite extent amounts to finding
the innermost extent, composite or not, whose instantiation
covers the given region.
|
abstract int |
length() |
static CExtent |
of(PExtent extent,
List<CExtent> children,
String ruleName) |
abstract int |
realLength()
The real length of an extent is the actual length
of its representation once all place-holders have been
replaced.
|
abstract int |
startCol() |
abstract int |
startLine() |
abstract int |
startPos() |
public abstract String filename()
public abstract int startPos()
public abstract int endPos()
public abstract int startLine()
public abstract int startCol()
public abstract int length()
public abstract int realLength()
It can be different from length()
, the length of
the extent as it appeared uninstantiated in the original
source.
find()
public abstract String find()
realLength()
.public abstract SourceMapping.Origin findOrigin(int offset, int length)
offset
- relative offset from the start of this extentlength
- offset
and length
IllegalArgumentException
- if this extent does
not cover the whole region described by offset
and length
SourceMapping.Origin
public static CExtent of(PExtent extent, List<CExtent> children, String ruleName)
extent
- children
- the replacements for extent
's PExtent.holes
, in orderruleName
- the ground rule which produced this composite extentextent
with the composite
extents given in children