ANTLR v4 grammar plugin
Products: IntelliJ IDEA
Vendor: ANTLR Project
This plugin is for ANTLR v4 grammars and includes ANTLR 4.5. Features: syntax highlighting, syntax error checking, semantic error checking, navigation window, live preview, parse tree view, profiler, goto-declaration, find usages, rename tokens, rename rules. Generates code in /gen/package/YourGrammarRecognizer.java unless you override in the configuration dialog. Shortcut to generate parsers is ctrl-shift-G / meta-shift-G but it's in Tools menu, popups. Code completion for tokens, rule names. finds tokenVocab option for code gen if there is a tokenVocab option, don't warn about implicit tokens. shortcut conflicted with grammar-kit plugin. Has live grammar interpreter for grammar preview. Right click on rule and say "Test ANTLR Rule". Changes to grammar seen in parse tree upon save of grammar. Works with Intellij 12.1.x, 13.x, and 14.x.
You can configure the ANTLR tool options per grammar file; right-click in a grammar or on a grammar element within the structured view. When you change and save a grammar, it automatically builds with ANTLR in the background according to the preferences you have set. ANTLR tool errors appear in a console you can opened by clicking on a button in the bottom tab.
You can use the meta-key while moving the mouse and it will show you token information in the preview editor box via tooltips.
Errors within the preview editor are now highlighted with tooltips and underlining just like a regular editor window. The difference is that this window's grammar is specified in your grammar file.
meta-j pops up a list of live templates, just like it does for Java programming. Currently, there are a number of lexical rules for common tokens such as comments and identifiers that you can automatically inject. There are shortcuts like rid that lets you jump directly to the lexical rule you would like to generate. If you type the shortcut and wait a second, intellij should pop up an action you can select for that shortcut.
ctrl-return, or whatever you have configured for the generate pop-up, will bring up a list of things you can generate. The only one so far is a generator to create lexical rules for any literals, referenced in the parser grammar, that have not been defined.
You can type input into an editor or select a file for testing in preview window.
Meta-key while moving the mouse shows token info per above, but now you can click on the token that's underlined and it will show the location in the ANTLR grammar editor window of the grammar element that matched that token.
Alt-key while moving the mouse shows the region of input associated with parser rule that matched it. It finds parent of the token under cursor and shows region of that rule parse tree node. Clicking at the same time jumps the grammar to the associated rule. A pop up shows the parser call stack leading to that parse region.
Added profiler tab in preview tool window. Selecting a row in the table highlights the associated decision in the grammar and highlights important regions of the input window to the left. You can sort the columns by clicking on the header row. Hover over the header row to get tooltips describing the column. If you know a lot about the internals of the parsing strategy, you can click on the expert columns to see additional information. This is the first attempt at a profiler so we can learn what is really important and then improve. If you see ambiguities highlighted, those you should definitely take a look at in your grammar. If you see decisions requiring full context sensitivity, when viewing the expert columns, those are very expensive and could be causing speed problems. Note that the profiler always tries to keep up-to-date with the input. The profiler uses the parser interpreter but is fairly consistent with the speed of a generated and compiled parser but it does use single-stage full LL parsing which can be slower. It needs to do that so that it gets full and complete profiling information. For those in the know, it uses PredictionMode.LL_EXACT_AMBIG_DETECTION.
For really big files and slow grammars, there is an appreciable delay when displaying the parse tree or profiling information.
10 updates are hidden show all updates
Recent change notes:Updated to use ANTLR 4.5