#sqlite #tokenizer #tokenize

sqlite3_tokenizer

以SQLite的方式对SQL字符串进行标记化

1个不稳定版本

使用旧的Rust 2015

0.1.0 2015年6月7日

10#sqlite3

MIT 许可证

52KB
1K SLoC

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

该crate提供了Tokenizer,它按SQLite的方式遍历SQL字符串中的标记。

示例

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);
    }
}

输出

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:

以SQLite的方式对SQL字符串进行标记化。

此功能旨在为SQLite库的实现者提供。

示例

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

输出

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"

依赖项

~54KB