Class RNCInclude
java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCNode
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCFileReferenceNode
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCInclude
- All Implemented Interfaces:
RNCRange
Represents an
include declaration in an RNC document.
An include declaration imports another RNC grammar file. Optionally, it can have a body with braces to override definitions from the included grammar.
Example RNC — simple include:
include "base.rnc"
Example RNC — include with overrides:
include "base.rnc" {
start = element doc { text }
}
-
Constructor Summary
ConstructorsConstructorDescriptionRNCInclude(int start, int end) Creates a new include node spanning the given offsets. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the offset of the closing brace\} of the override body.intReturns the offset of the opening brace invalid input: '{@code \{} of the override body. @return the brace offset, or {@code -1} if no override body.'Returns the set of define names (and "start") that are overridden inside this include's body.booleanhasBody()Returns whether this include has an override body (braces with definitions).voidsetBodyCloseOffset(int offset) Sets the offset of the closing brace.voidsetBodyOpenOffset(int offset) Sets the offset of the opening brace.Methods inherited from class org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCFileReferenceNode
getUri, getUriEnd, getUriStart, setUriMethods inherited from class org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCNode
addChild, findNodeAt, getChildren, getEnd, getOwnerDocument, getParent, getStart, getText, hasChildren, isClosed, setClosed, setEnd, setStart
-
Constructor Details
-
RNCInclude
public RNCInclude(int start, int end) Creates a new include node spanning the given offsets.- Parameters:
start- the inclusive start offset (theincludekeyword).end- the exclusive end offset.
-
-
Method Details
-
getNodeType
- Specified by:
getNodeTypein classRNCNode
-
getBodyOpenOffset
public int getBodyOpenOffset()Returns the offset of the opening brace invalid input: '{@code \{} of the override body. @return the brace offset, or {@code -1} if no override body.' -
setBodyOpenOffset
public void setBodyOpenOffset(int offset) Sets the offset of the opening brace.- Parameters:
offset- the offset ofinvalid @code
{@code \{} in the source text.
-
getBodyCloseOffset
public int getBodyCloseOffset()Returns the offset of the closing brace\} of the override body.- Returns:
- the brace offset, or
-1if no override body or unclosed.
-
setBodyCloseOffset
public void setBodyCloseOffset(int offset) Sets the offset of the closing brace.- Parameters:
offset- the offset of\} in the source text.
-
hasBody
public boolean hasBody()Returns whether this include has an override body (braces with definitions).- Returns:
trueif the include has a\{ ... \}body.
-
getOverriddenNames
Returns the set of define names (and "start") that are overridden inside this include's body.
-