Modify

Ticket #140 (new defect)

Opened 5 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: =

Attachments

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from xi. Next status will be 'new'
The owner will be changed from xi to anonymous. Next status will be 'assigned'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.