From 700669bbd0ab3ae0c5a56985ce13ca896d342a3a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 22 Jul 2019 17:56:19 +0300 Subject: kill old lexer --- crates/ra_syntax/src/parsing/lexer/comments.rs | 57 -------------------------- 1 file changed, 57 deletions(-) delete mode 100644 crates/ra_syntax/src/parsing/lexer/comments.rs (limited to 'crates/ra_syntax/src/parsing/lexer/comments.rs') diff --git a/crates/ra_syntax/src/parsing/lexer/comments.rs b/crates/ra_syntax/src/parsing/lexer/comments.rs deleted file mode 100644 index 8bbbe659b..000000000 --- a/crates/ra_syntax/src/parsing/lexer/comments.rs +++ /dev/null @@ -1,57 +0,0 @@ -use crate::parsing::lexer::ptr::Ptr; - -use crate::SyntaxKind::{self, *}; - -pub(crate) fn scan_shebang(ptr: &mut Ptr) -> bool { - if ptr.at_str("!/") { - ptr.bump(); - ptr.bump(); - bump_until_eol(ptr); - true - } else { - false - } -} - -fn scan_block_comment(ptr: &mut Ptr) -> Option { - if ptr.at('*') { - ptr.bump(); - let mut depth: u32 = 1; - while depth > 0 { - if ptr.at_str("*/") { - depth -= 1; - ptr.bump(); - ptr.bump(); - } else if ptr.at_str("/*") { - depth += 1; - ptr.bump(); - ptr.bump(); - } else if ptr.bump().is_none() { - break; - } - } - Some(COMMENT) - } else { - None - } -} - -pub(crate) fn scan_comment(ptr: &mut Ptr) -> Option { - if ptr.at('/') { - bump_until_eol(ptr); - Some(COMMENT) - } else { - scan_block_comment(ptr) - } -} - -fn bump_until_eol(ptr: &mut Ptr) { - loop { - if ptr.at('\n') || ptr.at_str("\r\n") { - return; - } - if ptr.bump().is_none() { - break; - } - } -} -- cgit v1.2.3