Improve colon sep

This commit is contained in:
JT 2021-07-17 10:00:41 +12:00
parent 6aef00ecff
commit 03a93bd089
2 changed files with 10 additions and 2 deletions

View file

@ -54,6 +54,13 @@ impl LexMode {
_ => false,
}
}
pub fn special_contains(&self, b: u8) -> bool {
match self {
LexMode::Custom { ref special, .. } => special.contains(&b),
_ => false,
}
}
}
// A baseline token is terminated if it's not nested inside of a paired
@ -67,7 +74,8 @@ fn is_item_terminator(block_level: &[BlockKind], c: u8, lex_mode: &LexMode) -> b
|| c == b'|'
|| c == b';'
|| c == b'#'
|| lex_mode.whitespace_contains(c))
|| lex_mode.whitespace_contains(c)
|| lex_mode.special_contains(c))
}
// A special token is one that is a byte that stands alone as its own token. For example

View file

@ -999,7 +999,7 @@ impl ParserWorkingSet {
desc: String::new(),
long: String::from_utf8_lossy(contents).to_string(),
short: None,
required: true,
required: false,
}));
} else {
// Positional arg