pauljt/scanjs — pull request #6 by pauljt (2014-04-23 10:43:07+00:00)
Title: Add rule parser, so rules can be written in Javascript 

So in pondering how we make more readable rules, I realized that if we can write rules in Javascript use a JS parser (e.g. acorn) to parse rules.
This is a work in progress, but currently this PR makes the following changes:
- rules are now specified by a single javascript statement (rule.source)
- rule.source is parsed in an AST
- we test the AST to decide which rule template suits

This is _awesome_ since it allows a bunch of cool features:
- template tests are now much easier to read:
```
member: {
nodeType: "MemberExpression",
test: function (rule, node) {
var testNode=rule.statement.expression;
if (node.property.name == testNode.property.name) {
aw_found(rule, node);
}
}
},
```
- using JS source to specify rules allows for richer rule types. This allows more complex rules, like the callwithargs template, which checks the the literal arguments to a function, and only matches if the function name matches AND all the literal arguments match (respecting order)

I'm just refactoring the new rules to use this format, then this will be ready to go.