Ctags: Support for the Nix expression language (Nix / NixOS)

Created on 7 Mar 2015  ·  4Comments  ·  Source: universal-ctags/ctags

Description: https://nixos.org/nix/manual/#ch-expression-language

There is some very basic config in https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/misc/ctags/wrapped.nix:

--langdef=NIX
--langmap=NIX:.nix
--regex-NIX=/([^ \t*]*)[ \t]*=/\1/f/

I have (hopefully) improved this a bit locally:

--regex-NIX=/([^ \t*]*)[ \t]*=.*:/\1/f/

But it's still too basic and would need a separate parser probably.

I am new to Nix/NixOS myself, and have therefore not much knowledge
about this language myself.

Parser buenhancement

Most helpful comment

Hi, what's the status of this issue?

All 4 comments

Nix itself parses the language - it uses standard parsing and lexing tools https://github.com/NixOS/nix/tree/master/src/libexpr (probably most useful in context of this issue). Then I know about some stuff in haskell https://github.com/peti/language-nix, and there are syntax highlighters for various editors (or highlighting libraries).

As an initial version, a regular expression based implementation is o.k; it is always better than nothing.
Though I have to rethink the directory structures, optlib is the first class way to implement an parser.
You can write a C based parser later. The important point is the "kinds" compatibility between regex
based parser and C based parser. If the compatibility of kinds are kept, no one takes care the way of implementation.

However, if nix implementation has real parser, why don't you utilize it? My xmcd is for you.
See data/optlib/cofee.ctags and libexec/drivers/coffeetags.

Hi, what's the status of this issue?

A pull request is welcome.

Was this page helpful?
0 / 5 - 0 ratings