Skip to content

Enhance Body Handling and Token Iteration#44

Merged
LunaStev merged 20 commits intodevelopfrom
feature/ast
Jan 14, 2025
Merged

Enhance Body Handling and Token Iteration#44
LunaStev merged 20 commits intodevelopfrom
feature/ast

Conversation

@LunaStev
Copy link
Member

  • Create function to handle body:

    • Introduced a new function to manage the body of a function or block, making it easier to handle dynamic content.
  • Body variable function:

    • Added a variable function to handle body content more flexibly, improving the structure of the code.
  • AST Conversion via HashMap:

    • Simplified AST conversion using a HashMap for easier handling of AST nodes and variables.
  • Peekable Token Iterator:

    • Added peekable functionality to the token iterator, enabling more efficient token inspection and management.
  • While-let Loop for Token Iteration:

    • Introduced a while-let loop for iterating over tokens, improving readability and efficiency of token processing.
  • Match Statement for Token Processing:

    • Implemented a match statement to handle token processing, improving the clarity and extensibility of the token parsing logic.
  • Test Body AST Generation:

    • Added functionality to test the generation of AST nodes for body content, ensuring correct body structure handling.
  • Token Handling Improvements:

    • Refined token handling by making changes to token iteration logic, and removing unnecessary iteration constructs.
  • Add StatementNode:

    • Introduced StatementNode to enhance the AST structure, representing individual statements within the body.
  • Syntax for Body Test:

    • Created the syntax and framework for testing body AST generation and output handling.
  • Compulsory Grammar:

    • Enforced grammar rules for body content, ensuring correctness in the AST generation.
  • Extract Body:

    • Added an extract_body function for easier extraction and handling of body content, facilitating code clarity.

- Wrapped tokens.iter() with .peekable() to enable lookahead capability
- Prepares for logic that requires peeking at the next token during iteration
- Added a `while let` loop to iterate over tokens
- Processes tokens one by one with `iter.next()`
- Prepares for handling token processing logic inside the loop
- Introduced a `match` statement inside the `while let` loop
- Prepares for handling different token types based on `token.token_type`
- Framework set up for implementing token-specific logic
- Introduced a `match` statement inside the `while let` loop
- Prepares for handling different token types based on `token.token_type`
- Framework set up for implementing token-specific logic
@LunaStev LunaStev self-assigned this Jan 14, 2025
@LunaStev LunaStev merged commit de7d66c into develop Jan 14, 2025
@LunaStev LunaStev added this to Wave Aug 28, 2025
@LunaStev LunaStev moved this to Done in Wave Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant