libyaml icon indicating copy to clipboard operation
libyaml copied to clipboard

The anchor can be unicode char

Open cloudwu opened this issue 8 years ago • 5 comments

For yaml 1.1 sepc, anchor name can be any unicode char (http://yaml.org/spec/1.1/#id899912)

[109]   ns-anchor-name  ::= ns-char+
[38]    ns-char ::= nb-char - s-white
[34]    nb-char ::= c-printable - b-char

cloudwu avatar Oct 14 '16 07:10 cloudwu

@ingydotnet this looks fine to me, do you have opinions? Also, do you know why Travis isn't running against these PRs?

sigmavirus24 avatar Oct 14 '16 16:10 sigmavirus24

sorry, I forgot ignore the white space at first. so I update the PR .

cloudwu avatar Oct 18 '16 07:10 cloudwu

I found another bug.

[1:0]

This is a valid yaml document, but libyaml report found unexpected ':'

1:0 is a sexagesimal . See http://yaml.org/spec/1.1/ Example 2.19. Integers

canonical: 12345
decimal: +12,345
sexagesimal: 3:25:45
octal: 014
hexadecimal: 0xC

cloudwu avatar Nov 29 '16 10:11 cloudwu

I'd like to see tests added for these things.

We might want to split this into 2 PRs.

URLs are probably a more common reason for ':' in plain scalar, than sexagesimal. (I want to drop sexagesimal as a suggested default behavior in 1.3).

Failing tests:

Unicode anchors:

foo: &döt
  bar: 123
baz: *döt

Colon in flow plain:

key: {url: http://example.com}

ingydotnet avatar Dec 03 '16 01:12 ingydotnet

I remove the last commit just now , and would make a new pr for ':' in plain scalar.

cloudwu avatar Dec 03 '16 12:12 cloudwu