Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(toml): parse duplicates the character next to reserved escape sequences #4187

Closed
babiabeo opened this issue Jan 13, 2024 · 0 comments · Fixed by #4192
Closed

bug(toml): parse duplicates the character next to reserved escape sequences #4187

babiabeo opened this issue Jan 13, 2024 · 0 comments · Fixed by #4192
Labels
bug Something isn't working needs triage

Comments

@babiabeo
Copy link
Contributor

Describe the bug

According to the TOML spec, escape sequences that are not listed here are reserved:

\b         - backspace       (U+0008)
\t         - tab             (U+0009)
\n         - linefeed        (U+000A)
\f         - form feed       (U+000C)
\r         - carriage return (U+000D)
\"         - quote           (U+0022)
\\         - backslash       (U+005C)
\uXXXX     - unicode         (U+XXXX)
\UXXXXXXXX - unicode         (U+XXXXXXXX)

But when I parse a string that includes a reserved escape sequence, the parser duplicates the character next to it.

Steps to Reproduce

import { parse } from "https://deno.land/std@0.212.0/toml/mod.ts";

parse('a = "a\\0b"'); // { a: "abb" }

Expected behavior

There are 2 cases that I expected:

  • Ignores the reserved escape sequence:
parse('a = "a\\0b"'); // { a: "ab" }
  • Throws an error as specified in the spec:

All other escape sequences not listed above are reserved; if they are used, TOML should produce an error.

Environment

  • OS:
  • deno version: 1.39.3
  • std version: 0.212.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant