src/iniplus/reader

Search:
Group by:
Source   Edit  

This module contains the parser for the extended INI configuration format. It provides only two procedures, parseFile which takes a string as a filename.

Example: cmd: --run:off

import src/iniplus/reader
discard parseFile("app.ini")
and parseString which expects configuration data in its string input.

Example:

import src/iniplus/reader
discard parseString("key=\"value\"")

Procs

proc parseFile(filename: string): ConfigTable {....raises: [ValueError, IOError],
    tags: [ReadIOEffect], forbids: [].}
Opens a file, reads the entirety of it and returns a configuration table.

Example: cmd: --run:off

let config = parseFile("app.ini")
Source   Edit  
proc parseString(input: string): ConfigTable {....raises: [ValueError], tags: [],
    forbids: [].}
This procedure takes a string of some kind as its input and returns a parsed ConfigTable object.

Example:

import iniplus
let config = parseString("my_favorite_key=\"My Favorite Value\"\n")
assert config.getString("","my_favorite_key") == "My Favorite Value"
Source   Edit