aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/annotations/AnnotationUtils.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/firrtl/annotations/AnnotationUtils.scala')
-rw-r--r--src/main/scala/firrtl/annotations/AnnotationUtils.scala18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/main/scala/firrtl/annotations/AnnotationUtils.scala b/src/main/scala/firrtl/annotations/AnnotationUtils.scala
index ba9220f7..517cea26 100644
--- a/src/main/scala/firrtl/annotations/AnnotationUtils.scala
+++ b/src/main/scala/firrtl/annotations/AnnotationUtils.scala
@@ -64,29 +64,13 @@ object AnnotationUtils {
case Array(c, m, x) => ComponentName(x, ModuleName(m, CircuitName(c)))
}
- /** Converts a serialized FIRRTL component into a sequence of target tokens
- * @param s
- * @return
- */
- def toSubComponents(s: String): Seq[TargetToken] = {
- import TargetToken._
- def exp2subcomp(e: ir.Expression): Seq[TargetToken] = e match {
- case ir.Reference(name, _) => Seq(Ref(name))
- case ir.SubField(expr, name, _) => exp2subcomp(expr) :+ Field(name)
- case ir.SubIndex(expr, idx, _) => exp2subcomp(expr) :+ Index(idx)
- case ir.SubAccess(expr, idx, _) => Utils.throwInternalError(s"For string $s, cannot convert a subaccess $e into a Target")
- }
- exp2subcomp(toExp(s))
- }
-
-
/** Given a serialized component/subcomponent reference, subindex, subaccess,
* or subfield, return the corresponding IR expression.
* E.g. "foo.bar" becomes SubField(Reference("foo", UnknownType), "bar", UnknownType)
*/
def toExp(s: String): Expression = {
def parse(tokens: Seq[String]): Expression = {
- val DecPattern = """(\d+)""".r
+ val DecPattern = """([1-9]\d*)""".r
def findClose(tokens: Seq[String], index: Int, nOpen: Int): Seq[String] = {
if(index >= tokens.size) {
Utils.error("Cannot find closing bracket ]")