ngc

Crates.iongc
lib.rsngc
version0.2.6
sourcesrc
created_at2019-05-23 11:40:35.316413
updated_at2022-03-04 19:20:36.141638
descriptionLibrary to parse G-code (LinuxCNC dialect)
homepage
repositoryhttps://github.com/birkenfeld/ngc
max_upload_size
id136337
size87,834
Georg Brandl (birkenfeld)

documentation

https://docs.rs/ngc

README

ngc - G-Code parser/evaluator for Rust

Build Status Build Status crates.io

Work in progress!

Currently, only the parser is functional.

Documentation

Module documentation is hosted on docs.rs.

Examples

The following code (the same as the "ngc-parse" demo binary) takes a file as an argument, parses it and outputs the display form, which is the same G-code, but in a consistent format and cleaned of comments.

use std::{env, fs};
use ngc::parse::parse;

fn main() {
    let filename = env::args().nth(1).unwrap();
    let input = fs::read_to_string(&filename).unwrap();

    match parse(&filename, &input) {
        Err(e) => eprintln!("Parse error: {}", e),
        Ok(prog) => println!("{}", prog),
    }
}
Commit count: 36

cargo fmt