BoostIO / BoostNote-Legacy

This repository is outdated and new Boost Note app is available! We've launched a new Boost Note app which supports real-time collaborative writing. https://github.com/BoostIO/BoostNote-App
Other
17.07k stars 1.47k forks source link

Parsing of an existing storage fails in own compiled app #158

Closed tejado closed 5 years ago

tejado commented 7 years ago

If I compile/run Boostnote myself, I getting following error in the dev console during start or if I want to add an existing storage. From my perspective, it seems that season parser.js is missing functions for StringLiteral (and furthers) or that somehow the parser type naming changed to more specified ones ("Literal" to "StringLiteral").

parse.js:205 Uncaught (in promise) SyntaxError: Syntax error on line 1, column 7: Unexpected StringLiteral
  at transformNode (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:205:13)
  at Value (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:87:14)
  at transformNode (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:207:12)
  at /Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:124:17
  at Array.reduce (native)
  at Obj (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:117:30)
  at transformNode (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:207:12)
  at Value (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:87:14)
  at transformNode (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:207:12)
  at Block (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:84:14)
  at transformNode (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:207:12)
  at Object.parse (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/node_modules/cson-parser/lib/parse.js:213:12)
  at parseObject (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/lib/cson.js:42:23)
  at parseContentsSync (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/lib/cson.js:68:16)
  at Object.readFileSync (/Users/tejado/somedir/Boostnote/node_modules/@rokt33r/season/lib/cson.js:170:14)
  at parseCSONFile (<anonymous>:26:23)
  at Array.map (native)
  at resolveStorageNotes (<anonymous>:24:6)
  at eval (<anonymous>:59:12)
mikeres0 commented 7 years ago

+1 It happens when the file is trying to be parsed. The error originates in cson.js in the parseObject function at parsed = CSON.parse(content). I've been trying to figure this all day! It seems like there may be an odd character in the .cson file.

tejado commented 7 years ago

:D it seems we are struggling about the same issues! In my opinion it has nothing to do with the cson file. It is more about the parser.js in the @rokt33r/season module. In this file, a object named nodeTransforms is initiated, including a method for the type "Literal". But it will be called with "StringLiteral" which does not exist (-> an exception is thrown in transformNode). So you can add it yourself by copying the "Literal" stuff to "StringLiteral". Then the error dissapears and you get a new one with BooleanLiteral (I guess due to isStarred in the cson file). I'm wondering why this is the case...

By the way: this issue doesn't happen with the official app but same note files!

mikeres0 commented 7 years ago

Mind emailing the code? :)

tejado commented 7 years ago

Here is my debugging result (added some console.log stuff to understand it better and the highlighted StringLiteral function): https://gist.github.com/tejado/5d847ae74036f1a301fc3bb5a84b3e99#file-parser-js-L95-L112

mikeres0 commented 7 years ago

I added one in for BooleanLiteral too

tejado commented 7 years ago

And it's working? I'm curious if this is really an issue with this parser.js.

mikeres0 commented 7 years ago

It works for me now, I can add existing folders

Flexo013 commented 5 years ago

@tejado Are you still experiencing this issue?

tejado commented 5 years ago

Sorry, I'm not really using Boostnote at the moment so I can't verify this. Feel free to close it.