bytedeco/javacpp

Preset generator cannot handle "const auto FOO = 42u;"

Open

#407 opened on Jun 21, 2020

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Java (620 forks)batch import
bugenhancementhelp wanted

Repository metrics

Stars
 (4,279 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

If we have a source file with something like:

namespace bar {
const auto FOO = 42u;
}

We get:

Caused by: org.bytedeco.javacpp.tools.ParserException: /path/to/header.hpp:2:Could not parse declaration at '='

At the moment it seems the parser chokes so much that it doesn't seem possible to even skip() these declarations, so you have to do something like:

infoMap.put(new Info("basename.hpp").linePatterns("\\s*const auto.*", ".*;\\s*").skip())

I think ideally these would be parsed, and if it was an unambiguous literal, type inference performed, otherwise cppTypes required before conversion.

Contributor guide