Note: Items in gray are intended features but not yet implemented.
Syntax highlighting
ANTLRWorks 2 uses a fast, synchronous lexer for "primary" syntax highlighting. Eventually, a hybrid synchronous/asynchronous lexer will be used to improve performance in large documents. On-screen text is updated synchronously so the syntax highlighter always appears up-to-date. Off-screen text is updated asynchronously to prevent cascading changes in large documents from incurring editor latencies (such as entering /* which could affect the rest of the document).
Additional semantic highlighting such as parameter, return value, and local declarations and references are performed asynchronously following the reference anchor update task. Eventually these will also be incrementally updated following the dynamic anchor update task to improve latency, and priority will be given to on-screen elements.
Code completion
ANTLRWorks 2 provides extremely fast and accurate code completion. Unlike other editors making similar claims, ANTLRWorks 2 provides these features without sacrificing usability - it's always available but won't replace something unless you actually meant it to.
![]()
Users interested in implementation details can see the following for reference:
- ANTLRWorks 2 uses the selection, filtering, and completion algorithms described on Sam Harwell's blog. These algorithms provide consistency and a high degree of accuracy in predicting what the user is attempting to complete at any given point.
- ANTLRWorks 2 uses dynamic anchors to ensure low-latency performance in large documents.
- ANTLRWorks 2 uses parallel parse trees to ensure automatic completion popups never attempt to replace a declaration of a new item with a reference to an existing item.
Navigator
ANTLRWorks 2 supports NetBeans' Navigator Window to give an overview of the rules in the current grammar.
![]()
Syntax diagram view
ANTLRWorks 2 provides a syntax diagram window to show a railroad diagram of the current rule. The window uses a version of Terence Parr's Syntax Diagram control which has been modified to construct itself from ANTLR v4 parse trees.
![]()
Legacy mode
ANTLRWorks 2 includes a legacy mode provides limited support for grammars which target ANTLR v3. Legacy mode is toggled via a button on the document toolbar. When legacy mode is enabled, several features including code completion and the syntax diagram view will be unavailable.
![]()