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

Sequence with embedded colon confuses parser #17

Open
stevedonovan opened this issue Dec 16, 2021 · 0 comments
Open

Sequence with embedded colon confuses parser #17

stevedonovan opened this issue Dec 16, 2021 · 0 comments

Comments

@stevedonovan
Copy link

I noticed this when parsing docker-compose.yml files, which have things like this:

    ports:
      - 172.17.0.1:19000:19000

Where the item is to be considered a string. Generally a colon without a following space is ignored in these situations.

We go wrong at line 513 in parseseq:

    if sfind(rest, '^[^\'\"%s]*:') then
      -- Inline nested hash
      local indent2 = j
      lines[1] = string.rep(' ', indent2)..rest
      tinsert(seq, parsemap('', lines, indent2))

The minimal fix is simple - insist that there is a space after the colon:

    if sfind(rest, '^[^\'\"%s]*:%s') then

I couldn't find any tests for 'inline nested hash' so I don't know if it continues to do that job.

stevedonovan added a commit to stevedonovan/lua-tinyyaml that referenced this issue Dec 29, 2021
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