From f4f79038d103c77e36b9b4eb74f532a7f9598234 Mon Sep 17 00:00:00 2001
From: Christopher Durham <cad97@cad97.com>
Date: Sun, 28 Jan 2018 05:08:25 -0500
Subject: [PATCH 1/2] Block Comments

closes #7
---
 src/lexer/comments.rs                    | 25 +++++++++++++++++++++++-
 tests/data/lexer/00012_block_comment.rs  |  4 ++++
 tests/data/lexer/00012_block_comment.txt |  7 +++++++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 tests/data/lexer/00012_block_comment.rs
 create mode 100644 tests/data/lexer/00012_block_comment.txt

diff --git a/src/lexer/comments.rs b/src/lexer/comments.rs
index b70f2c6c677..d388561bff2 100644
--- a/src/lexer/comments.rs
+++ b/src/lexer/comments.rs
@@ -14,12 +14,35 @@ pub(crate) fn scan_shebang(ptr: &mut Ptr) -> bool {
     }
 }
 
+pub(crate) fn scan_block_comment(ptr: &mut Ptr) -> Option<SyntaxKind> {
+    if ptr.next_is('*') {
+        ptr.bump();
+        let mut depth: u32 = 1;
+        while depth > 0 {
+            if ptr.next_is('*') && ptr.nnext_is('/') {
+                depth -= 1;
+                ptr.bump();
+                ptr.bump();
+            } else if ptr.next_is('/') && ptr.nnext_is('*') {
+                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<SyntaxKind> {
     if ptr.next_is('/') {
         bump_until_eol(ptr);
         Some(COMMENT)
     } else {
-        None
+        scan_block_comment(ptr)
     }
 }
 
diff --git a/tests/data/lexer/00012_block_comment.rs b/tests/data/lexer/00012_block_comment.rs
new file mode 100644
index 00000000000..708aac197f2
--- /dev/null
+++ b/tests/data/lexer/00012_block_comment.rs
@@ -0,0 +1,4 @@
+/* */
+/**/
+/* /* */ */
+/*
diff --git a/tests/data/lexer/00012_block_comment.txt b/tests/data/lexer/00012_block_comment.txt
new file mode 100644
index 00000000000..9958b25187d
--- /dev/null
+++ b/tests/data/lexer/00012_block_comment.txt
@@ -0,0 +1,7 @@
+COMMENT 5 "/* */"
+WHITESPACE 1 "\n"
+COMMENT 4 "/**/"
+WHITESPACE 1 "\n"
+COMMENT 11 "/* /* */ */"
+WHITESPACE 1 "\n"
+COMMENT 3 "/*\n"

From 5982e6d73b600e00d4eb72800e30c3c0700eb75b Mon Sep 17 00:00:00 2001
From: Christopher Durham <cad97@cad97.com>
Date: Sun, 28 Jan 2018 05:51:39 -0500
Subject: [PATCH 2/2] Update comments.rs

---
 src/lexer/comments.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lexer/comments.rs b/src/lexer/comments.rs
index d388561bff2..d1e95881765 100644
--- a/src/lexer/comments.rs
+++ b/src/lexer/comments.rs
@@ -14,7 +14,7 @@ pub(crate) fn scan_shebang(ptr: &mut Ptr) -> bool {
     }
 }
 
-pub(crate) fn scan_block_comment(ptr: &mut Ptr) -> Option<SyntaxKind> {
+fn scan_block_comment(ptr: &mut Ptr) -> Option<SyntaxKind> {
     if ptr.next_is('*') {
         ptr.bump();
         let mut depth: u32 = 1;