Plain equal sign (=) as node content results in an error

Issue #49 new
Sascha Egerer
created an issue

I currently have this bug but copied the bug report from the (6 year old!) old bugtracker.

A plain equal sign (=) as node fails as invalid YAML.

STEPS TO REPRODUCE

Load this document

=

EXPECTED RESULTS

A plain equal sign used as anything other than a key should be the String type (tag:yaml.org,2002:str).

The above document should result in this canonical document:

%YAML 1.1
---
!!str "="
...

With this node structure:

ScalarNode(tag=u'tag:yaml.org,2002:str', value=u'=')

That is it should have been equivalent to this document:

"="

ACTUAL RESULTS

Attempts to treat equal sign as the Value Key type (tag:yaml.org,2002:value) and throws this error:

The document is not valid YAML:
could not determine a constructor for the tag 'tag:yaml.org,2002:value'
  in "", line 1, column 1:
    =
    ^

NOTES

Here's an example of equal sign correctly being treated as the Value Key type:

= : 1

Producing this canonical document and node:

%YAML 1.1
---
!!map {
    ? !!str "="
    : !!int "1",
}
...
MappingNode(tag=u'tag:yaml.org,2002:map', value=[(ScalarNode(tag=u'tag:yaml.org,2002:value', value=u'='),
 ScalarNode(tag=u'tag:yaml.org,2002:int', value=u'1'))])

The document in STEPS TO REPRODUCE is the simplest document that fails, but these documents also fail:

- =
a: =

Comments (0)

  1. Log in to comment