in reply to Need a regex to match C-style function arg list

thanks for the reply monks. to explain you the scenario little bit more, i m making an application which converts a program written in an earlier version of test language to the new version of the language. so one of the few changes in the language is the function 'concat' which has been changed to '&'. so concat("this", "is good") will be changed to ("this" & "is good") and i m facing the exact problem mentioned by u monks. its hard to know the exact pattern. lets say that concat can take following patterns for example : concat(int2str(count,1),result) or concat(bit2str(count,'10'B),result) or concat(int2str(count,1),bit2str(count,'10'B)) do you think it is possible to find a way to solve my problem ?
  • Comment on Re: Need a regex to match C-style function arg list

Replies are listed 'Best First'.
•Re: Re: Need a regex to match C-style function arg list
by merlyn (Sage) on Apr 11, 2003 at 21:23 UTC
    Sounds like a great job for Parse::RecDescent, except that you'll still need to give us access to the spec for "an earlier version of the test language". We specifically would need to know string-quoting-thingies that can hide a comma (like Perl's "" or '' or q()) and the nesting-thingies that can hide a comma recursively (like your concat function).

    Until you provide that spec, any response here is pure speculation.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.