Skip to main content

tokenize

Function tokenize 

Source
pub fn tokenize(row: &str) -> (Vec<String>, Vec<Warning>)
Expand description

Extracts tokens from a grid row string.

Tokens are of the form {name} where name can contain any characters except }. Characters outside of tokens generate warnings.

ยงExamples

use pixelsrc::tokenizer::tokenize;

let (tokens, warnings) = tokenize("{a}{b}{c}");
assert_eq!(tokens, vec!["{a}", "{b}", "{c}"]);
assert!(warnings.is_empty());

let (tokens, warnings) = tokenize("x{a}y");
assert_eq!(tokens, vec!["{a}"]);
assert_eq!(warnings.len(), 2); // warnings for 'x' and 'y'