Sequence with embedded colon confuses parser
stevedonovan opened this issue · comments
Steve J Donovan commented
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.