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

Proposal: --fix-unquoted doing line at a time repair #11

Open
tef opened this issue Jan 23, 2018 · 0 comments
Open

Proposal: --fix-unquoted doing line at a time repair #11

tef opened this issue Jan 23, 2018 · 0 comments

Comments

@tef
Copy link
Contributor

tef commented Jan 23, 2018

Unquoted handling:

For Inside {}'s, or []'s only identifier like keys or values. There isn't a good way to handle unquoted values inside of these, because of examples like 'a: 1, b: 2'

For maps, we have to pick and choose between nesting and error handling.

  • Scan the line for ':' followed by a space or a newline.

  • Error out if line/word starts with YAML controls ``@%!"'

  • if the line ends in a :, and does not contain "'s or spaces, then it is a bare key, and the next line must be indented further in, and be the start of an indented list, or new indented map)

  • If the line has one ': ', then split it into key, value. Key must not have spaces.

  • If value starts with a {, [, ',", or -+0123456789, parse as normal

  • Or take entire line, trimming whitespace at end and front, as value

For indented lists we can do the same, handling a value in the same way as a map,

  • search for a {, [, ',", or -+0123456789 and parse as normal.
  • Or take entire line, trimming whitespace at end and front, as value

Note: Because of negative numbers, nesting lists complicate nesting

However, a - name: foo can work.

@tef tef changed the title Proposal: Proposal: --fix-unquoted doing line at a time repair Jan 23, 2018
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

No branches or pull requests

1 participant