rawk-core 0.6.0

Core library for an AWK interpreter with the goal to be POSIX compatible.
Documentation

rawk-core

CI codecov License: MIT Deps.rs Crate Dependencies (latest) Crates.io Version

Core implementation of an AWK interpreter, providing token definitions, lexical analysis, parsing, and evaluation. rawk-core is a Rust implementation of AWK with the goal of POSIX compatibility. Pronounced rök (Swedish for “smoke”).

rawk-core is a low-level interpreter crate. Higher-level CLI handling, file I/O, and argument parsing are expected to live in a separate crate or binary, see rawk.

Example

use rawk_core::awk::Awk;

fn main() {
  // Compile a simple AWK program that prints each input line
  let awk = Awk::new("{ print }").unwrap();
  let output = awk.run(vec!["foo".into(), "bar".into()], None);

    // Each input line is echoed to the output
    assert_eq!(output, vec!["foo".to_string(), "bar".to_string()]);
}