-
Notifications
You must be signed in to change notification settings - Fork 0
Add struct expression #25
New issue
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds a new grammar rule for struct expressions while also modifying the handling of type definition symbols in function call expressions and updating the array literal rule.
- Introduces a new struct_expression rule that parses a struct with a struct name, fields, and proper delimiters.
- Replaces a literal ':' with $._typedef_symbol in function_call_expression to support type syntax consistency.
- Updates the array_literal rule to allow empty arrays by wrapping the sep1 rule in an optional.
Files not reviewed (3)
- debug.inf: Language not supported
- src/grammar.json: Language not supported
- src/node-types.json: Language not supported
Comments suppressed due to low confidence (2)
grammar.js:510
- The modification in the array_literal rule now allows empty arrays, which is a functional change. If empty arrays are not intended, consider reverting to require at least one element or update the tests to reflect the desired behavior.
optional(sep1($._expression, ','))
grammar.js:197
- Consider adding tests for the new struct_expression rule to ensure that all valid struct expressions are parsed as expected.
struct_expression: $ => seq(
… expressions - Introduced a new file `struct.txt` containing a detailed example of a struct expression in the main function, demonstrating the initialization of a structure with various types of fields. - Removed an empty line from the `binary.txt` file to clean up the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new grammar rule for struct expressions while updating the version numbers in key configuration files.
- Adds a new struct_expression rule in grammar.js.
- Updates version numbers in pyproject.toml and Cargo.toml.
- Adjusts argument parsing in function_call_expression and refines string_literal and array_literal rules.
Reviewed Changes
Copilot reviewed 4 out of 11 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pyproject.toml | Updated version from 0.0.32 to 0.0.33. |
| grammar.js | Added struct_expression rule and refined function_call_expression, string_literal, and array_literal rules. |
| Cargo.toml | Updated version from 0.0.32 to 0.0.33. |
Files not reviewed (7)
- Makefile: Language not supported
- debug.inf: Language not supported
- package.json: Language not supported
- src/grammar.json: Language not supported
- src/node-types.json: Language not supported
- test/corpus/expressions/binary.txt: Language not supported
- test/corpus/expressions/struct.txt: Language not supported
Comments suppressed due to low confidence (2)
grammar.js:197
- Consider adding tests to validate the new struct_expression grammar rule, ensuring it correctly parses various struct formats.
struct_expression: $ => seq(
grammar.js:510
- Ensure there are tests for the updated array_literal rule to cover both empty and non-empty cases.
optional(sep1(
…or comments in various specifications
…ation, operators, keywords, and types into arrays
…and consolidate punctuation, operators, keywords, and types
…restore commented-out name definitions for clarity
…ructure; add missing function call and qualified name expressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces support for struct expressions in the grammar while also updating version numbers and making minor adjustments.
- Introduces a new grammar rule for struct_expression.
- Renames a field in struct_definition and updates function argument syntax for typedef symbols.
- Bumps version numbers in pyproject.toml and Cargo.toml, and adds new utility files (index.js, highlight.js).
Reviewed Changes
Copilot reviewed 11 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tree_sitter/parser.h | Removed redundant typedef for TSLanguageMetadata |
| pyproject.toml | Version update from 0.0.32 to 0.0.33 |
| index.js | Adds binding setup and static data handling for Node integration |
| highlight.js | Introduces a regex-based syntax highlighter for the Inference language |
| grammar.js | Adds struct_expression rule and makes updates to struct_definition, function argument syntax, and literal rules |
| Cargo.toml | Version update from 0.0.32 to 0.0.33 |
Files not reviewed (14)
- .tree-sitter-config.json: Language not supported
- Makefile: Language not supported
- debug.inf: Language not supported
- package.json: Language not supported
- queries/highlights.scm: Language not supported
- src/grammar.json: Language not supported
- src/node-types.json: Language not supported
- test/corpus/expressions/binary.txt: Language not supported
- test/corpus/expressions/struct.txt: Language not supported
- test/corpus/spec/basic_concepts.txt: Language not supported
- test/corpus/spec/functions.txt: Language not supported
- test/corpus/spec/general-description.txt: Language not supported
- test/corpus/spec/lexical_structure.txt: Language not supported
- test/corpus/spec/statements.txt: Language not supported
Comments suppressed due to low confidence (1)
grammar.js:312
- [nitpick] Consider using a consistent field name for structure identification between struct_expression and struct_definition (e.g., both using 'struct_name' or 'name') to improve code clarity.
field('name', $.identifier),
No description provided.