Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document crashes JS parser (but works in Ruby) #19

Closed
jarib opened this issue Mar 15, 2016 · 3 comments
Closed

Document crashes JS parser (but works in Ruby) #19

jarib opened this issue Mar 15, 2016 · 3 comments

Comments

@jarib
Copy link

jarib commented Mar 15, 2016

Here's a document that crashes the JS parser but works fine in Ruby:

{part1}

text1: foo bar

bar baz

* foo
* bar
* baz

:end
{}
$ node -e 'console.log(require("archieml").load(require("fs").readFileSync("test.aml", "utf-8")))'
/vg/google-drive-sync/node_modules/archieml/archieml.js:95
    stackScope.array.push('');
                    ^

TypeError: Cannot read property 'push' of null
    at parseArrayElement (/vg/google-drive-sync/node_modules/archieml/archieml.js:95:21)
    at Object.load (/vg/google-drive-sync/node_modules/archieml/archieml.js:52:7)
    at [eval]:1:33
    at Object.exports.runInThisContext (vm.js:54:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:413:34)
    at node.js:612:27
    at nextTickCallbackWith0Args (node.js:453:9)
    at process._tickCallback (node.js:382:13)
$ ruby -r archieml -e 'p Archieml.load(File.read("test.aml"))'
{"part1"=>{"text1"=>"foo bar\n\nbar baz\n\n* foo\n* bar\n* baz"}}
$
@adrian-the-git
Copy link

It works fine in python too. I'm curious what happens if you rewind the js version to 96fbe6c, just before support was added for freeform arrays. That's when a number of problems started.

@jarib
Copy link
Author

jarib commented Jul 17, 2016

Thanks for the fix, @abstrctn! I see you bumped the version number, but looks like you forgot to npm publish?

@abstrctn
Copy link
Contributor

Right you are! Apologies, v0.4.2 should be published now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants