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

map parsed as string #550

Closed
RedCMD opened this issue Jun 4, 2024 · 1 comment
Closed

map parsed as string #550

RedCMD opened this issue Jun 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@RedCMD
Copy link

RedCMD commented Jun 4, 2024

Describe the bug
a flow map with an empty value should be parsed as map, not string
Flow nodes and flow keys are not allowed to contain the character set :]

To Reproduce

[a:b]
---
[c:]
---
[:]
---
a:b
---
c:
---
:

Expected behaviour
[c:] should be a map with c key and empty for the value
[a:b] is correctly parsed as a string
[:] is correctly parsed as an empty map

Versions:

  • Environment: VSCode 1.89
  • yaml: 2.4.3

Additional context
image

@RedCMD RedCMD added the bug Something isn't working label Jun 4, 2024
@eemeli
Copy link
Owner

eemeli commented Jun 7, 2024

[c:] should be a map with c key and empty for the value

Agreed, there's something wrong in the ns-plain-char lookahead, which should recognise the ] after the : as a c-flow-indicator, so that this parses the same as [c:,] or [c: ].

[:] is correctly parsed as an empty map

To be picky, it's a sequence with a map as a value, and that map has a single pair with empty key and value. But it is indeed correctly parsed.

@eemeli eemeli closed this as completed in 22f2c6f Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants