Skip to main content

Crate php_printer

Crate php_printer 

Source
Expand description

Pretty printer for PHP AST — converts parsed AST back to PHP source code.

§Example

let arena = bumpalo::Bump::new();
let result = php_rs_parser::parse(&arena, "<?php echo 1 + 2;");
let output = php_printer::pretty_print(&result.program);
assert_eq!(output, "echo 1 + 2;");

Structs§

PrinterConfig
Configuration for the pretty printer.

Enums§

Indent
Indentation style.

Functions§

pretty_print
Pretty-print a program’s statements (without <?php header).
pretty_print_file
Pretty-print a complete PHP file (prepends <?php\n\n).
pretty_print_with_config
Pretty-print with custom configuration.