YamlDotNet icon indicating copy to clipboard operation
YamlDotNet copied to clipboard

Single and Double Colon causes SemanticErrorException

Open geferon opened this issue 4 years ago • 1 comments

Describe the bug I have a file which has a value with two continuous colons, which is a valid YAML value, yet whenever parsing it with this library, it's giving me a SemanticErrorException error.

To Reproduce The YAML I'm currently using is:

ipv4_bind_ip: 0.0.0.0
ipv6_bind_ip: ::

The exception I get is

YamlDotNet.Core.SemanticErrorException: '(Line: 2, Col: 16, Idx: 38) - (Line: 2, Col: 16, Idx: 38): While scanning a plain scalar value, found invalid mapping.'

For the record, I also tried saving the value as a single colon, which is as well a valid YAML format, and gave me an error as well.

ipv4_bind_ip: 0.0.0.0
ipv6_bind_ip: :

geferon avatar Feb 04 '21 21:02 geferon

The same also happens if a string starts with a %, though the exception is different:

YamlDotNet.Core.SyntaxErrorException: '(Line: 1, Col: 38, Idx: 37) - (Line: 1, Col: 39, Idx: 38): While scanning for the next token, found character that cannot start any token.'

with the following file:

ff_detector_round_adminchat_message: %nick has been banned for teamkilling (round detector).

geferon avatar Feb 04 '21 23:02 geferon