サブルーチンを使用a, f_1(b, c, f_2(d, e))
して、行を Lisp スタイルの関数呼び出しで
行に変換しようとしています。a (f_1 b c (f_2 d e))
Text::Balanced
関数呼び出しの形式 f(arglist)
は です。arglist には、階層呼び出しを使用して 1 つまたは複数の関数呼び出しを含めることができます。
私が試した方法 -
my $text = q|a, f_1(a, b, f_2(c, d))|;
my ($match, $remainder) = extract_bracketed($text); # defaults to '()'
# $match is not containing the text i want which is : a, b, f_2(c,d) because "(" is preceded by a string;
my ($d_match, $d_remainder) = extract_delimited($remainder,",");
# $d_match doesnt contain the the first string
# planning to use remainder texts from the bracketed and delimited operations in a loop to translate.
/^[\w_0-9]+\(/
開始タグが asで終了タグが asのサブ extract_tagged も試してみました/\)/
が、そこでも機能しません。
Parse::RecDescent
短時間で理解して使いこなすのは難しい。