mike-lischke/vscode-antlr4

Bug: Generate valid input for rule ignores negation

corneliusroemer opened this issue · 0 comments

I'm just getting started with ANTLR4 and I love the extension.

I've used the "ANTLR: Generate valid input for rule" action from the command palette quite a bit. It's useful to learn the ANTLR syntax.

Unfortunately, I think that there's a serious bug that makes negation ignored.

The following ANTLR lexer rule should produce anything but a, but in fact it produces just a. Whether or not I add the ~ doesn't matter, the result is the same. This shouldn't be the case:

grammar Bug;

// Show that negating doesn't work
init: A NOT_A;

A: 'a';
NOT_A: ~'a';

2023-12-19 02 02 17

The railroad diagram is correct, but the generated "valid input" isn't.