Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 50 lines (39 sloc) 2.191 kb
c948728 @sfrancisx Initial commit.
sfrancisx authored
1 Version 1.0.1
2
3 jsgrep: Easily search JavaScript code
4
5 Synopsis
6 --------
7 jsgrep [OPTION | FILE | CONFIG]... PATTERN [OPTION | FILE | CONFIG]...
8
9 Description
10 -----------
11 jsgrep is not just grep written in JavaScript. It's grep designed to work on
12 JavaScript source. Instead of matching text, the regular expression matches
13 tokens. This is a subtle but surprisingly powerful difference. jsgrep is
14 insensitive to whitespace and it won't find stuff in comments or strings,
15 and it won't find parts of a name when you want to find the whole name.
16
17 jsgrep also knows a _tiny_ bit about the structure of JavaScript programs:
18 it can match the }, ) or ] that closes a specific {, ( or [.
19
20 jsgrep tries to be convenient to use. Options and filenames can go at the
21 beginning of the command line, or at the end of the command line, or both.
22 It's recursive by default, and it will only search .js files. It allows you to
23 define macros for commonly used PATTERNs and search sets for commonly used
24 FILEs. I have defined macros to find function declarations, to find which
25 modules use a specified module, to find which module defines a function, to
26 find references to a variable inside a function, and others.
27
28 Execute jsgrep with no options for help.
29
30 Disclaimer
31 ----------
32 The source for jsgrep is embarrassing. I had to squeeze all the development
33 into 10 minute chunks while my wife was getting dressed, before my daughter
34 woke up, during smoke tests, etc. I can't handle that kind of context
35 switching, and the code shows it. I've delayed open sourcing it for two
36 years in the vain hope that I would have the time (and the inclination) to
37 clean it up.
38
39 jsgrep is nominally written in Java. I say 'nominally', because it's really
40 written in a generic C-like language. I don't know Java well. Any problems
41 I ran into were simply obstacles to be overcome, not learning opportunities,
42 because of the time problem I had. I use Hashtables and ArrayLists extensively
43 because I didn't want to take the time to figure out more appropriate
44 collection classes, a lot of methods are declared with "throws Throwable"
45 because that was an easy way to please the compiler, etc.
46
47 -Steve Francis
48 sfrancisx@yahoo.com
49
Something went wrong with that request. Please try again.