Conversation
Exercise not_initialized token, module docstring rules, extern, primaries, and default var values (issue arxlang#43).
There was a problem hiding this comment.
Pull request overview
Adds targeted tests to exercise previously uncovered/rare branches in src/arx/parser.py, improving parser coverage per issue #43.
Changes:
- Strengthens the local
_parse()test helper with an AST type assertion. - Adds parser branch tests for: leading
not_initializedtoken handling, module docstring placement rules, top-level empty;statements,externprototypes, primary-expression edge cases, and default initializer values for typedvardeclarations without=.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| token_list.position = 0 | ||
| token_list.cur_tok = Token(TokenKind.not_initialized, "") |
There was a problem hiding this comment.
In test_parse_consumes_leading_not_initialized_token, resetting token_list.position and token_list.cur_tok is redundant (a freshly created TokenList from Lexer().lex() already starts at position 0 with cur_tok set to not_initialized), and mutating these internals makes the test more brittle than necessary. Consider removing these assignments and just prepend the not_initialized token (or build a new TokenList with the extra token) before calling Parser().parse().
| token_list.position = 0 | |
| token_list.cur_tok = Token(TokenKind.not_initialized, "") |
Exercise not_initialized token, module docstring rules, extern, primaries, and default var values .
Solves #43