Skip to content

Commit

Permalink
Support escape sequences outside double-quoted strings
Browse files Browse the repository at this point in the history
  • Loading branch information
anordal committed Jul 30, 2017
1 parent c406cd8 commit cb26bcb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions naziquote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,6 @@ impl Situation for SitStrDq {
#[allow(unused_variables)]
fn whatnow(&mut self, horizon: &[u8], is_horizon_lengthenable: bool) -> ParseResult {
for i in 0 .. horizon.len() {
if horizon[i] == b'\\' {
let esc = Box::new(SitExtent{len: 1, color: 0x01ff0080, end_insert: None});
return Ok(WhatNow{tri: Transition::Push(esc), pre: i, len: 1, alt: None});
}
if horizon[i] == b'\"' {
return Ok(WhatNow{tri: Transition::Pop, pre: i, len: 1, alt: None});
}
Expand Down Expand Up @@ -519,6 +515,12 @@ fn common_str_cmd(
pre: i, len: 1, alt: if_needed(need_quotes, b"\"$(")
}));
}
if horizon[i] == b'\\' {
let esc = Box::new(SitExtent{len: 1, color: 0x01ff0080, end_insert: None});
return Ok(Some(WhatNow{
tri: Transition::Push(esc), pre: i, len: 1, alt: None
}));
}
if horizon[i] == b'$' {
if i+1 < horizon.len() {
let c = horizon[i+1];
Expand Down

0 comments on commit cb26bcb

Please sign in to comment.