rawk-core 0.3.2

Core library for the AWK interpreter
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;

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

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