cursive

cson for haxe
https://github.com/disjukr/cursive

To install, run:

haxelib install cursive 0.2.0 

See using Haxelib in Haxelib documentation for more information.

README.md

cursive

travis

CSON(cursive script object notation) implementation for haxe.

What is CSON?

CSON is strict superset of JSON while offering plenty of convenient syntax.

{
    "key1": "value", # You can write comment!
    key2: "value", # You don't need quoting for key
    key3: "value" # You can omit the comma when followed by newline
    key4 = "value" # You can use equal sign instead of colon
    key5 = 'value' # You can use single quote instead of double quote
    key6 = |You can write
           |multiline string
           |easy
}

And...

"key1": "value", # You can write comment!
key2: "value", # You don't need quoting for key
key3: "value" # You can omit the comma when followed by newline
key4 = "value" # You can use equal sign instead of colon
key5 = 'value' # You can use single quote instead of double quote
key6 = |You can write
       |multiline string
       |easy

You can omit the top-level enclosing braces!

that is converted to JSON like this:

{
    "key1": "value",
    "key2": "value",
    "key3": "value",
    "key4": "value",
    "key5": "value",
    "key6": "You can write\nmultiline string\neasy"
}

How to use?

haxelib install cursive to install.

haxe test.hxml to test.

usage:

import haxe.Cson;

class Main {
    public static function main() {
        var text = "a = 1, b = 2"; // 1. write cson
        trace(Cson.toJson(text)); // 2. ????
        trace(Cson.parse(text)); // 3. profit!
    }
}

License

The MIT License (MIT)

Copyright (c) 2013, JongChan Choi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributors
disjukr
Version
0.2.0
Published
13 years ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂