Skip to content

Commit

Permalink
support expressions like [1, *[2, 3], 4]
Browse files Browse the repository at this point in the history
  • Loading branch information
dours committed Oct 12, 2022
1 parent e22905b commit 165f066
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.polystat.py2eo.transpiler

import org.polystat.py2eo.parser.Expression.{CollectionCons, Star, T}

object StarInCollectionConstructor {
def apply(e : T) : T = e match {
case CollectionCons(kind, l, ann) =>
val l1 = l.flatMap({
case Star(CollectionCons(kind1, l, _), _) => l
case x => List(x)
})
CollectionCons(kind, l1, ann)
case x => x
}
}

0 comments on commit 165f066

Please sign in to comment.