parser/README.md

61 lines
1.4 KiB
Markdown
Raw Normal View History

# PHP-Parser
2022-07-20 20:35:03 +01:00
A handwritten recursive-descent parser for PHP written in Rust, for fun.
2022-11-27 16:48:12 +00:00
<p align="center">
2022-11-27 16:48:59 +00:00
<a href="https://justforfunnoreally.dev/">
<img src="https://img.shields.io/badge/justforfunnoreally-dev-9ff">
</a>
2022-11-27 16:48:12 +00:00
</p>
2022-07-20 20:35:03 +01:00
---
> **Warning**: This crate is not ready for any form of production use _yet_. There are still a lot of things missing from the parser, so please use at your own risk.
2022-09-12 00:32:25 +01:00
---
2022-09-12 00:28:42 +01:00
## Usage
Add `php-parser-rs` in your `Cargo.toml`'s `dependencies` section
```toml
[dependencies]
php-parser-rs = "0.0.0-b1"
```
### Example
2022-11-27 02:47:07 +00:00
```rust
use php_parser_rs::*;
let mut lexer = Lexer::new(None);
let tokens = lexer.tokenize(&source_code[..]).unwrap();
let mut parser = Parser::new(None);
let ast = parser.parse(tokens).unwrap();
```
2022-11-27 02:51:28 +00:00
## License
Licensed under either of
* Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
2022-09-12 00:42:34 +01:00
at your option.
2022-09-12 00:42:34 +01:00
## Contribution
2022-09-12 00:42:34 +01:00
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.
2022-09-12 00:42:34 +01:00
## Credits
2022-09-12 00:42:34 +01:00
* [Ryan Chandler](https://github.com/ryangjchandler)
* [All contributors](https://github.com/ryangjchandler/php-parser-rs/graphs/contributors)