This PR adds a -multi option to combine with -f so that patterns are taken from a file, one per line.
It also changes sgrep so that the AST is built once and multiple patterns run against the AST instead of rebuilding a file's AST for each pattern.
One limitation is that patterns must be confined to a single line. Proposing a format to enable sgrep (e.g. JSON) to load multiple patterns of arbitrary length would be a separate PR.
This PR adds a -multi option to combine with -f so that patterns are taken from a file, one per line.
It also changes sgrep so that the AST is built once and multiple patterns run against the AST instead of rebuilding a file's AST for each pattern.
One limitation is that patterns must be confined to a single line. Proposing a format to enable sgrep (e.g. JSON) to load multiple patterns of arbitrary length would be a separate PR.
Thanks, Mike