grep for PHP functions, while excluding class methods and pasted-in javascript

Go To StackoverFlow.com

1

I'm grep'ping through WP core, attempting to write a grep statement that will find all PHP functions, while excluding any class methods or Javascript functions.

This is what I have now:

grep -r --include=*.php 'function [A-Za-z_]\+(.\+)' .

This is returning both polluted functions from class methods and JS functions.

2012-04-03 23:24
by Eric Andrew Lewis
Parsing the source using the PHP tokenizer is probably the more robust method.. - deceze 2012-04-04 00:30
@deceze thanks, I went with that solution, makes a lot more sense - Eric Andrew Lewis 2012-04-05 16:11


0

You might probably want to try http://phpxref.sourceforge.net/ I passed the entire WordPress code into PHPXref a couple of years back and was able to get the complete list of functions, classes etc.

2012-04-11 05:30
by Sudar
Ads