Crate frostwalker

Source
Expand description

A TOML-like configuration language parser that supports single depth arrays, integers, strings and boolean literals.

This library isn’t intended to compete with toml. Frostwalker and toml have differing goals and I would recommend you use toml over Frostwalker as it supports more features, but Frostwalker has no dependencies apart from the standard library.

The use of this library is easy and doesn’t require much work:

use frostwalker::parse;

let parsed_output = parse("yes = true\r\nkey = \"value\"\r\narray = [ 1, 5 ]");
let hashmap = parsed_output.unwrap();
assert_eq!(hashmap.get("yes").unwrap(), "true");

assert_eq!(hashmap.get("key").unwrap(), "value");

assert_eq!(hashmap.get("array").unwrap(), "2");
assert_eq!(hashmap.get("array[0]").unwrap(), "1");
assert_eq!(hashmap.get("array[1]").unwrap(), "5");

Modules§

formatter
Module containing the formatter which turns the tokens into a HashMap.
lexer
Module containing the lexer which turns the source into a Token list.
validator
Module containing the validator which makes sure that a Token list is correct.

Structs§

Token
A structure for a lexical token.

Enums§

Class
An enumerator for types of lexical tokens.

Functions§

parse
The parsing function. This function takes in a string with configuration in it and either outputs a HashMap containing keys and values or an error message.