public interface ITextRegionAccess
This class provides access to text regions
based on the semantic model. A text region describes
the offset and length in characters of a semantic elements within a text document.
Technically, it is a lightweight facade over the node model or the serializer's output.
The text regions are arranged as a linked list of strictly alternating semantic regions
and
hidden region
. HiddenRegions group all hidden tokens (typically whitespace, newlines, tabs and
comments) between two semantic tokens. HiddenRegions are empty, but do exist, if there are no hidden tokens between
two semantic elements.
Tokens are considered to be hidden, when they have been parsed via terminal rule referenced in "hidden(...)" in the
Xtext grammar. In the node model, hidden tokens are usually marked as hidden == true
.
A semantic token can be the value of an EAttribute, a CrossReference or a keyword.
A IHiddenRegion
contains a list of parts
, which are either white
space
or comments
. A HiddenRegion can be empty.
ISemanticRegion
,
IHiddenRegion
Modifier and Type | Method and Description |
---|---|
ITextRegionExtensions |
getExtensions() |
XtextResource |
getResource() |
ITextRegionRewriter |
getRewriter() |
boolean |
hasSyntaxError() |
ITextSegment |
regionForDocument() |
IEObjectRegion |
regionForEObject(org.eclipse.emf.ecore.EObject object) |
ILineRegion |
regionForLineAtOffset(int offset) |
ITextSegment |
regionForOffset(int offset,
int length) |
IEObjectRegion |
regionForRootEObject() |
java.lang.String |
textForOffset(int offset,
int length) |
ITextRegionExtensions getExtensions()
XtextResource getResource()
XtextResource
that backs the document this class provides access to.ITextRegionRewriter getRewriter()
ILineRegion regionForLineAtOffset(int offset)
IEObjectRegion regionForEObject(org.eclipse.emf.ecore.EObject object)
ITextSegment regionForDocument()
ITextSegment regionForOffset(int offset, int length)
IEObjectRegion regionForRootEObject()
java.lang.String textForOffset(int offset, int length)
boolean hasSyntaxError()