Metadata-Version: 2.4
Name: inscript-lang
Version: 3.9.6.23
Summary: InScript — a game-focused scripting language with 59 game modules and a bytecode VM
Home-page: https://github.com/authorss81/inscript
Author: Shreyasi Sarkar
License: MIT
Project-URL: Homepage, https://github.com/authorss81/inscript
Project-URL: Repository, https://github.com/authorss81/inscript
Project-URL: Bug Tracker, https://github.com/authorss81/inscript/issues
Project-URL: Documentation, https://authorss81.github.io/inscript/docs/
Keywords: game,scripting,language,gamedev,gdscript
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Software Development :: Interpreters
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: game
Requires-Dist: pygame>=2.0; extra == "game"
Provides-Extra: lsp
Requires-Dist: pygls>=1.0; extra == "lsp"
Provides-Extra: all
Requires-Dist: pygame>=2.0; extra == "all"
Requires-Dist: pygls>=1.0; extra == "all"
Dynamic: home-page
Dynamic: requires-python

# InScript Lexer - Rust Implementation (v3.7.2)

**Real, compilable Rust tokenizer** for InScript language.

## Features

✅ Zero-copy token references (fast, memory efficient)
✅ State machine lexer (no backtracking)
✅ 30+ token types (keywords, operators, literals)
✅ Accurate line/column tracking
✅ Comprehensive error reporting
✅ Python FFI via PyO3
✅ Full test coverage

## Build

```bash
cargo build --release
```

## Token Types Supported

### Literals
- Numbers (integers and floats)
- Strings (single and double quoted)
- Identifiers

### Keywords
- if, else, while, for, fn, return
- true, false, nil
- and, or, not

### Operators
- Arithmetic: +, -, *, /, %
- Comparison: ==, !=, <, <=, >, >=
- Assignment: =
- Logical: and, or, not

### Delimiters
- Parentheses: ( )
- Braces: { }
- Brackets: [ ]
- Punctuation: , . ; : ->

## Rust Usage

```rust
use inscript_lexer::Lexer;

fn main() {
    let code = "let x = 42;";
    let lexer = Lexer::new(code);
    
    for token in lexer {
        match token {
            Ok(t) => println!("{:?}: {}", t.token_type, t.value),
            Err(e) => eprintln!("Error: {}", e),
        }
    }
}
```

## Python Usage (after compilation)

```python
from inscript_lexer import PyLexer, tokenize_string

# Method 1: Using PyLexer class
lexer = PyLexer("let x = 42;")
tokens = lexer.tokens()
print(f"Found {lexer.count()} tokens")

# Method 2: Direct tokenization
tokens = tokenize_string("if true then x else y")
for token in tokens:
    print(f"{token.token_type}: {token.value}")
```

## Performance

### Expected Benchmarks
- Simple tokens: < 100ns per token
- Complex code: < 10µs per 100 tokens
- Memory: O(1) per token

### Optimizations
- Inline hot paths
- No allocations in common cases
- SIMD-friendly string scanning
- Zero-copy string references

## Testing

```bash
# Run tests
cargo test

# Run with output
cargo test -- --nocapture

# Benchmark
cargo bench
```

## Accuracy

✅ Correct line/column tracking
✅ Handles escape sequences
✅ Detects unterminated strings
✅ Error recovery

## License

MIT

