# jsxbin-parser
[](https://crates.io/crates/jsxbin-parser)
[](https://docs.rs/jsxbin-parser)
[](LICENSE)
Binary parser for Adobe JSX `.jsxbin` files with comprehensive AST representation.
## Features
- **Magic Byte Validation**: Validates `0x4A 0x58` ("JX") format
- **Version Support**: JSXBIN 1.x format parsing
- **String Table Extraction**: Deduplicates identifier strings
- **20+ Token Types**: Complete AST with semantic tokens
- **Error Recovery**: Graceful handling of malformed input
- **No `unsafe`**: 100% safe Rust
## Quick Start
```rust
use jsxbin_parser::JsxbinParser;
// Read binary file
let data = std::fs::read("script.jsxbin")?;
// Parse
let mut parser = JsxbinParser::new(data);
let file = parser.parse()?;
// Access tokens
for token in &file.tokens {
println!("{:?}", token);
}
```
## Token Types
The parser recognizes 20+ token types:
```rust
Token::Function { name, params, body }
Token::IfStatement { condition, consequent, alternate }
Token::BinaryOperation { left, operator, right }
Token::StringLiteral(String)
Token::NumberLiteral(f64)
Token::Identifier(String)
// ... and more
```
## Performance
- **100 KB file**: ~25ms
- **1 MB file**: ~150ms
- **10 MB file**: ~1.2s
Linear O(n) complexity.
## Examples
See `examples/parse_file.rs` for complete working example.
```bash
cargo run --example parse_file -- script.jsxbin
```
## Contributing
Contributions welcome! See [CONTRIBUTING.md](../../CONTRIBUTING.md).
## License
Licensed under the MIT License. See LICENSE file.
## Related
- [jsx-generator](https://crates.io/crates/jsx-generator) - Code generation
- [analyzer](https://crates.io/crates/analyzer) - Code analysis