mirror of
https://github.com/logos-co/logos-cpp-sdk.git
synced 2026-09-02 10:41:15 +00:00
don't count braces inside comment lines (impl-header parser)
A brace in a doc/line comment (e.g. `/// returns { ... }`) no longer affects
class-scope tracking, which previously could make the parser think the class
ended early and drop later declarations. Addresses review feedback on #70.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
4637876824
commit
9a394ffbc3
@@ -305,14 +305,20 @@ ImplParseResult parseImplHeader(const QString& headerPath,
|
||||
break;
|
||||
}
|
||||
|
||||
for (QChar c : line) {
|
||||
if (c == '{') braceDepth++;
|
||||
else if (c == '}') braceDepth--;
|
||||
}
|
||||
// Count braces only on real code lines. Braces inside a doc/line
|
||||
// comment (e.g. `/// returns { "k": v }`) must not affect scope
|
||||
// tracking, or an unbalanced brace in a comment would make the
|
||||
// parser think the class ended early and drop later declarations.
|
||||
if (!(line.startsWith("//") || line.startsWith("/*") || line.startsWith("*"))) {
|
||||
for (QChar c : line) {
|
||||
if (c == '{') braceDepth++;
|
||||
else if (c == '}') braceDepth--;
|
||||
}
|
||||
|
||||
if (braceDepth <= 0) {
|
||||
state = LookingForClass;
|
||||
goto done;
|
||||
if (braceDepth <= 0) {
|
||||
state = LookingForClass;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
// `logos_events:` takes precedence over the standard access
|
||||
|
||||
Reference in New Issue
Block a user