Fork me on GitHub
#tree-sitter
<
2020-03-24
>
sogaiu09:03:29

@pez i ran some experiments today with the grammar and tree-sitter's query api to get a sense of the speed and accuracy of identifying defn forms. across > 120,000 files (.clj, .cljc, .cljs) i found that if you just ask for the top-level defn forms (basically lists where the first symbol is defn), only in about 3% of the cases do you miss some defns (e.g. in a let, do, or reader conditional -- there were over 4000 results with discrepancies and i haven't looked through that many of them). cljc files were the worst at 16% failure -- so i guess probably trying to account for reader conditionals is likely to help there.