Asumiendo que su código está formateado algo así como
type name function_name(variables **here, variables &here)
{
code
}
Aquí hay una sola línea de Powershell:
ls *.c, *.h | sls "^(\w+()?){2,}\([^[email protected]#$+%^]+?\)"
que devuelve resultados como:
...
common.h:37:float max(float a, float b)
common.h:42:float fclamp(float val, float fmin, float fmax)
common.h:51:float lerp(float a, float b, float b_interp)
common.h:60:float scale(float val, float valmin, float valmax, float min,
float max)
complex.h:3:typedef struct complex {
complex.h:8:double complexabs(complex in)
complex.h:13:void complexmult(complex *out, complex a, complex b)
complex.h:20:void complexadd(complex *out, complex a, complex b)
complex.h:27:int mandlebrot(complex c, int i)
...
Ver solo la línea sin los detalles específicos de archivos, añadir format-table -property line
(o abreviado como ft -p line
):
ls *.c, *.h | sls "^(\w+()?){2,}\([^[email protected]#$+%^]+?\)" | format-table -p line
que devuelve:
Line
----
void render(SDL_Surface *screen)
void saveframe(SDL_Surface *screen)
int handleevents(SDL_Surface *screen)
int WinMain(/*int argc, char* args[]*/)
void printscreen(SDL_Surface *screen, unsigned int exclude)
void testsection(char name[])
void sdltests(SDL_Surface *screen, SDL_Window *window, int width, int height)
int WinMain(/*int argc, char *argv[]*/)
int random(int min, int max) {
int main(int argc, char *argv[])
PRIMA: Explicación de la expresión regular:
^(\w+(\s+)?){2,}\([^[email protected]#$+%^]+?\)
^ Start of a line
( ){2,} Create atom to appear to or more times
(as many as possible)
\w+(\s+)? A group of word characters followed by
an optional space
\( \) Literal parenthesis containing
[^[email protected]#$+%^]+? A group of 0 or more characters
that AREN'T in “[email protected]#$+%^”
No puedo repetirlo lo suficiente. Las expresiones regulares no son un sustituto de un analizador. +1. – dmckee