We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
depending on the location of an enumeration, the resulting AST is different. For example:
enum Type { A, B, C };
results in the following AST:
translation_unit [0, 0] - [5, 0] enum_specifier [0, 0] - [4, 1] name: type_identifier [0, 5] - [0, 9] body: enumerator_list [0, 10] - [4, 1] enumerator [1, 1] - [1, 2] name: identifier [1, 1] - [1, 2] enumerator [2, 1] - [2, 2] name: identifier [2, 1] - [2, 2] enumerator [3, 1] - [3, 2] name: identifier [3, 1] - [3, 2]
When the same enum is delcared inside a class, the AST is different:
class Test { enum Type { A, B, C }; };
AST:
translation_unit [0, 0] - [7, 0] class_specifier [0, 0] - [6, 1] name: type_identifier [0, 6] - [0, 10] body: field_declaration_list [0, 11] - [6, 1] field_declaration [1, 2] - [5, 4] type: enum_specifier [1, 2] - [1, 11] name: type_identifier [1, 7] - [1, 11] default_value: initializer_list [1, 12] - [5, 3] identifier [2, 6] - [2, 7] identifier [3, 6] - [3, 7] identifier [4, 6] - [4, 7]
The enumerator_list is no longer under the enum_specifier node. Instead it's interpreted as a initializer_list.
enumerator_list
enum_specifier
initializer_list
Is this the intended parsing result or is this a bug? I used the Tree-sitter playground to generate the AST.
The text was updated successfully, but these errors were encountered:
2d2c4ae
No branches or pull requests
Hi,
depending on the location of an enumeration, the resulting AST is different. For example:
enum Type { A, B, C };
results in the following AST:
When the same enum is delcared inside a class, the AST is different:
AST:
The
enumerator_list
is no longer under theenum_specifier
node. Instead it's interpreted as ainitializer_list
.Is this the intended parsing result or is this a bug? I used the Tree-sitter playground to generate the AST.
The text was updated successfully, but these errors were encountered: