jeremyfa / yaml.js

Standalone JavaScript YAML 1.2 Parser & Encoder. Works under node.js and all major browsers. Also brings command line YAML/JSON conversion tools.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YAML with numerical keys parsed incorrectly when using anchors

kate-hall opened this issue · comments

YAML

gray-numerical:
  600: &gray-n-600 "#343741"
  500: &gray-n-500 "#565656"
  400: &gray-n-400 "#808080"
  300: &gray-n-300 "#C0BFC0"

gray-string:
  six: &gray-s-600 "#343741"
  five: &gray-s-500 "#565656"
  four: &gray-s-400 "#808080"
  three: &gray-s-300 "#C0BFC0"

border:
  light-n: *gray-n-300
  medium-n: *gray-n-400
  dark-n: *gray-n-500
  light-s: *gray-s-300
  medium-s: *gray-s-400
  dark-s: *gray-s-500

JSON output

"gray-numerical": {
  "300": "#C0BFC0",
  "400": "#808080",
  "500": "#565656",
  "600": "#343741"
},
"gray-string": {
  "six": "#343741",
  "five": "#565656",
  "four": "#808080",
  "three": "#C0BFC0"
},
"border": {
  "light-n": "#343741",
  "medium-n": "#343741",
  "dark-n": "#343741",
  "light-s": "#C0BFC0",
  "medium-s": "#808080",
  "dark-s": "#565656"
}

border.light-n, border.medium-n, and border.dark-n all compile incorrectly when they reference anchors within numerical keys.