beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 140 forks source link

Search in ocamllex/ocamlyacc/menhir source files #511

Closed Leonidas-from-XIV closed 7 years ago

Leonidas-from-XIV commented 9 years ago

These are not exactly valid OCaml code but usually contain a lot of OCaml code and people using OCaml will probably want these files also searched.

hoelzro commented 9 years ago

:+1: from me. @petdance?

Leonidas-from-XIV commented 9 years ago

This change has been merged into Ag, too: https://github.com/ggreer/the_silver_searcher/pull/533.

petdance commented 9 years ago

@Leonidas-from-XIV posted to the ack-users list:

.mll is an OCaml file extended with lexer token definitions for the ocamllex tool that comes with OCaml itself.

.mly is an OCaml file extended with grammar definitions for the ocamlyacc tool that comes with OCaml and menhir, an alternative to ocamlyacc.

petdance commented 9 years ago

Also from @Leonidas-from-XIV :

It is similar to the C tools lex/flex (ocamllex) and yacc/bison (ocamlyacc): OCaml code which contains valid OCaml plus some additional constructs. These files are meant to be processed by the preprocessors and produce (huge, generated but) valid OCaml files which contain lexers and parsers.

More information about these tools can be found in the official OCaml documentation, http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual026.html

n1vux commented 9 years ago

Ok, this extends an existing --type, to be more useful to that community, this is plausibly low impact.

I do wonder though if lexer/parser files are things that only core devs want to search and that most OCaml/Clojure users would want to ignore as "internals" ? Since they produce huge OCaml, maybe it's good to search them too since it's more concise ?

Leonidas-from-XIV commented 9 years ago

I believe that, considering that writing compilers/static verifiers (aka tools that need to parse formal languages) is rather popular (Hack, Flow, Pfft all 3 by Facebook, Haxe, CompCert, initial versions of the Rust compiler are all implemented in OCaml), this could be useful for others. Not every OCaml user will use these files, but I do not see much of a downside of treating those as OCaml.

petdance commented 7 years ago

Thanks. e1ddf4e