PrismarineJS / node-mojangson

A mojangson parser written in node.js
17 stars 9 forks source link

bug in new mojangson implementation #12

Closed IdanHo closed 4 years ago

IdanHo commented 4 years ago

Hey, it seems to not be able to parse the following text:

Error: Error parsing text '{id:"minecraft:yellow_shulker_box",Count:1b,tag:{BlockEntityTag:{CustomName:"Stacked Totems",x:0,y:0,z:0,id:"minecraft:shulker_box",Lock:""},display:{Name:"Stacked Totems"}},Damage:0s}'
offset: 138,
token: { value: '"' }

looks to me like its failing on the empty string.

IdanHo commented 4 years ago

I think this can be fixed by replacing the :+ in https://github.com/PrismarineJS/node-mojangson/blob/master/grammar.ne#L22 with :* (aka instead of one and up to zero and up)

Karang commented 4 years ago

yes that could work can you make a pr to fix it and add your text to the tests ?