Skip to content

Commit

Permalink
* Fix Parser overlooking anonymous class, struct or union wi…
Browse files Browse the repository at this point in the history
…th comments after `{` (issue #501)
  • Loading branch information
saudet committed Jun 16, 2021
1 parent 1c39a50 commit 04da8eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Fix `Parser` overlooking anonymous `class`, `struct` or `union` with comments after `{` ([issue #501](https://github.com/bytedeco/javacpp/issues/501))
* Add `Info.beanify` to have `Parser` generate JavaBeans-style getters and setters ([pull #495](https://github.com/bytedeco/javacpp/pull/495))
* Allow `Parser` to use `Info.javaNames` for function names containing parameters as well ([issue #492](https://github.com/bytedeco/javacpp/issues/492))
* Fix `Parser` producing incorrect calls to function templates with non-type parameters ([issue #491](https://github.com/bytedeco/javacpp/issues/491))
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/bytedeco/javacpp/tools/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -3206,6 +3206,10 @@ boolean group(Context context, DeclarationList declList) throws ParserException
decl.text += token.spacing;
} else {
int index = tokens.index - 1;
while (index >= 0 && tokens.preprocess(index, 0) == tokens.index) {
// make sure to jump back over any potential comments
index--;
}
for (int n = 0; n < Integer.MAX_VALUE; n++) {
tokens.index = index;
Declarator dcl = declarator(context, null, -1, false, n, false, true);
Expand Down

0 comments on commit 04da8eb

Please sign in to comment.