php-lexer 0.22.0

PHP lexer/tokenizer
Documentation

php-lexer

Hand-written, lazy PHP tokenizer with support for strings, heredoc/nowdoc and inline HTML.

use php_lexer::{Lexer, TokenKind};

let mut lexer = Lexer::new("<?php echo 'hello';");
loop {
    let token = lexer.next_token();
    if token.kind == TokenKind::Eof { break; }
    println!("{:?} {:?}", token.kind, token.span);
}

Most users want php-rs-parser instead. Part of the rust-php-parser workspace. API reference: docs.rs/php-lexer.

License

BSD 3-Clause