diff options
| author | Jack | 2015-10-12 16:16:15 -0700 |
|---|---|---|
| committer | Jack | 2015-10-12 16:16:15 -0700 |
| commit | d1295b29d89e07645c3a4e08f2f923455a868482 (patch) | |
| tree | 5dedd4b69ac2b0073b766596e7fadf314b1219da | |
| parent | ac63917f4d6d22170db690542b55d636fbda608d (diff) | |
Added FIRRTL comment removal to Translator
| -rw-r--r-- | src/main/scala/firrtl/Translator.scala | 4 |
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 |
