scanner/macros: isLineBreak! -> isBreak, add isBlank!, isBlankZ!
- isBlank checks for spaces or tabs - isBlankZ = isBreak! || isBlank! || empty names need some work
This commit is contained in:
parent
ba10beb0c6
commit
c478e26281
|
@ -79,9 +79,10 @@ macro_rules! check {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! isLineBreak {
|
||||
/// Check if the char (@offset) is a line break
|
||||
macro_rules! isBreak {
|
||||
(~ $buffer:expr $(, $offset:expr )? ) => {
|
||||
isLineBreak!($buffer.as_bytes() $(, $offset )? )
|
||||
isBreak!($buffer.as_bytes() $(, $offset )? )
|
||||
};
|
||||
($buffer:expr $(, $offset:expr )? ) => {
|
||||
check!($buffer $(, $offset)? =>
|
||||
|
@ -93,3 +94,26 @@ macro_rules! isLineBreak {
|
|||
)
|
||||
};
|
||||
}
|
||||
|
||||
/// Check if the char (@offset) is a space or tab
|
||||
macro_rules! isBlank {
|
||||
(~ $buffer:expr $(, $offset:expr )? ) => {
|
||||
isBlank!($buffer.as_bytes() $(, $offset )? )
|
||||
};
|
||||
($buffer:expr $(, $offset:expr )? ) => {
|
||||
check!($buffer $(, $offset)? => b' ' | b'\t')
|
||||
};
|
||||
}
|
||||
|
||||
/// Check if the char (@offset) is a space, tab or line
|
||||
/// break
|
||||
macro_rules! isBlankZ {
|
||||
(~ $buffer:expr $(, $offset:expr )? ) => {
|
||||
isBlankZ!($buffer.as_bytes() $(, $offset )? )
|
||||
};
|
||||
($buffer:expr $(, $offset:expr )? ) => {
|
||||
isBlank!($buffer $(, $offset)?)
|
||||
|| isBreak!($buffer $(, $offset)?)
|
||||
|| check!($buffer $(, $offset)? => [])
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue