Skip to content

fix(lexer,parser): add explicit 0o octal prefix, treat leading zeros as decimal#954

Merged
SchoolyB merged 1 commit intobugfixes/1-9-2026from
fix/915-octal-literals
Jan 8, 2026
Merged

fix(lexer,parser): add explicit 0o octal prefix, treat leading zeros as decimal#954
SchoolyB merged 1 commit intobugfixes/1-9-2026from
fix/915-octal-literals

Conversation

@SchoolyB
Copy link
Copy Markdown
Owner

@SchoolyB SchoolyB commented Jan 8, 2026

Summary

  • Added support for 0o/0O prefix for explicit octal literals
  • Changed parser to explicitly handle bases instead of auto-detection
  • Leading zeros without prefix are now treated as decimal (not octal)
  • 0123 is now 123 (decimal), use 0o123 for octal 83
  • 09 is now valid as decimal 9

Test plan

  • 0o123 = 83 (octal)
  • 0o777 = 511 (octal)
  • 0123 = 123 (decimal, not octal)
  • 09 = 9 (decimal, no longer an error)
  • 0xFF = 255 (hex still works)
  • 0b1010 = 10 (binary still works)
  • Added lexer tests for octal literals
  • Added parser tests for all numeric bases
  • All existing tests pass

Fixes #915

…as decimal

- Add support for 0o/0O prefix for explicit octal literals in lexer
- Change parser to explicitly handle bases instead of auto-detection
- Leading zeros without prefix are now treated as decimal (not octal)
- 0123 is now 123 (decimal), use 0o123 for octal 83
- 09 is now valid as decimal 9
- Add comprehensive tests for octal literals and base handling

Fixes #915
@SchoolyB SchoolyB merged commit b8e7f41 into bugfixes/1-9-2026 Jan 8, 2026
2 checks passed
@SchoolyB SchoolyB deleted the fix/915-octal-literals branch January 8, 2026 19:27
@SchoolyB SchoolyB changed the title fix(lexer,parser): add explicit 0o octal prefix, treat leading zeros as decimal fix(lexer,parser): add explicit 0o octal prefix, treat leading zeros as decimal Jan 8, 2026
SchoolyB added a commit that referenced this pull request Apr 3, 2026
…as decimal (#954)

- Add support for 0o/0O prefix for explicit octal literals in lexer
- Change parser to explicitly handle bases instead of auto-detection
- Leading zeros without prefix are now treated as decimal (not octal)
- 0123 is now 123 (decimal), use 0o123 for octal 83
- 09 is now valid as decimal 9
- Add comprehensive tests for octal literals and base handling

Fixes #915
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.

bug: leading zeros silently create octal literals with confusing error for invalid digits

1 participant