for example, how to lex rust like raw string: r###"..."###
rule Init {
'r' '#'* '"' => |lexer| {
*lexer.state() = lexer.match_().len() - 1; // set the number of end mark “#...
lexer.switch_and_return(LexerRule::RawText, Token::RawTextStart)
},
}
rule RawText {
// here, I dont know how to constraint to number of '#'
_* '"' '#'* => |lexer| {
len n = *lexer.state();
let cont = lexer.match_();
let body = &cont[..cont.len() - n];
lexer.switch_and_return(LexerRule::Init, Token::RawTextCont(body, n));
},
}
for example, how to lex rust like raw string: r###"..."###