Class RNCDiv
java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCNode
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCDiv
- All Implemented Interfaces:
RNCRange
Represents a
div block in an RNC document.
A div block groups grammar definitions without affecting the grammar's semantics. It is useful for organizing large grammars into logical sections.
Use case: the parser creates an RNCDiv node when it encounters
the div keyword followed by braces. Defines inside the div are
collected recursively by RNCDocument.getDefines().
Example RNC:
div { ← RNCDiv
inline = element span { text }
block = element div { text }
}
-
Constructor Summary
ConstructorsConstructorDescriptionRNCDiv(int start, int end) Creates a new div node spanning the given offsets. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the offset of the closing brace\}.intReturns the offset of the opening brace invalid input: '{@code \{}. @return the brace offset, or {@code -1} if no opening brace was found.'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.RNCNode
addChild, findNodeAt, getChildren, getEnd, getOwnerDocument, getParent, getStart, getText, hasChildren, isClosed, setClosed, setEnd, setStart
-
Constructor Details
-
RNCDiv
public RNCDiv(int start, int end) Creates a new div node spanning the given offsets.- Parameters:
start- the inclusive start offset (thedivkeyword).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 \{}. @return the brace offset, or {@code -1} if no opening brace was found.' -
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\}.- Returns:
- the brace offset, or
-1if the block is unclosed.
-
setBodyCloseOffset
public void setBodyCloseOffset(int offset) Sets the offset of the closing brace.- Parameters:
offset- the offset of\} in the source text.
-