pub fn print(tokens: &[Token]) -> String
Expand description
Prints the tokens as a string
ยงExample
use pretty_assertions::assert_str_eq;
use php_parser_rs::lexer::Lexer;
use php_parser_rs::printer::print;
let code = r#"
<?php
$a = 1;
$b = ['a', 'b', 'c'];
$c = "'Hello, World'? 'Hello, World'!";
__halt_compiler();
"#;
let tokens = Lexer::new().tokenize(code.as_bytes()).unwrap();
assert_str_eq!(print(&tokens), code);