Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@zombocoder
Copy link
Owner

This pull request adds support for the continue statement to the language, enabling users to skip to the next iteration of a while loop for more flexible control flow. The implementation covers lexer, parser, AST, runtime, documentation, and testing, ensuring that continue works seamlessly alongside existing features like break. The documentation and examples are updated to help users understand and use the new statement effectively.

Language Feature Implementation

  • Added ContinueNode to the AST (src/AST/ContinueNode.cpp, src/AST/ContinueNode.hpp) and corresponding runtime logic, throwing a new ContinueException to handle control flow in loops. [1] [2] [3]
  • Updated the lexer and parser to recognize the continue keyword, parse it into AST nodes, and handle it during statement parsing. [1] [2] [3] [4] [5] [6]

Control Flow Integration

  • Modified WhileStatementNode to catch ContinueException and skip to the next iteration, ensuring correct loop semantics.

Documentation and Examples

  • Updated README.md to document the new continue statement, its features, usage patterns, and added multiple example scenarios. [1] [2] [3] [4]
  • Added a comprehensive example file examples/test_continue_examples.obq demonstrating practical uses of continue in filtering, validation, searching, batching, and combined with break.

Build and Testing

  • Updated build configuration (CMakeLists.txt, tests/CMakeLists.txt) to include new source and header files, and added a dedicated test for continue statement functionality. [1] [2] [3] [4]

@zombocoder zombocoder requested a review from Copilot August 21, 2025 17:14
Copy link
Contributor

Copilot AI left a 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 adds comprehensive support for the continue statement to the O²L programming language, enabling users to skip the current iteration of a while loop and proceed to the next iteration. This enhances control flow capabilities by providing a way to filter data and handle conditional processing within loops.

Key changes include:

  • Implementation of ContinueNode AST class with exception-based control flow
  • Lexer and parser updates to recognize and parse the continue keyword
  • Integration with the existing while loop implementation to catch and handle continue exceptions

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/AST/ContinueNode.hpp Defines the AST node class for continue statements
src/AST/ContinueNode.cpp Implements continue statement evaluation by throwing ContinueException
src/Common/Exceptions.hpp Adds ContinueException for control flow handling
src/AST/WhileStatementNode.cpp Updates while loop to catch and handle continue exceptions
src/Lexer.hpp Adds CONTINUE token type to the lexer
src/Lexer.cpp Maps "continue" keyword to CONTINUE token type
src/Parser.hpp Declares parseContinueStatement method
src/Parser.cpp Implements continue statement parsing and AST node creation
tests/test_continue_statement.cpp Comprehensive test suite for continue statement functionality
tests/CMakeLists.txt Adds continue statement tests to build configuration
examples/test_continue_examples.obq Example file demonstrating various continue statement use cases
README.md Updates documentation with continue statement features and examples
CMakeLists.txt Includes new ContinueNode source and header files in build

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@zombocoder zombocoder merged commit 58a6edf into main Aug 21, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants