java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCNode
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCDiv
All Implemented Interfaces:
RNCRange

public class RNCDiv extends RNCNode
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 Details

    • RNCDiv

      public RNCDiv(int start, int end)
      Creates a new div node spanning the given offsets.
      Parameters:
      start - the inclusive start offset (the div keyword).
      end - the exclusive end offset.
  • Method Details

    • getNodeType

      public RNCNodeType getNodeType()
      Specified by:
      getNodeType in class RNCNode
    • 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 of
      invalid @code
      {@code \{} in the source text.
    • getBodyCloseOffset

      public int getBodyCloseOffset()
      Returns the offset of the closing brace \}.
      Returns:
      the brace offset, or -1 if 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.