Changeset 97

Show
Ignore:
Timestamp:
02/05/07 23:09:22 (2 years ago)
Author:
KirkMcDonald
Message:

configparse doc update

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • misc/configparse.d

    r96 r97  
    2121*/ 
    2222/++ 
    23 Config file parsing, in the style of Python's ConfigParser. 
    24  
    25 XXX: Add description of config file format. 
     23Configuration file parsing, in the style of Python's ConfigParser. 
     24 
     25Config files are divided into sections, which contain options. Section headers 
     26are in the form "[section name]". Options may be in either the form "key=value" 
     27or "key: value". A given line may only contain a single option or section 
     28header. Whitespace is stripped from the beginnings and ends of keys and values. 
     29 
     30Options existing before any section headers are said to be in the global 
     31section. This is treated as a section named "General". It is entirely possible 
     32to use config files only containing options that are in the global section, and 
     33to write code which doesn't even seem to know about the ability to divide 
     34options into sections. 
     35 
     36Lines beginning with '#' or ';' are treated as comments and ignored. 
    2637+/ 
    2738module configparse; 
     
    3344import std.path : getBaseName, getDirName, join, pathsep; 
    3445import std.c.stdlib : getenv; 
    35  
    36 import std.stdio : writefln; 
    3746 
    3847/// Thrown when configparse is unable to parse a file. 
     
    313322            return toReal(o); 
    314323        } catch(ConvError e) { 
    315             throw new ConfigConvertError("Could not convert '"~o~"' to a real."); 
     324            throw new ConfigConvertError("Could not convert '"~o~"' to a real in option "~section~"."~option~"."); 
    316325        } 
    317326    } 
     
    333342                return false; 
    334343            default: 
    335                 throw new ConfigConvertError("Could not convert '"~o~"' to a boolean."); 
     344                throw new ConfigConvertError("Could not convert '"~o~"' to a boolean in option "~section~"."~option~"."); 
    336345        } 
    337346    } 
  • misc/configparse.html

    r96 r97  
    55    <h1>configparse</h1> 
    66    <!-- Generated by Ddoc from configparse.d --> 
    7 Config file parsing, in the style of Python's ConfigParser. 
    8 <br><br> 
    9 <b>XXX:</b><br> 
    10 Add description of config file format. 
     7Configuration file parsing, in the style of Python's ConfigParser. 
     8<br><br> 
     9Config files are divided into sections, which contain options. Section headers 
     10are in the form "[section name]". Options may be in either the form "key=value" 
     11or "key: value". A given line may only contain a single option or section 
     12header. Whitespace is stripped from the beginnings and ends of keys and values. 
     13<br><br> 
     14 
     15Options existing before any section headers are said to be in the global 
     16section. This is treated as a section named "General". It is entirely possible 
     17to use config files only containing options that are in the global section, and 
     18to write code which doesn't even seem to know about the ability to divide 
     19options into sections. 
     20<br><br> 
     21 
     22Lines beginning with '#' or ';' are treated as comments and ignored. 
    1123<br><br> 
    1224