config 0.0.1

A library to parse and load configuration files
docs.rs failed to build config-0.0.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: config-0.14.0

config

Gitter Build Status

Beta compatibility

Beta compatibility is currently the top priority on this project.

Sadly, this doesn't compile on 1.0.0-beta because rust-peg uses features that are not available in the beta channel. I am looking into several options, including switching to nom.

In the meantime, just stick to rust nightly and you should be good.

Description

A Rust library to read and parse configuration files.

The idea is to make it very similar to libconfig, with a few extra additions / tweaks.

This is still under heavy development. As of this writing, the library is still very basic and can only read / load a configuration. It also includes a rudimentary set of methods to browse the loaded data.

Getting started

Updated documentation can be found here. The documentation includes small sample use cases, and a full specification of the input format.

Another good example can be found in the integration tests directory (tests/).

TODO

Features

  • Allow single and multi-line comments in configurations
  • Add #include support to include other configuration files
  • Automatically concatenate blank-separated string literals in the configuration. Useful for settings with big strings
  • Export a public API to manipulate a configuration in runtime and possibly write it to a file

Parser

  • Figure out why the parser returns an error on a blanks-only configuration
  • Consider splitting the parser into lexer + syntax analyser (much like we would in C with flex + byacc), OR
  • Use nom to generate the parser instead of rust-peg. Rust-peg uses features that will not be available in beta.

Misc

  • Refactor misc types (Setting, SettingsList, etc) into a separate, independent module
  • Write tests that are expected to fail
  • Add missing documentation for undocumented code
  • Document parser::ParseErr
  • Write misc documentation with a high level description of the module and its features
  • Write integration tests
  • Document when, why and how parse() returns Err
  • hex and hex64 literals support?
  • Add option to indicate the conf. file encoding
  • Enforce the rules for arrays. Arrays are homogeneous and can only hold scalar values

Contributing

Contributions will be greatly appreciated. I am currently in the process of rewriting the parser using nom, so I'd advice against any pull requests that change the parser or the grammar until the new parser is fully written, tested and in use.

I am relatively new to Rust, and as such, there is probably a lot of room for improvement on the library design and code quality. I started this project to learn the language. So, feel free to fix anything that you think may be wrong.