9 releases

0.1.12 Mar 1, 2022
0.1.11 Feb 24, 2022

#1711 in Parser implementations

21 downloads per month
Used in arpx

Custom license

36KB
955 lines

arpx_job_parser

Parse arpx job scripts for runtime

Description

This library provides parser functions for processing arpx job scripts.

Usage

use arpx_job_parser::parse_job;

fn main() {
    let job = r#"
        [
            (loop1 ? loop2 : loop3;)
            loop2 ? loop3 : loop4;
        ]
        loop3 ? loop4 : loop5;
        loop6;
        (loop7 ? loop8;)
    "#;

    let parsed = parse_job(job);

    dbg!(parsed);
}

// [src/main.rs:16] parsed = Ok(
//     (
//         "",
//         Job {
//             tasks: [
//                 Task {
//                     processes: [
//                         Process {
//                             name: "loop1",
//                             onfail: "loop3",
//                             onsucceed: "loop2",
//                         },
//                         Process {
//                             name: "loop2",
//                             onfail: "loop4",
//                             onsucceed: "loop3",
//                         },
//                     ],
//                 },
//                 Task {
//                     processes: [
//                         Process {
//                             name: "loop3",
//                             onfail: "loop5",
//                             onsucceed: "loop4",
//                         },
//                     ],
//                 },
//                 Task {
//                     processes: [
//                         Process {
//                             name: "loop6",
//                             onfail: "",
//                             onsucceed: "",
//                         },
//                     ],
//                 },
//                 Task {
//                     processes: [
//                         Process {
//                             name: "loop7",
//                             onfail: "",
//                             onsucceed: "loop8",
//                         },
//                     ],
//                 },
//             ],
//         },
//     ),
// )

No runtime deps