Skip to content

regular_expression: to_string() missmatch for LegacyOctalEscape #5690

@leaysgur

Description

@leaysgur

Found in #5676 (comment)


Failed regexp is /\0003/.

This is parsed as:

  • Character(Octal): \000
  • Character(Symbol): 3

But once to_stringed, this will be /\03/.

This is parsed as:

  • Character(Octal): \03

Because we remove leading 0s for now.

This also happens:

  • /\0111/ => /\111/
  • /\0022/ => /\22/

Is it possible to restore these without having extra raw field in the AST?

But both \000 and \00 are the same Character(Octal)...

Metadata

Metadata

Assignees

Labels

C-bugCategory - Bug

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions