Skip to content

optozorax/simple_rustc_tokenizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple rustc tokenizer

Based on rustc_lexer

usage

use Token::*;
let string = r#"ident  = "string\n\u{55}";"#;
assert_eq!(tokenize(string), Ok(vec![
    TokenWithPos { range: 0..5, token: Ident("ident") },
    TokenWithPos { range: 5..7, token: Whitespace },
    TokenWithPos { range: 7..8, token: Eq },
    TokenWithPos { range: 8..9, token: Whitespace },
    TokenWithPos { range: 9..25, token: UnescapedString("string\n\u{55}".to_string()) },
    TokenWithPos { range: 25..26, token: Semi },
]));

About

Tokenizer based on rustc_lexer with simple interface

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages