Add Brick-to-AST Conversion Utility for Project Builder #432
+87
−0
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.
This PR will resolve #399.
This pull request adds a new utility (blockToAST.ts) that converts the Project Builder’s IBrick objects into a simplified Abstract Syntax Tree (AST). Specifically:
Introduces a ASTNode class (or equivalent) for representing syntax elements.
Implements a convertBrickToAST function that maps each IBrick to an ASTNode, handling different brick types (data, expression, statement, block).
Includes a buildASTFromBricks function for converting multiple top-level bricks (e.g., each code stack) to an array of AST root nodes.
Provides placeholders and comments for handling child bricks, nested statements, and data values.
Adapts to the existing IBrick hierarchy (IBrickData, IBrickExpression, IBrickStatement, IBrickBlock) by casting as needed.