Repository navigation
brokk-tree-sitter-cpp 0.24.7
·
1 commit
to master
since this release
Changes
Grammar support for BrokkAi/bifrost-dev#6902, items 1, 3, 5 and 6, in #10.
- Export macros in class heads (item 3).
class PROJECT_PUBLIC_API(2, 0) Widget : public Base {parses without recovery. This also works for struct and union, with or without a body. The first decoration must be function-like and appears as(macro_modifier (identifier) (argument_list ...)). Object-like decorations may follow it, so the class is named by position. Heads with only object-like macros (class EXPORT Foo {) are unchanged. - Semicolon-free top-level macro invocations (item 1). CycloneDDS-style
LIST_TYPES(deps, struct Aggregate *, NOARG, 32)lines are parsed as a new(macro_invocation name: (identifier) arguments: (macro_arguments))node. The arguments are an opaque token from the external scanner. The scanner produces it only when the invocation ends its line and the next line clearly starts a new item, so the declarations that follow keep their own nodes and ranges. Return-type macros on their own line,TEST(a, b) {andFOO(x);keep their trees. This applies at top level only. - Trailing attribute macros on class members (item 5).
int f() ATTR("hint") { ... }andvoid run() Q_DECL_OVERRIDE;parse in class bodies. Namespace-scope declarations do not take trailing macros: every variant that allowed them made error recovery worse in many C headers. - Pointer-to-member declarators (item 6).
void select(void (Left::*cb)());is a declaration, no longer an object initializer. Member pointers also parse in fields, typedefs, aliases and template arguments, including the abstract formR (Left::*)(int)in parentheses. Shape change: a named member pointer is now(qualified_identifier scope: ... name: (pointer_declarator declarator: (identifier))), where it used to bepointer_type_declarator/type_identifier. Fields usefield_identifierand typedefs usepointer_type_declarator. The unparenthesized abstract formvoid f(int Left::*);is not supported. Plain function-pointer parameters keep their previous tree. - Regenerate the parser and update package metadata to 0.24.7. Tree-sitter ABI 15 is unchanged.
node-types.jsongainsmacro_invocation,macro_argumentsand the newmacro_modifierand member-pointer children.
6,789 C and C++ files (macOS SDK headers and libc++, Homebrew headers, Bifrost fixtures) were parsed under 0.24.6 and 0.24.7. No file goes from error-free to erroneous, and 106 become error-free. 27 files that already had errors gain ERROR nodes, and two heavily broken ones (libc++ <string>, highway base.h) now have an ERROR root. Of Bifrost's 430 C and C++ fixtures, 10 differ: the #6902 witnesses, two member-pointer shape changes, and three files that recover differently.
Verified publication
- Rust crate:
brokk-tree-sitter-cpp0.24.7 - Tag and published source commit:
b0b9284fc688eff03e42e38a9f3a8417d7bcbf9b - Crate SHA-256:
0ad0f9375c875b3e4d69cbd69b97a840518e603356b4f578276bbac910fde394 - CI passed at this commit. It covers generated-parser consistency, the corpus and highlight tests, the bindings and the package-content checks.
- Crate publication succeeded. I verified these independently:
- the registry archive checksum matches the index;
.cargo_vcs_info.jsonrecords the tagged commit;parser.c,scanner.c,grammar.json,node-types.jsonandgrammar.jsmatch the tag byte for byte;- the crate resolved from crates.io reproduces the expected trees of all 13 new corpus cases.