Skip to content

Commit 7f1dfa0

Browse files
Merge pull request #1493 from kellda/ignore-quoted
Ignore command in quoted text
2 parents ffa43f7 + 9c0bbc4 commit 7f1dfa0

File tree

5 files changed

+251
-175
lines changed

5 files changed

+251
-175
lines changed

parser/src/code_block.rs

-165
This file was deleted.

parser/src/command.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::code_block::ColorCodeBlocks;
21
use crate::error::Error;
2+
use crate::ignore_block::IgnoreBlocks;
33
use crate::token::{Token, Tokenizer};
44

55
pub mod assign;
@@ -33,7 +33,7 @@ pub enum Command<'a> {
3333
pub struct Input<'a> {
3434
all: &'a str,
3535
parsed: usize,
36-
code: ColorCodeBlocks,
36+
ignore: IgnoreBlocks,
3737

3838
// A list of possible bot names.
3939
bot: Vec<&'a str>,
@@ -64,7 +64,7 @@ impl<'a> Input<'a> {
6464
Input {
6565
all: input,
6666
parsed: 0,
67-
code: ColorCodeBlocks::new(input),
67+
ignore: IgnoreBlocks::new(input),
6868
bot,
6969
}
7070
}
@@ -141,11 +141,11 @@ impl<'a> Input<'a> {
141141
}
142142

143143
if self
144-
.code
145-
.overlaps_code((self.parsed)..(self.parsed + tok.position()))
144+
.ignore
145+
.overlaps_ignore((self.parsed)..(self.parsed + tok.position()))
146146
.is_some()
147147
{
148-
log::info!("command overlaps code; code: {:?}", self.code);
148+
log::info!("command overlaps ignored block; ignore: {:?}", self.ignore);
149149
return None;
150150
}
151151

0 commit comments

Comments
 (0)