Implemented syntax highlighting

This commit is contained in:
2026-02-18 02:00:45 -05:00
parent 87d465034a
commit 43b171fab1
21 changed files with 772 additions and 262 deletions

View File

@@ -348,18 +348,14 @@ impl ViNormal {
/// End the parse and clear the pending sequence
#[track_caller]
pub fn quit_parse(&mut self) -> Option<ViCmd> {
flog!(DEBUG, std::panic::Location::caller());
flog!(
WARN,
"exiting parse early with sequence: {}",
self.pending_seq
);
log::debug!("{:?}", std::panic::Location::caller());
log::warn!("exiting parse early with sequence: {}", self.pending_seq);
self.clear_cmd();
None
}
pub fn try_parse(&mut self, ch: char) -> Option<ViCmd> {
self.pending_seq.push(ch);
flog!(DEBUG, "parsing {}", ch);
log::debug!("parsing {}", ch);
let mut chars = self.pending_seq.chars().peekable();
/*
@@ -1002,8 +998,8 @@ impl ViNormal {
};
if chars.peek().is_some() {
flog!(WARN, "Unused characters in Vi command parse!");
flog!(WARN, "{:?}", chars)
log::warn!("Unused characters in Vi command parse!");
log::warn!("{:?}", chars)
}
let verb_ref = verb.as_ref().map(|v| &v.1);
@@ -1149,12 +1145,8 @@ impl ViVisual {
/// End the parse and clear the pending sequence
#[track_caller]
pub fn quit_parse(&mut self) -> Option<ViCmd> {
flog!(DEBUG, std::panic::Location::caller());
flog!(
WARN,
"exiting parse early with sequence: {}",
self.pending_seq
);
log::debug!("{:?}", std::panic::Location::caller());
log::warn!("exiting parse early with sequence: {}", self.pending_seq);
self.clear_cmd();
None
}
@@ -1638,7 +1630,7 @@ impl ViVisual {
));
}
ch if ch == 'i' || ch == 'a' => {
flog!(DEBUG, "in text_obj parse");
log::debug!("in text_obj parse");
let bound = match ch {
'i' => Bound::Inside,
'a' => Bound::Around,
@@ -1662,7 +1654,7 @@ impl ViVisual {
_ => return self.quit_parse(),
};
chars = chars_clone;
flog!(DEBUG, obj, bound);
log::debug!("{obj:?}, {bound:?}");
break 'motion_parse Some(MotionCmd(count, Motion::TextObj(obj)));
}
_ => return self.quit_parse(),
@@ -1670,13 +1662,13 @@ impl ViVisual {
};
if chars.peek().is_some() {
flog!(WARN, "Unused characters in Vi command parse!");
flog!(WARN, "{:?}", chars)
log::warn!("Unused characters in Vi command parse!");
log::warn!("{:?}", chars)
}
let verb_ref = verb.as_ref().map(|v| &v.1);
let motion_ref = motion.as_ref().map(|m| &m.1);
flog!(DEBUG, verb_ref, motion_ref);
log::debug!("{verb_ref:?}, {motion_ref:?}");
match self.validate_combination(verb_ref, motion_ref) {
CmdState::Complete => Some(ViCmd {