To reproduce:
from pyfoma import FST
def test(*fsts, **flags):
print(len(fsts))
print(flags)
return fsts[0]
# As expected, parses `cat=meow, dog=woof` as named arguments
FST.re("$^test(abc, cat=meow, dog=woof)", functions={test})
# 1
# {'cat': 'meow', 'dog': 'woof'}
# `cat=meow` is parsed as a positional argument:
FST.re("$^test(abc,\ncat=meow, dog=woof)", functions={test})
# 2
# {'dog': 'woof'}
# Now both `cat=meow` and `dog=woof` are parsed as positional args:
FST.re("$^test(abc,\ncat=meow,\ndog=woof)", functions={test})
# 3
# {}
# This can even cause positional arguments to be parsed after named arguments:
FST.re("$^test(abc, cat=meow,\ndog=woof)", functions={test})
# 2
# {'cat': 'meow'}
In my case, I need to break a long rule consisting of a function call with a lot of arguments over multiple lines. It’s possible to move the comma that was before the intended named arguments to be on the same line as them, but this means that you can no longer have a comma after the last positional argument. That is, something that I would prefer to write as
$^rwplus(
(þ:t) ('-'?:'-') / ':' '-'? _ $MNh (þ|t·),
(':' cþ):(c ':' '-' t) ('-'?:'-') / $Nu '-'? _ $MNh (þ|t·),
dir = backward, rightmost = True
)
instead has to be written as
$^rwplus(
(þ:t) ('-'?:'-') / ':' '-'? _ $MNh (þ|t·),
(':' cþ):(c ':' '-' t) ('-'?:'-') / $Nu '-'? _ $MNh (þ|t·)
, dir = backward, rightmost = True
)
To reproduce:
In my case, I need to break a long rule consisting of a function call with a lot of arguments over multiple lines. It’s possible to move the comma that was before the intended named arguments to be on the same line as them, but this means that you can no longer have a comma after the last positional argument. That is, something that I would prefer to write as
instead has to be written as