Skip to content

Conversation

@fglock
Copy link
Owner

@fglock fglock commented Jan 28, 2026

No description provided.

- Fix test 44: Handle invalid filetest operators properly
  - Check if function exists when encountering -F
  - Return -42 for sub F { 42 } -F 1
  - Give syntax error for my  = -F 1

- Fix test 47: use without body should give syntax error
  - Check for valid module name token after use
  - Throw syntax error instead of null module error

- Fix tests 48, 49, 50: readline/__FILE__ as prototype
  - Detect invalid prototype constructs without parentheses
  - Give Illegal declaration error for sub _ <> {}
  - Give Illegal declaration error for sub <> {}
  - Give Illegal declaration error for sub _ __FILE__ {}

All tests now pass: 43, 44, 45, 47, 48, 49, 50
- Add check for missing closing brace in sub definitions
- When ParseBlock.parseBlock reaches EOF without finding }, give 'Missing right curly' error
- Instead of 'Expected token OPERATOR with text } but got EOF'
- Tests 55 and 56 now pass
- Allow package names like 'o::' which end with ::
- This is valid Perl syntax for blessing into packages
- Fixes op/sprintf2.t which was failing with 'Bad name after o::::'
- Parser tests 51, 52 still pass
- Add ) to allowed tokens after :: in parseSubroutineIdentifier
- This allows package names like 'o::' to be used in function calls like bless([], o::)
- Fixes op/lexsub.t which was failing with 'Bad name after o::'
- Fix filetest operator detection to handle -a correctly in strict mode
- Check what comes after the identifier (skipping whitespace) to decide context
- If -X is followed by an operand, treat as invalid filetest operator (error)
- If -X is not followed by an operand, treat as string negation (e.g., -a -> '-a')
- This fixes test 48 in op/negate.t while preserving test 44 in comp/parser.t
@fglock fglock merged commit e1a0bbc into master Jan 28, 2026
2 checks passed
@fglock fglock deleted the fix-parser-tests branch January 28, 2026 13:55
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