Adding scala_parser to zparse

Can parse scales as options, for example:
zparse("0..8", scale="17/16 19/16")
This commit is contained in:
2023-03-15 23:08:12 +02:00
parent 8929940328
commit 48426fdb0e

View File

@ -63,6 +63,12 @@ def zparse(expr: str, **opts) -> Ziffers:
Returns:
Ziffers: Returns Ziffers iterable parsed with the given options
"""
if "scale" in opts:
scale = opts["scale"]
if isinstance(scale,str) and not scale.isalpha():
parsed_scale = parse_scala(scale)
opts["scale"] = parsed_scale
parsed = parse_expression(expr)
parsed.init_opts(opts)
return parsed