All Implemented Interfaces:
RNCRange

public class RNCInclude extends RNCFileReferenceNode
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 Details

    • RNCInclude

      public RNCInclude(int start, int end)
      Creates a new include node spanning the given offsets.
      Parameters:
      start - the inclusive start offset (the include 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 \{} 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 of
      invalid @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 -1 if 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:
      true if the include has a \{ ... \} body.
    • getOverriddenNames

      public Set<String> getOverriddenNames()
      Returns the set of define names (and "start") that are overridden inside this include's body.