weggli-rs / weggli

weggli is a fast and robust semantic search tool for C and C++ codebases. It is designed to help security researchers identify interesting functionality in large codebases.
Apache License 2.0
2.34k stars 130 forks source link

Grammar source #24

Closed arlencox closed 2 years ago

arlencox commented 2 years ago

In implementation details it says that

Search queries are first parsed using an extended version of the corresponding grammar

However, third_party/grammars/{c,cpp}/* only contains the tree-sitter-generated C and C++ code. Can the modified tree-sitter js grammar file be added to the repository?

felixwilhelm commented 2 years ago

Hi Arlen,

sorry for the delay. I've added the modified grammar.js file in 5508187. It's a single line change to add support for '$' in identifiers.

calixteman commented 2 years ago

You could do something similar to: https://github.com/mozilla/rust-code-analysis/blob/master/tree-sitter-mozcpp/grammar.js#L1 and then add your own stuff.

felixwilhelm commented 2 years ago

Thanks @calixteman. That looks like a much nicer approach! :)