Conversation
So that for example the following doesn't cause a parse error:
using std::unique_ptr, std::make_unique;
GrigoryEvko
added a commit
to GrigoryEvko/tree-sitter-cpp
that referenced
this pull request
Sep 17, 2026
THE CLASS RECORD HELD NO NAME FOR A CLASS WITH A `/` BEFORE ITS FIRST MEMBER.
`class_body_has_member` reads the body up to the first `;` or brace, and
`skip_gap` stops at a `/` that starts no comment. The scan returned false
there, so `class V8_EXPORT Uint8Array : public TypedArray { ...
kMaxLength = TypedArray::kMaxByteLength / sizeof(uint8_t);` of v8 and `struct
APValue::LV : LVBase { static const unsigned InlinePathSpace = (DataSize -
sizeof(LVBase)) / sizeof(LValuePathEntry);` of clang recorded nothing. Each
rule that reads the record of classes then missed the class: a constructor
after an attribute macro, `V8_INLINE Uint8Array(int length);`, read as a field
with the macro as its type.
THE POSITIONS OF A `/` BEFORE THE FIRST MEMBER ENDS. 15 probes, each accepted
by GCC 16.2 and Clang 22.1, run through a C harness that includes this
scanner.c and calls `scan_class_key` at the class key. The record missed 9: a
static member initializer `k = a / b;`, a default member initializer, a
bit-field width `8 / 2`, a template argument of a member type
`std::array<int, a / b>`, a template argument of the base clause `: B<a / b>`,
`S operator/(double) const;`, a division after a comment, a division across a
line break, and `/=`. It held the name where the `/` is inside a group, which
`skip_group` reads: a bound, `decltype`, `alignas`, `static_assert`, a default
argument. A `/` in a literal is part of the literal.
THE REPAIR. `skip_gap` reads the `/` and stops with `gap.slash`, and
`read_text_token` already takes that stop as the operator. The body scan now
does the same and goes on to the next token. A `=` after the `/` is the next
token. The loose record took these names before, because it has no test of the
body, so the functional cast does not change.
THE HEADS AT 212b5c8. The harness over the 682,568 class, struct and union
heads with a body in 329,387 files: the record of classes gains exactly 282
heads, 213 of them in files with no error, each with the name that the tree
gives the class, and no other head changes. Among them: clang LV and
MemberPointerData with their ROOT copies, bde TestObj, abseil RandenPoolEntry.
THE NUMBERS AT 212b5c8, measured with the command of each gate step. Changed
hash with no error in A: 1 corpus file and 0 compiler test files. With an
error in A: 0. NEW ERROR 0, FIXED 0. The regions read whole: 2
`field_declaration` removed and 2 `declaration` added in bslstl_bitset.h of
bde, and no other root. `BSLS_KEYWORD_CONSTEXPR bitset() BSLS_KEYWORD_NOEXCEPT;`
and the constructor on line 417 read as fields with the macro as their type,
and they read as constructor declarations after an attribute macro, because
the record now holds `bitset`. The seed of bde gains the row `bitset
template`: the collector read the old field as a value named `bitset`, and a
name that a project declares as a value and a template left the seed. The
seeded pass, each side with its own seeds, changes the same 1 file and 2
regions. The seeds of the other 63 projects are byte-identical. Ties 3,108 and
dedupe 2,818 did not rise and did not fall. The census of the gate: risen 0.
The differ: added 0, fell 0. The co-validity inventory: 13 rows on each side,
added 0, removed 0. Parse operations 1.00000 of the base.
One pin is new, with fields: the v8 head with a division and a constructor
after an attribute macro, the bde head with a division and the `bitset`
constructor, a division in a template argument of the base clause before a
constructor, and `operator/` before a macro. With the macros and the names
defined, GCC and Clang accept the text. At the base, the pin read the two
constructors after an attribute macro as fields. One syntax snippet is new,
with the v8 and clang heads.
This record is the precondition of tree-sitter#353: a member macro with a body reads the
record, and LV of clang was one of its over-fire sites.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So that for example the following doesn't cause a parse error:
I've included in this PR all the files that were generated under
src/because that seems to be the done thing from looking at other PRs.