blockly-parser 0.1.0

Deserialize XML generated by the Google Blockly UI into data structures.
Documentation
  • Coverage
  • 0%
    0 out of 15 items documented0 out of 6 items with examples
  • Size
  • Source code size: 16.58 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.1 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • andrewjensen/blockly-parser-rs
    3 2 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • andrewjensen

Blockly Parser

Deserialize XML generated by the Google Blockly UI into data structures.

Example usage:

extern crate blockly_parser;

use blockly_parser::{
    Program,
    StatementBody,
    Block,
    FieldValue,
    program_from_xml,
};

fn main() {
    let xml: &str = r#"
        <xml xmlns="http://www.w3.org/1999/xhtml">
            <variables></variables>
            <block type="main_loop" id="[.)/fqUYv92(mzb{?:~u">
                <statement name="BODY">
                    <block type="inner_loop" id="]Lb|t?wfd#;s)[llJx8Y">
                        <field name="COUNT">3</field>
                        <statement name="BODY">
                            <block type="led_on" id="^3xb.m4E9i0;3$R10(=5">
                                <field name="TIME">300</field>
                                <next>
                                    <block type="led_off" id="HX4*sB9=gbJtq$Y{ke6b">
                                        <field name="TIME">100</field>
                                    </block>
                                </next>
                            </block>
                        </statement>
                        <next>
                            <block type="led_on" id="kB~f~7W`wkGa0i4z3mHw">
                                <field name="TIME">100</field>
                                <next>
                                    <block type="led_off" id="$fdlZB)btzA8YtB/!xz`">
                                        <field name="TIME">100</field>
                                    </block>
                                </next>
                            </block>
                        </next>
                    </block>
                </statement>
            </block>
        </xml>
    "#;

    let program: Program = program_from_xml(xml);
    let main_group: StatementBody = program.groups.get(0).unwrap();
    let main_loop_block: Block = main_group.blocks.get(0).unwrap();
}

See the unit tests for more details.