Ticket #140 (new defect)
Opened 4 years ago
Plain equal sign (=) as node content results in an error
| Reported by: | pyyaml@… | Owned by: | xi |
|---|---|---|---|
| Priority: | normal | Component: | pyyaml |
| Severity: | normal | Keywords: | |
| Cc: |
Description
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: =
