Add Support for # Comments in Think Language #51
Labels
complexity: padawan
Intermediate issues requiring some experience
documentation
Improvements or additions to documentation
enhancement
New feature or request
parser
Overview
Add support for single-line comments in Think using the '#' symbol, similar to Python's comment syntax. This will allow users to add explanatory notes and documentation within their Think programs.
Current State
Currently, Think has no support for comments. Users cannot add explanatory text or disable code without removing it.
Proposed Change
Add support for '#' style comments that:
Example Usage
Implementation Details
1. Lexer Changes (parser.py)
Add a new token rule to the lexer that ignores everything from '#' to the end of the line:
This rule should be added to the ThinkParser class before the IDENTIFIER rule to ensure proper precedence.
2. Update Tests (test_parser.py)
Add new test cases to verify comment handling:
3. Documentation Updates
4. Error Handling Considerations
Migration Impact
This is a backward-compatible change. Existing Think programs will continue to work as before.
Testing Plan
Basic Comment Tests:
Integration Tests:
Edge Cases:
Acceptance Criteria
Related Documentation
The text was updated successfully, but these errors were encountered: