YAML 1.2 parser / renderer

134 views
Skip to first unread message

Mike Stead

unread,
Apr 2, 2013, 6:38:39 AM4/2/13
to haxe...@googlegroups.com
I've just finished up porting the js-yaml parser and renderer over to Haxe. Currently JS, Flash and Neko 2.0 are supported and it should compile fine with Haxe 2.10+.

You can find it on haxelib:
 
haxelib install yaml

For more details head over to https://github.com/mikestead/hx-yaml

I'd like to include the C++ target but hxcpp doesn't compile unicode support into it's regex library yet (Neko added this in v2.0). Had a quick go at compiling the Java target but had a fair few errors.

Anyway let me know if you run into any problems.

Xerosugar

unread,
Jul 14, 2014, 11:44:25 AM7/14/14
to haxe...@googlegroups.com
Hi there!

I'm having some problems with yaml, maybe you can help me out (btw, this is on iOS-target. Desktop-target works without problems)?
I'm using it to keep track of highscores in my game, and this is what I'm trying to do:

var chapterData:AnyObjectMap = Yaml.read(SystemPath.documentsDirectory +"/chapter1.yaml", Parser.options().useMaps());
chapterData.get("highscores").set("level_" +Std.string(Reg.currentLevel), Reg.lastAquiredScore);
Yaml.write(SystemPath.documentsDirectory +"/chapter1.yaml", chapterData, Renderer.options().setIndent(4));
(line 449^)


I can read the file and display its contents without problems, but when I try to do write(), it crashes with this message:


Null Object Reference

Called from openfl.display.Stage.__pollTimers (openfl/display/Stage.hx line 1016)

Called from openfl.display.Stage.__checkRender (openfl/display/Stage.hx line 313)

Called from openfl.display.Stage.__render (openfl/display/Stage.hx line 1031)

Called from openfl.display.DisplayObjectContainer.__broadcast (openfl/display/DisplayObjectContainer.hx line 280)

Called from openfl.display.DisplayObject.__broadcast (openfl/display/DisplayObject.hx line 173)

Called from openfl.display.DisplayObject.__dispatchEvent (openfl/display/DisplayObject.hx line 194)

Called from openfl.events.EventDispatcher.dispatchEvent (openfl/events/EventDispatcher.hx line 98)

Called from openfl.events.Listener.dispatchEvent (openfl/events/EventDispatcher.hx line 268)

Called from flixel.FlxGame.onEnterFrame (flixel/FlxGame.hx line 493)

Called from flixel.FlxGame.step (flixel/FlxGame.hx line 648)

Called from flixel.FlxGame.update (flixel/FlxGame.hx line 702)

Called from flixel.FlxCamera.update (flixel/FlxCamera.hx line 561)

Called from flixel.FlxCamera.updateFade (flixel/FlxCamera.hx line 686)

Called from PlayState.nextStage (PlayState.hx line 449)

Called from yaml.Yaml.write (yaml/Yaml.hx line 64)

Called from yaml.Yaml.render (yaml/Yaml.hx line 51)

Called from yaml.Renderer.render (yaml/Renderer.hx line 100)

Called from yaml.Renderer.writeNode (yaml/Renderer.hx line 475)

Called from yaml.Renderer.writeBlockMapping (yaml/Renderer.hx line 333)

Called from yaml.Renderer.writeMapBlockMapping (yaml/Renderer.hx line 376)

Called from *._Function_1_1 (openfl/display/Stage.hx line 120)


Any ideas? :s
Reply all
Reply to author
Forward
0 new messages