Fix backslash bug (#915) (#916)

* Fix backslash bug (#915)

* fix

* Update test

Co-authored-by: scenq <me>
This commit is contained in:
sceneq 2022-08-15 01:35:25 +09:00 committed by GitHub
parent e1bde8ca0f
commit 3c486247fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -570,6 +570,8 @@ impl SyntaxCounter {
let quote = self.quote.take().unwrap();
trace!("End {:?}", quote);
Some(quote.len())
} else if !self.quote_is_verbatim && window.starts_with(br"\\") {
Some(2)
} else if !self.quote_is_verbatim
&& window.starts_with(br"\")
&& self

View file

@ -1,4 +1,4 @@
/* 23 lines 16 code 4 comments 3 blanks */
/* 37 lines 23 code 5 comments 9 blanks */
/*
* Simple test class
@ -21,3 +21,17 @@ class Foo
System.out.println("FooBar"); //Not counted
}
}
// issues/915
public class BackSlash {
public void run()
{
"\\"; // 1 code + 2 blanks
"\\"; // 1 code + 3 blanks
}
}