Class AntlrElement

java.lang.Object
cool.klass.model.converter.compiler.state.AntlrElement
All Implemented Interfaces:
IAntlrElement
Direct Known Subclasses:
AbstractAntlrPropertyValidation, AntlrClassifierReference, AntlrClassReference, AntlrCompilationUnit, AntlrCriteria, AntlrExpressionValue, AntlrMultiplicity, AntlrOperator, AntlrOrderBy, AntlrOrderByDirection, AntlrOrderByMemberReferencePath, AntlrOrdinalElement, AntlrPrimitiveType, AntlrRelationship, AntlrService, AntlrServiceCriteria, AntlrServiceMultiplicity, AntlrServiceProjectionDispatch, AntlrUrl, AntlrVerb

public abstract class AntlrElement extends Object implements IAntlrElement
  • Field Details

    • AMBIGUOUS_PARENT

      public static final org.antlr.v4.runtime.ParserRuleContext AMBIGUOUS_PARENT
    • NOT_FOUND_PARENT

      public static final org.antlr.v4.runtime.ParserRuleContext NOT_FOUND_PARENT
    • elementContext

      @Nonnull protected final org.antlr.v4.runtime.ParserRuleContext elementContext
    • compilationUnit

      @Nonnull protected final Optional<CompilationUnit> compilationUnit
      The type of compilationUnit is Optional because some Elements, specifically PrimitiveTypes are not declared in SourceCode
  • Constructor Details

    • AntlrElement

      protected AntlrElement(@Nonnull org.antlr.v4.runtime.ParserRuleContext elementContext, @Nonnull Optional<CompilationUnit> compilationUnit)
  • Method Details

    • getSourceTextLenient

      public static String getSourceTextLenient(org.antlr.v4.runtime.ParserRuleContext parserRuleContext)
      This method is meant to be used by data renderers in the IntelliJ debugger. It is lenient to accept sentinels like AMBIGUOUS and NOT_FOUND.
      Parameters:
      parserRuleContext - the parserRuleContext to get the source text of
      Returns:
      the source text of the given parserRuleContext, or "AMBIGUOUS" or "NOT_FOUND" if the parserRuleContext is a sentinel
      Throws:
      AssertionError - if the parserRuleContext is not a sentinel but looks too much like a sentinel
    • getSourceText

      protected static String getSourceText(org.antlr.v4.runtime.ParserRuleContext parserRuleContext)
    • getElementContext

      @Nonnull public org.antlr.v4.runtime.ParserRuleContext getElementContext()
      Specified by:
      getElementContext in interface IAntlrElement
    • getElementBuilder

      @Nonnull public AbstractElement.ElementBuilder<?> getElementBuilder()
    • getMacroElement

      @Nonnull public Optional<AntlrElement> getMacroElement()
      Specified by:
      getMacroElement in interface IAntlrElement
    • hasMacro

      public boolean hasMacro()
    • getMacroElementBuilder

      @Nonnull protected Optional<AbstractElement.ElementBuilder<?>> getMacroElementBuilder()
    • getSourceCodeBuilder

      protected SourceCode.SourceCodeBuilder getSourceCodeBuilder()
    • getCompilationUnit

      @Nonnull public Optional<CompilationUnit> getCompilationUnit()
      Specified by:
      getCompilationUnit in interface IAntlrElement
    • isInSameCompilationUnit

      public boolean isInSameCompilationUnit(AntlrElement other)
    • isForwardReference

      public boolean isForwardReference(AntlrElement other)
    • toString

      public String toString()
      Overrides:
      toString in class Object