diff options
author | sceneq <sceneq@users.noreply.github.com> | 2022-08-15 01:35:25 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-14 18:35:25 +0200 |
commit | 3c486247fb6d1e9868d5bfbe7f33efbf7ac21d5f (patch) | |
tree | af6ef5e4f17e95b7ae62bd3431ff1ee95fa06e07 | |
parent | e1bde8ca0f16797dccebcc3fd99b8a6f50bb16ef (diff) |
Fix backslash bug (#915) (#916)
* Fix backslash bug (#915)
* fix
* Update test
Co-authored-by: scenq <me>
-rw-r--r-- | src/language/syntax.rs | 2 | ||||
-rw-r--r-- | tests/data/java.java | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/language/syntax.rs b/src/language/syntax.rs index f2e3e67..4489213 100644 --- a/src/language/syntax.rs +++ b/src/language/syntax.rs @@ -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 diff --git a/tests/data/java.java b/tests/data/java.java index e856ab0..5991c3a 100644 --- a/tests/data/java.java +++ b/tests/data/java.java @@ -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 + + + + } +} |