refactor: utils macros
This commit is contained in:
parent
93ed18602a
commit
75362bd2a8
16 changed files with 70 additions and 91 deletions
|
|
@ -15,9 +15,9 @@ impl<'a> Macros<'a> {
|
|||
pub fn parse(src: &'a str) -> Option<(Macros<'a>, usize)> {
|
||||
starts_with!(src, "{{{");
|
||||
|
||||
expect!(src, 3, |c: u8| c.is_ascii_alphabetic());
|
||||
expect!(src, 3, |c: u8| c.is_ascii_alphabetic())?;
|
||||
|
||||
let name = until_while!(src, 3, |c| c == b'}' || c == b'(', valid_name);
|
||||
let name = until_while!(src, 3, |c| c == b'}' || c == b'(', valid_name)?;
|
||||
|
||||
if src.as_bytes()[name] == b'}' {
|
||||
expect!(src, name + 1, b'}')?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue