diff --git a/xplace/x.py b/xplace/x.py index 8183a6b..c33a31e 100644 --- a/xplace/x.py +++ b/xplace/x.py @@ -17,7 +17,7 @@ parser = Lark(r''' | // numrange : DIGITS - | DIGITS "-" DIGITS + | DIGITS "-" DIGITS [ "*" DIGITS ] [ "+" DIGITS ] ?unit : parens | brackets | char ?concat_func : unit @@ -125,6 +125,12 @@ class Expand(Transformer): b = a else: b = int(args[1].value) + m = 1 + if len(args) >= 3: + m = int(args[2].value) + p = 0 + if len(args) >= 4: + p = int(args[3].value) while a < b: result.append(a) a += 1 @@ -132,7 +138,7 @@ class Expand(Transformer): result.append(a) a -= 1 result.append(a) - return result + return [ x * m + p for x in result ] def index(self, args): result, x = [], args[0]