#linux-kernel #config-parser #kconfig #ast #byte #lexer #stream

kconfig-parser

Kconfig parser for the Kconfig file format from the Linux Kernel for the Cargo Kconfig crate

7 releases

0.1.1 Nov 18, 2022
0.1.0 Nov 16, 2022
0.0.5 Nov 7, 2022
0.0.3 Aug 9, 2022
0.0.1 May 10, 2022

#1726 in Development tools


Used in 2 crates

MIT OR GPL-2.0-or-later OR Apache-2.0

240KB
4.5K SLoC

Kconfig parser - for Cargo Kconfig

This is the parser for Kconfig menu items, as used by the Linux Kernel and other projects. It is primarly created to be used by the Cargo Kconfig package, which is still under heavy development, but you are free to use it for your purposes if you like. If you want an easier interface, then don´t use this package, but use Kconfig-represent instead, which uses this parser, but implements the logic for reading and writing .config files, evaluating the definitions, etc. This package merely produces an AST from Kconfig.

When using the package, note that there are three lexers, which are stapled on top of one another, in the following order:

  • The base lexer is used for reading a stream of bytes (this would typically be a file, but another stream is feasible to implement)
  • The source lexer is used to read subsequent streams of bytes defined by the source keyword in a Kconfig file
  • The macro lexer is used for interpreting macros and generating a symbol table for assigned values

No runtime deps