I think its easier to use CFG or parser combinators to solve this, tw’s parser tree is an example of parser conbinator.
Maybe you can use $tw.wiki.parseText() to parse the widget, and get these params from result.tree[0].orderedAttributes
see
and
for API
You will first need to wrap these params into an widget syntax like <$xxx xxx=xxx />