Crate mpc

Source
Expand description

This crate provides simple bindings for orangeduck’s mpc library. This is still a work in progress and contains a modified version of mpc and some temporary glue code

Modules§

ast
Contains an AST type to which mpc_ast_t is mapped
colors
Contains consts for ANSI color escape sequences
glue
Contains the rust-side of glue code. The main purpose of the code is to avoid having to interface with a C union in Rust. The main offender is mpc_result_t
macros
Contains some nice macros to help with needed FFI and parser creation The str_c! and c_str! macros exist because of ownership issues
mpc_c
Contains mpc function definitions
mpc_c_types
Contains a Rust representation of mpc’s underlying C types that are exposed in the mpc.h header

Macros§

c_str
Convert a rustic string (whether &str or String) to C’s const char*
dfs
Dereference pointer and convert struct member mem to String
dfu
Dereference pointer and convert struct member mem to usize
g_string
simulate C’s compile time string literal concatenation to allow copy-pasta of mpc grammars written in C without any hassle
parser
Create a mpc_parser_t using mpca_lang grammars
run_parser
Runs a parser prepared with parser!
str_c
Convert a C’s const char* to a rustic String
trace
print! for lazy people - no format, args are thrown in delimited with spaces
traceln
println! for lazy people - no format, args are thrown in delimited with spaces also throw in a newline