Opening an ANTLR editor

In this section, you will learn how to open an editor for ANTLR files. You will also learn about some of the basic ANTLR editor features.

  1. Locate the Expr.g in the Package Exlporer view or Navigator view.
  2. Double click in Expr.g file to open it with the ANTLR editor
  3. Note the syntax highlighting. Different kinds of elements in the ANTLR grammar are rendered in unique colors. For example:
  4. Opening a ANTLR Editor

  5. Look at the Outline view. It display an outline of the ANTLR file including: options declaration, tokens declaration, directives declaration, rules, rules actions and lexer rules. The Outline view use icons to annotate ANTLR elements.
  6. ANTLR Outline view

  7. Toggle the Hide Rules and Hide Scopes buttons in the Outline view toolbar filter the view's display.
  8. ANTLR Outline view

  9. In the Outline view, select different elements and note that they are again displayed in a whole file view in the editor. The Outline view selection now contains a range indicator on the vertical ruler on the left border of the ANTLR editor that indicates the range of the selected element.
  10. ANTLR Outline view

SourceForge.net Logo