aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/lexer/comments.rs
diff options
context:
space:
mode:
authorZach Lute <[email protected]>2018-09-05 06:56:16 +0100
committerZach Lute <[email protected]>2018-09-05 06:56:16 +0100
commitaf0ae9ee0409ce2296dafebf977e353a5b871d80 (patch)
tree58a5db64a5279bf6586481224e8a772c3f965bfc /crates/libsyntax2/src/lexer/comments.rs
parentf87771092c5df9e9c07bcb5052e662bde0a0fa59 (diff)
Updated Ptr methods to better match Parser method names.
Diffstat (limited to 'crates/libsyntax2/src/lexer/comments.rs')
-rw-r--r--crates/libsyntax2/src/lexer/comments.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/libsyntax2/src/lexer/comments.rs b/crates/libsyntax2/src/lexer/comments.rs
index 01acb6515..eb417c2dc 100644
--- a/crates/libsyntax2/src/lexer/comments.rs
+++ b/crates/libsyntax2/src/lexer/comments.rs
@@ -3,7 +3,7 @@ use lexer::ptr::Ptr;
3use SyntaxKind::{self, *}; 3use SyntaxKind::{self, *};
4 4
5pub(crate) fn scan_shebang(ptr: &mut Ptr) -> bool { 5pub(crate) fn scan_shebang(ptr: &mut Ptr) -> bool {
6 if ptr.next_is('!') && ptr.nnext_is('/') { 6 if ptr.at_str("!/") {
7 ptr.bump(); 7 ptr.bump();
8 ptr.bump(); 8 ptr.bump();
9 bump_until_eol(ptr); 9 bump_until_eol(ptr);
@@ -14,15 +14,15 @@ pub(crate) fn scan_shebang(ptr: &mut Ptr) -> bool {
14} 14}
15 15
16fn scan_block_comment(ptr: &mut Ptr) -> Option<SyntaxKind> { 16fn scan_block_comment(ptr: &mut Ptr) -> Option<SyntaxKind> {
17 if ptr.next_is('*') { 17 if ptr.at('*') {
18 ptr.bump(); 18 ptr.bump();
19 let mut depth: u32 = 1; 19 let mut depth: u32 = 1;
20 while depth > 0 { 20 while depth > 0 {
21 if ptr.next_is('*') && ptr.nnext_is('/') { 21 if ptr.at_str("*/") {
22 depth -= 1; 22 depth -= 1;
23 ptr.bump(); 23 ptr.bump();
24 ptr.bump(); 24 ptr.bump();
25 } else if ptr.next_is('/') && ptr.nnext_is('*') { 25 } else if ptr.at_str("/*") {
26 depth += 1; 26 depth += 1;
27 ptr.bump(); 27 ptr.bump();
28 ptr.bump(); 28 ptr.bump();
@@ -37,7 +37,7 @@ fn scan_block_comment(ptr: &mut Ptr) -> Option<SyntaxKind> {
37} 37}
38 38
39pub(crate) fn scan_comment(ptr: &mut Ptr) -> Option<SyntaxKind> { 39pub(crate) fn scan_comment(ptr: &mut Ptr) -> Option<SyntaxKind> {
40 if ptr.next_is('/') { 40 if ptr.at('/') {
41 bump_until_eol(ptr); 41 bump_until_eol(ptr);
42 Some(COMMENT) 42 Some(COMMENT)
43 } else { 43 } else {
@@ -47,7 +47,7 @@ pub(crate) fn scan_comment(ptr: &mut Ptr) -> Option<SyntaxKind> {
47 47
48fn bump_until_eol(ptr: &mut Ptr) { 48fn bump_until_eol(ptr: &mut Ptr) {
49 loop { 49 loop {
50 if ptr.next_is('\n') || ptr.next_is('\r') && ptr.nnext_is('\n') { 50 if ptr.at('\n') || ptr.at_str("\r\n") {
51 return; 51 return;
52 } 52 }
53 if ptr.bump().is_none() { 53 if ptr.bump().is_none() {