-
hallo, the grammar is: grammar TextBlock; This is the input: And here is the response: The following modification did not help: sentence: word+ FullStop {getText().length() > 1}; Please give advice. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Make sure you click on the lexer source code tab and erase everything in that textbox. You have a 'combined grammar' so you only put the combined grammar in 'Parser' textbox. The lab.antlr.org website uses an interpreter of the grammar, so actions |
Beta Was this translation helpful? Give feedback.
-
Man, I only use ANTLR Lab once or twice a year but this problem always trips me up - it's so non-obvious to me that there's a Lexer "tab" that needs to be cleared. I typically waste 30-60 minutes trying to get a basic grammar to work, before I notice the "Lexer" button, which doesn't even look like a button. I hope that my comment comes up in my search engine when I encounter this again in late 2024... (For whatever reason, the default view when I visit the site is the Parser tab, yet the warning to clear the Lexer content is on the Lexer tab... perhaps there should be a similar warning on the Parser tab?) |
Beta Was this translation helpful? Give feedback.
Make sure you click on the lexer source code tab and erase everything in that textbox. You have a 'combined grammar' so you only put the combined grammar in 'Parser' textbox. The lab.antlr.org website uses an interpreter of the grammar, so actions
{getText().length() > 1}
don't work. By the way that action won't work for a generated parser because the code won't compile...missing semicolon.