Reputation: 338181
When using ANTLR 4 to process a grammar against input text, we must specify the starting rule within that grammar.
I have forgotten how to specify the start rule when using the ANTLR v4 plugin for IntelliJ IDE. So when I type in some input, the plugin displays in the Parse tree
pane the error message No-start-rule-is-selected
. Another error message in red is displayed on the left pane for Input / File options.
Upvotes: 1
Views: 1185
Reputation: 338181
Test Rule
menu item.The plugin’s panes then interactively reacts to your input text. As you type or paste in text, the selected rule and further rules are instantly updated to generate the Parse tree & Hierarchy panes’ content.
Let's click on that rule r : "hello" ID ;
shown in your Question’s screen shot. Select the item Test Rule r
. See the red message Hello.g4 start rule: <select from navigator or grammar>
disappear. And see the Parse tree appear.
This behavior is mentioned briefly on the plugin’s home page. But you must click the tiny more…
blue link text to reveal this verbiage.
Right click on rule and say "Test ANTLR Rule".
Also noted briefly on the ReadMe page on GitHub site for the open-source project.
has live grammar interpreter for grammar preview. Right click on rule and say "Test ANTLR Rule".
Upvotes: 3