1 unstable release

Uses old Rust 2015

0.1.0 Jun 7, 2015

#11 in #sqlite3

MIT license

52KB
1K SLoC

C 763 SLoC // 0.1% comments Rust 433 SLoC // 0.0% comments

This crate provides Tokenizer, which iterates over tokens in a SQL string as SQLite would.

Example

extern crate sqlite3_tokenizer;

use sqlite3_tokenizer::Tokenizer;

fn main() {
    for token in Tokenizer::new("SELECT * FROM t") {
        println!("Token of kind {:?} is written {:?}", token.kind, token.text);
    }
}

outputs

Token of kind Select is written "SELECT"
Token of kind Space is written " "
Token of kind Star is written "*"
Token of kind Space is written " "
Token of kind From is written "FROM"
Token of kind Space is written " "
Token of kind Id is written "t"

lib.rs:

Tokenizes SQL strings as SQLite would.

This is intended for implementors of SQLite libraries.

Example

for token in Tokenizer::new("SELECT * FROM t") {
    println!("Token of kind {:?} is written {:?}", token.kind, token.text);
}

outputs

Token of kind Select is written "SELECT"
Token of kind Space is written " "
Token of kind Star is written "*"
Token of kind Space is written " "
Token of kind From is written "FROM"
Token of kind Space is written " "
Token of kind Id is written "t"

Dependencies

~54KB