mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 05:17:08 +08:00
parent
b2ff4d6bc0
commit
5b136d450f
@ -3192,6 +3192,15 @@ impl<'s> Populator<'s> {
|
||||
}
|
||||
}
|
||||
}
|
||||
ParseTokenType::redirection if self.peek_type(0) == ParseTokenType::string => {
|
||||
let next = self.tokens.pop();
|
||||
parse_error_range!(
|
||||
self,
|
||||
next.range().combine(tok.range()),
|
||||
ParseErrorCode::generic,
|
||||
"Expected a string, but found a redirection"
|
||||
);
|
||||
}
|
||||
ParseTokenType::pipe
|
||||
| ParseTokenType::redirection
|
||||
| ParseTokenType::background
|
||||
|
@ -237,6 +237,18 @@ impl SourceRange {
|
||||
.try_into()
|
||||
.unwrap()
|
||||
}
|
||||
pub fn combine(&self, other: Self) -> Self {
|
||||
let start = std::cmp::min(self.start, other.start);
|
||||
SourceRange {
|
||||
start,
|
||||
length: std::cmp::max(self.end(), other.end())
|
||||
.checked_sub(start.try_into().unwrap())
|
||||
.expect("Overflow")
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
fn end_ffi(&self) -> u32 {
|
||||
self.start.checked_add(self.length).expect("Overflow")
|
||||
}
|
||||
|
@ -4883,6 +4883,11 @@ static void test_highlighting() {
|
||||
});
|
||||
#endif
|
||||
|
||||
highlight_tests.push_back({
|
||||
{L">", highlight_role_t::error},
|
||||
{L"echo", highlight_role_t::error},
|
||||
});
|
||||
|
||||
bool saved_flag = feature_test(feature_flag_t::ampersand_nobg_in_token);
|
||||
feature_set(feature_flag_t::ampersand_nobg_in_token, true);
|
||||
for (const highlight_component_list_t &components : highlight_tests) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user