use ::situation::Situation;
use ::situation::Transition;
use ::situation::WhatNow;
use ::situation::ParseResult;
use ::situation::flush;
use commonstrcmd::CommonStrCmdResult;
use commonstrcmd::common_str_cmd;
pub struct SitStrDq {}
impl Situation for SitStrDq {
fn whatnow(&mut self, horizon: &[u8], is_horizon_lengthenable: bool) -> ParseResult {
for i in 0 .. horizon.len() {
if horizon[i] == b'\"' {
return Ok(WhatNow{tri: Transition::Pop, pre: i, len: 1, alt: None});
}
match common_str_cmd(&horizon, i, is_horizon_lengthenable, false) {
CommonStrCmdResult::None => {},
CommonStrCmdResult::Err(e) => { return Err(e); },
CommonStrCmdResult::Ok(x) => { return Ok(x); },
CommonStrCmdResult::OnlyWithQuotes(x) => { return Ok(x); },
CommonStrCmdResult::OnlyWithoutQuotes(_) => {
panic!("Unreachability assertion failed");
},
}
}
Ok(flush(horizon.len()))
}
fn get_color(&self) -> u32{
0x00ff0000
}
}