Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regressions in travis Cpp tests #2907

Merged
merged 2 commits into from
Sep 13, 2020

Conversation

felixn
Copy link
Contributor

@felixn felixn commented Sep 13, 2020

The testcase org.antlr.v4.test.runtime.cpp.TestParserExec was failing after #2806 removed duplicate semicolons from the declarations in generated Cpp header files.

The bug was triggered by TestParserExec because it includes a grammar with alternative labels:

grammar T;
start : a* EOF;
a
  : label=subrule {std::cout << $label.text << std::endl;} #One
  | label='y' {std::cout << $label.text << std::endl;} #Two
  ;
subrule : 'x';
WS : (' '|'\n') -> skip ;

Grammars without alternative labels (most?) were not affected.

The templates for StructDeclHeader and AltLabelStructDeclHeader differed in whether they appended semicolons to attributes:
StructDeclHeader: <attrs: {a | <a>;}; separator="\n">
AltLabelStructDeclHeader: git <attrs: {a | <a>}; separator = "\n">

rules with alternative labels were generating Cpp header files with missing semicolons in declarations after PR#2806 removed duplicate semicolons.
StructDeclHeader and AltLabelStructDeclHeader differed in how attributes were declared
@felixn
Copy link
Contributor Author

felixn commented Sep 13, 2020

@mike-lischke @ericvergnaud @parrt
This fixes the travis build (for now), ready to merge!

(#2908 will deal with further build regressions when newer gcc/clang versions are used)

@parrt parrt merged commit d3246df into antlr:master Sep 13, 2020
@parrt parrt added this to the 4.9 milestone Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants