Packages

c

org.antlr.intellij.adaptor.parser

ANTLRParseTreeToPSIConverter

class ANTLRParseTreeToPSIConverter extends ParseTreeListener

This is how we build an intellij PSI tree from an ANTLR parse tree. We let the ANTLR parser build its kind of ParseTree and then we convert to a PSI tree in one go using a standard ANTLR ParseTreeListener.

The list of SyntaxError objects are pulled from the parser and used for error message highlighting (error nodes don't have the info).

Linear Supertypes
ParseTreeListener, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ANTLRParseTreeToPSIConverter
  2. ParseTreeListener
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ANTLRParseTreeToPSIConverter(language: Language, parser: Parser, builder: PsiBuilder)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. def enterEveryRule(ctx: ParserRuleContext): Unit
    Definition Classes
    ANTLRParseTreeToPSIConverter → ParseTreeListener
    Annotations
    @Override()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. def exitEveryRule(ctx: ParserRuleContext): Unit
    Definition Classes
    ANTLRParseTreeToPSIConverter → ParseTreeListener
    Annotations
    @Override()
  10. final def getBuilder(): PsiBuilder
    Attributes
    protected[parser]
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  12. final def getLanguage(): Language
    Attributes
    protected[parser]
  13. final def getMarkers(): Deque[Marker]
    Attributes
    protected[parser]
  14. final def getRuleElementTypes(): List[RuleIElementType]
    Attributes
    protected[parser]
  15. final def getTokenElementTypes(): List[TokenIElementType]
    Attributes
    protected[parser]
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. def visitErrorNode(node: ErrorNode): Unit

    Summary.

    Summary. For any syntax error thrown by the parser, there will be an ErrorNode in the parse tree and this method will process it. All errors correspond to actual tokens in the input except for missing token errors.

    There are there are multiple error situations to consider:

    1. Extraneous token. The parse tree will have an ErrorNode for token.

    2. Token mismatch. The parse tree will have an ErrorNode for token.

    3. Missing token. The parse tree will have an ErrorNode but it does not correspond to any bit of the input. We underline the current token.

    4. NoViableAlt (input inconsistent with any rule alt). The parse tree will have an ErrorNode for token.

    5. Tokens consumed to resync the parser during recovery. The parse tree will have an ErrorNode for each token.

    This is complicated by errors that occur at EOF but I have modified error strategy to add error nodes for EOF if needed.

    Another complication. During prediction, we might match n tokens and then fail on the n+1 token, leading to NoViableAltException. But, it's offending token is at n+1 not current token where prediction started (which we use to find syntax errors). So, SyntaxError objects return start not offending token in this case.

    Definition Classes
    ANTLRParseTreeToPSIConverter → ParseTreeListener
    Annotations
    @Override()
  24. def visitTerminal(node: TerminalNode): Unit
    Definition Classes
    ANTLRParseTreeToPSIConverter → ParseTreeListener
    Annotations
    @Override()
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from ParseTreeListener

Inherited from AnyRef

Inherited from Any

Ungrouped