tj / js-yaml

CommonJS YAML Parser -- fast, elegant and tiny yaml parser for javascript
276 stars 41 forks source link

Weird dedenting error #36

Open pjlsergeant opened 12 years ago

pjlsergeant commented 12 years ago

Given

addresses:
  - title: Google Inc.
    atoms:
      - Google Inc.
      - 1600 Amphitheatre Parkway
      - Mountain View
    postcode: CA 94043
    country: US
  - title: Google London
    atoms:
      - Google London
      - Google UK Ltd
      - Belgrave House
      - 76 Buckingham Palace Road
      - London
    postcode: SW1W 9TQ
    country: UK

I'm getting:

Error: hash not properly dedented, near "\n    atoms:\n      - Googl"
    at Parser.expect (/mnt/hgfs/Code Folder/AddressFind/new_js/node_modules/yaml/lib/yaml.js:179:9)
    at Parser.parseHash (/mnt/hgfs/Code Folder/AddressFind/new_js/node_modules/yaml/lib/yaml.js:280:12)
    at Parser.parse (/mnt/hgfs/Code Folder/AddressFind/new_js/node_modules/yaml/lib/yaml.js:239:19)
    at Object.eval (/mnt/hgfs/Code Folder/AddressFind/new_js/node_modules/yaml/lib/yaml.js:381:46)
    at /mnt/hgfs/Code Folder/AddressFind/new_js/test.js:33:34
    at /mnt/hgfs/Code Folder/AddressFind/new_js/node_modules/jsdom/lib/jsdom.js:193:9
    at /mnt/hgfs/Code Folder/AddressFind/new_js/node_modules/jsdom/lib/jsdom.js:201:11
    at Object.<anonymous> (/mnt/hgfs/Code Folder/AddressFind/new_js/node_modules/jsdom/lib/jsdom/level2/events.js:290:17)
    at Object.dispatchEvent (/mnt/hgfs/Code Folder/AddressFind/new_js/node_modules/jsdom/lib/jsdom/level2/html.js:474:55)
    at /mnt/hgfs/Code Folder/AddressFind/new_js/node_modules/jsdom/lib/jsdom/level2/html.js:61:15

Which is a shame. The YAML looks valid to me (and is happily parsed by the Perl YAML modules I'm using)

ghost commented 12 years ago

Hello, I was having the same problem but if you read the Readme you will see that this has pretty sparse support for the YAML spec. I did find this though while I was Googling for alternatives https://code.google.com/p/javascript-yaml-parser/ and I started a branch here https://github.com/RumpleFraggle/javascript-yaml-parser

I want to stress as much as possible that I can take absolutely no credit for this. I just re-posted the SVN as a GIT

pjlsergeant commented 12 years ago

Thanks for emailing me this!

On Tuesday, January 10, 2012, Rumple Fraggle < reply@reply.github.com> wrote:

Hello, I was having the same problem but if you read the Readme you will see that this has pretty sparse support for the YAML spec. I did find this though while I was Googling for alternatives https://code.google.com/p/javascript-yaml-parser/ and I started a branch here https://github.com/RumpleFraggle/javascript-yaml-parser

I want to stress as much as possible that I can take absolutely no credit for this. I just re-posted the SVN as a GIT


Reply to this email directly or view it on GitHub: https://github.com/visionmedia/js-yaml/issues/36#issuecomment-3426281

enyo commented 12 years ago

I think that is your issue: https://github.com/visionmedia/js-yaml/issues/45