Skip to main content

dump_ops

Function dump_ops 

Source
pub fn dump_ops(ops: &Ops) -> Result<()>
Expand description

Dumps all operands and operators of a code.

Returns a Result value, when an error occurs.

§Errors

Propagates any std::io::Error produced by the color-aware writer that backs stdout (broken pipe, write failure, …).

§Examples

use big_code_analysis::{dump_ops, Ast, LANG, Source};

let source_code = "int a = 42;";

// Retrieve all operands and operators via the `Ast::ops` seam.
let ops = Ast::parse(
    Source::new(LANG::Cpp, source_code.as_bytes())
        .with_name(Some("foo.c".to_owned())),
)
.expect("cpp feature enabled")
.ops()
.unwrap();

// Dump all operands and operators
dump_ops(&ops).unwrap();