Skip to content

Releases: BrokkAi/tree-sitter-cpp

brokk-tree-sitter-cpp 0.24.8

Choose a tag to compare

@DavidBakerEffendi DavidBakerEffendi released this 26 Oct 13:12
f42dad9

Changes

  • Parse a string-argument attribute macro before a class member without recovery (#11, BrokkAi/bifrost-dev#6902). Examples are Botan's BOTAN_DEPRECATED("...") XMSS_Parameters() = default;, ATTRIBUTE("use factory") explicit DL_Group(const char*); and DEPRECATED("old" "name") int legacy() { ... }. The macro becomes a leading (macro_modifier (identifier) (argument_list (string_literal)...)) on the field declaration, inline method or constructor. With 0.24.7, export-class heads parse, so these members no longer went through whole-class recovery, and Bifrost lost the defaulted constructor. Only string arguments and a single macro are admitted, at dynamic precedence -3, so members that already parse keep their trees (MACRO_TYPE(Widget) member;).
  • Regenerate the parser and update package metadata to 0.24.8. Tree-sitter ABI 15 is unchanged.

6,789 C and C++ files (macOS SDK headers and libc++, Homebrew headers, Bifrost fixtures) were parsed under 0.24.7 and 0.24.8. 6,779 trees are identical, and none goes from error-free to erroneous. The 489 tests of brokk-bifrost-cpp and brokk-bifrost-cpp-analysis and the 152 C/C++ tests of Bifrost's suite_symbols pass against this grammar.

Verified publication

  • Rust crate: brokk-tree-sitter-cpp 0.24.8
  • Tag and published source commit: f42dad9d9f36ab36e3ea6f54dc7ee97f49db4376
  • Crate SHA-256: f2e30d0312deaa1f5e5250b0bf0c92f7d0c62b96075a29cd708a64af60fccd1a
  • CI passed at this commit.
  • Crate publication succeeded. I verified these independently:
    • the registry archive checksum matches the index;
    • .cargo_vcs_info.json records the tagged commit;
    • parser.c, scanner.c, grammar.json, node-types.json and grammar.js match the tag byte for byte;
    • the crate resolved from crates.io reproduces the expected trees of all 15 corpus cases added in 0.24.7 and 0.24.8.

brokk-tree-sitter-cpp 0.24.7

Choose a tag to compare

@DavidBakerEffendi DavidBakerEffendi released this 26 Oct 10:05
b0b9284

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) { and FOO(x); keep their trees. This applies at top level only.
  • Trailing attribute macros on class members (item 5). int f() ATTR("hint") { ... } and void 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 form R (Left::*)(int) in parentheses. Shape change: a named member pointer is now (qualified_identifier scope: ... name: (pointer_declarator declarator: (identifier))), where it used to be pointer_type_declarator/type_identifier. Fields use field_identifier and typedefs use pointer_type_declarator. The unparenthesized abstract form void 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.json gains macro_invocation, macro_arguments and the new macro_modifier and 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-cpp 0.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.json records the tagged commit;
    • parser.c, scanner.c, grammar.json, node-types.json and grammar.js match the tag byte for byte;
    • the crate resolved from crates.io reproduces the expected trees of all 13 new corpus cases.

brokk-tree-sitter-cpp 0.24.6

Choose a tag to compare

@jbellis jbellis released this 25 Oct 17:06
f4b0390

Changes

  • Parse an unnamed enumeration with an underlying type, such as enum : int { A, B };, without recovery. The underlying type is now in the base field, as it is for named enums. Before this release it parsed with an ERROR node and the type in name. Includes a corpus case for primitive, sized, typedef-name and qualified bases, a typedef and a field declaration. Thanks to @jbellis in #9.
  • Revert the 0.24.5 cast-type-descriptor change. 0.24.6 is 0.24.4 plus the enum change. 0.24.5 changed recovery trees in four Bifrost C++ tests and was never adopted, and that feature is parked. The narrower candidates stay on the branches 5452-leading-type-descriptor-macros and 5452-qualified-type-descriptor-macros.
  • Regenerate the parser and update package metadata to 0.24.6. Tree-sitter ABI 15 is unchanged. node-types.json is unchanged.

Bifrost's 331 C and C++ fixtures, the libstdc++ 9 and 10 headers and /usr/include (900 files) give byte-identical trees under 0.24.4 and 0.24.6.

Verified publication

  • Rust crate: brokk-tree-sitter-cpp 0.24.6
  • Tag and published source commit: f4b03909f1da6ff86b6a8d43e66567f153574448
  • Crate SHA-256: 674f79e5a0d24788fea4086549cbc0ee6290fdfe142c7ac400ba3ae23542d6d8
  • 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.json records the tagged commit; and parser.c, scanner.c, grammar.json, node-types.json and grammar.js match the tag byte for byte.

brokk-tree-sitter-cpp 0.24.5

Choose a tag to compare

@DavidBakerEffendi DavidBakerEffendi released this 22 Oct 06:07
782f08c

Superseded by 0.24.6. The cast-type-descriptor change in 0.24.5 changed recovery trees in four Bifrost C++ tests and was reverted in 0.24.6. Use 0.24.6 instead; see #9.

Changes

  • Parse macro-decorated cast type descriptors without unnecessary recovery, extending the declaration support introduced in 0.24.4. Includes positive cast regressions and a malformed-input recovery control. Thanks to @jbellis in #8.
  • Regenerate the parser and update package metadata to 0.24.5. Tree-sitter ABI 15 is unchanged.

Macro expansion is not simulated. The remaining macro-string-initializer recovery cases are outside this fix.

Verified publication

  • Rust crate: brokk-tree-sitter-cpp 0.24.5
  • Tag and published source commit: 782f08c68c4235e0a55434f7079006caa3c47109
  • Crate SHA-256: a4ecbe55287995c98bba9145c20106178405663be290bc0417a109beff7d39ea
  • CI, including generated-parser consistency, corpus/highlight tests, bindings, and package-content checks, passed at this commit.
  • Crate publication succeeded. The registry archive checksum and clean Git provenance were independently verified; its original source files match the tagged commit.

These notes document the existing immutable tag and already published crate.

brokk-tree-sitter-cpp 0.24.4

Choose a tag to compare

@DavidBakerEffendi DavidBakerEffendi released this 21 Oct 06:05
13aa02c

Fixes parsing of macro-decorated declarations that previously entered parser recovery, including function-like macro-wrapped types such as CJSON_PUBLIC and object-like modifiers such as ffc_internal and CJSON_CDECL.

  • Adds regression coverage for cJSON and Hiredis declaration forms and malformed near misses.
  • Retains parser ABI 15. Macro expansion and bare statement macros without a semicolon remain outside this change.

Implemented in PR #7 by @jbellis.

The Rust crate is already published as brokk-tree-sitter-cpp 0.24.4. Its downloaded archive checksum and clean Git provenance were verified against tag v0.24.4 at 13aa02c23684a7e7ec0aab30ac0a1c69bc87349b. CI and publication succeeded.

Archive SHA-256: db93690d322cd7ace683b7d46c850930a3ee91845b3f448e1beefa1809905453.

Brokk C++ grammar 0.24.3

Choose a tag to compare

@DavidBakerEffendi DavidBakerEffendi released this 13 Oct 13:26
114581b

C++ overloads following a split extern "C" closing brace now retain their preprocessor guard. C translation units can keep the C declaration while C++ translation units select the guarded overload. Closing guards also retain else/elif alternatives, including empty true branches.

The release includes the 0.24.2 fixes for conditional array bounds and namespace-qualified defaulted constructors. It tracks upstream c009222808634c1014f82438d4883753516a2c24, uses parser ABI 15, and requires Tree-sitter 0.25 or newer.

Validation covers the full grammar corpus and highlighting suite, Rust bindings on the current and minimum runtimes, Node/Python/Go/Swift bindings, C binding build, lint, and package contents.

Brokk C++ grammar 0.24.0

Choose a tag to compare

@DavidBakerEffendi DavidBakerEffendi released this 09 Oct 15:24
49fc18d

Synchronizes Brokk's C++ grammar with upstream master at c009222808634c1014f82438d4883753516a2c24 (41 upstream commits), retaining Brokk's Windows quoted include-path and split conditional extern "C" guard fixes.

Changes include C++ modules, reflection and splicing, annotations and expansion statements, updated lambda syntax, explicit object parameters, extern template instantiations, Microsoft calling conventions, and explicit calls to overloaded operators.

This starts the 0.24.x compatibility line: parser ABI 15 requires Tree-sitter 0.25 or newer. Generation is pinned to Tree-sitter CLI 0.26.3 and C grammar 0.24.1. The Rust package remains brokk-tree-sitter-cpp, with isolated native symbols. npm and Python package names remain source-only.

Validation covers all 207 corpus cases, both highlight files, Rust regressions and doctests (default and all features), Node/Python/Go/Swift bindings, CMake C builds, formatting/lint, reproducible generation, and Rust/npm/Python package checks. Compatibility with Tree-sitter 0.25.10 and coexistence with upstream tree-sitter-cpp were verified locally.

Implementation: #3
Rust package: https://crates.io/crates/brokk-tree-sitter-cpp/0.24.0