Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ lazy_static = "1.0.1"
entities = "1.0.1"
unicode_categories = "0.1.1"
clap = { version = "2.32.0", optional = true }
twoway = "0.2"
memchr = "2"
pest = "2"
pest_derive = "2"
shell-words = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ extern crate lazy_static;
extern crate pest;
#[macro_use]
extern crate pest_derive;
extern crate memchr;
#[cfg(all(test, not(target_arch = "wasm32")))]
extern crate propfuzz;
extern crate regex;
Expand All @@ -86,7 +87,6 @@ extern crate syntect;
extern crate test;
#[cfg(test)]
extern crate timebomb;
extern crate twoway;
extern crate typed_arena;
extern crate unicode_categories;

Expand Down
14 changes: 7 additions & 7 deletions src/scanners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

*/

use memchr::memmem;
use pest::Parser;
use std::str;
use twoway::find_bytes;

#[cfg(debug_assertions)]
const _LEXER: &str = include_str!("lexer.pest");
Expand Down Expand Up @@ -44,19 +44,19 @@ pub fn atx_heading_start(line: &[u8]) -> Option<usize> {
#[inline(always)]
pub fn html_block_end_1(line: &[u8]) -> bool {
// XXX: should be case-insensitive
find_bytes(line, b"</script>").is_some()
|| find_bytes(line, b"</pre>").is_some()
|| find_bytes(line, b"</style>").is_some()
memmem::find(line, b"</script>").is_some()
|| memmem::find(line, b"</pre>").is_some()
|| memmem::find(line, b"</style>").is_some()
}

#[inline(always)]
pub fn html_block_end_2(line: &[u8]) -> bool {
find_bytes(line, b"-->").is_some()
memmem::find(line, b"-->").is_some()
}

#[inline(always)]
pub fn html_block_end_3(line: &[u8]) -> bool {
find_bytes(line, b"?>").is_some()
memmem::find(line, b"?>").is_some()
}

#[inline(always)]
Expand All @@ -66,7 +66,7 @@ pub fn html_block_end_4(line: &[u8]) -> bool {

#[inline(always)]
pub fn html_block_end_5(line: &[u8]) -> bool {
find_bytes(line, b"]]>").is_some()
memmem::find(line, b"]]>").is_some()
}

#[inline(always)]
Expand Down