Commits

Kirill Simonov  committed 8f9ca0e

Raise an error for colons in the flow context.

  • Participants
  • Parent commits 7227184

Comments (0)

Files changed (3)

-PyYAML3000 - The next generation YAML parser for Python.
+PyYAML 3000 - The next generation YAML parser and emitter for Python.
 
 To install, type 'python setup.py install'.
 
-For more information, check 'http://pyyaml.org/wiki/PyYAML'.
+For more information, check the PyYAML homepage:
+'http://pyyaml.org/wiki/PyYAML'.
 
 Post your questions and opinions to the YAML-Core mailing list:
 'http://lists.sourceforge.net/lists/listinfo/yaml-core'.
 
-PyYAML3000 is written by Kirill Simonov <xi@resolvent.net>. It is released
+Submit bug reports and feature requests to the PyYAML bug tracker:
+'http://pyyaml.org/newticket?component=pyyaml'.
+
+PyYAML 3000 is written by Kirill Simonov <xi@resolvent.net>. It is released
 under the MIT license. See the file LICENSE for more details.

File lib/yaml/scanner.py

                         or (self.flow_level and ch in u',:?[]{}'):
                     break
                 length += 1
+            # It's not clear what we should do with ':' in the flow context.
+            if (self.flow_level and ch == u':'
+                    and self.peek(length+1) not in u'\0 \t\r\n\x28\u2028\u2029,[]{}'):
+                self.forward(length)
+                raise ScannerError("while scanning a plain scalar", start_mark,
+                    "found unexpected ':'", self.get_mark(),
+                    "Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.")
             if length == 0:
                 break
             self.allow_simple_key = False

File tests/data/colon-in-flow-context.loader-error

+{ foo:bar }