aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/scala/firrtl/Translator.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/scala/firrtl/Translator.scala b/src/main/scala/firrtl/Translator.scala
index eba78b39..a16d89d7 100644
--- a/src/main/scala/firrtl/Translator.scala
+++ b/src/main/scala/firrtl/Translator.scala
@@ -21,6 +21,7 @@ object Translator
def addBrackets(inputIt: Iterator[String]): StringBuilder = {
def countSpaces(s: String): Int = s.prefixLength(_ == ' ')
+ def stripComments(s: String): String = s takeWhile (!";".contains(_))
val Scopers = """\s*(circuit|module|when|else)(.*)""".r
@@ -45,7 +46,8 @@ object Translator
var newScope = true // indicates if increasing scope spacing is legal on next line
while( it.hasNext ) {
- it.next match { case (text, lineNum) =>
+ it.next match { case (lineText, lineNum) =>
+ val text = stripComments(lineText)
val spaces = countSpaces(text)
val l = if (text.length > spaces ) { // Check that line has text in it