implement basic comments
This commit is contained in:
parent
179123a3b2
commit
588324659b
2 changed files with 12 additions and 1 deletions
11
initial.d
11
initial.d
|
@ -298,6 +298,8 @@ locate(size_t l, size_t c)
|
|||
+
|
||||
+ The following rules apply when parsing:
|
||||
+ $(UL
|
||||
+ $(LI if a hash character `#` is found at the beginning of a line,
|
||||
+ the rest of the line is ignored)
|
||||
+ $(LI if a left square bracket character `[` is found at
|
||||
+ the beginning of a line, the line is considered a
|
||||
+ section heading)
|
||||
|
@ -340,6 +342,7 @@ readINI(ref INIUnit ini, string data)
|
|||
|
||||
section = ini.defaultSection;
|
||||
|
||||
nextline:
|
||||
foreach (size_t ln, string line; data.splitLines()) {
|
||||
line = line.strip();
|
||||
if (line.length == 0)
|
||||
|
@ -349,6 +352,14 @@ readINI(ref INIUnit ini, string data)
|
|||
text = key = value = "";
|
||||
foreach (size_t cn, char ch; line) {
|
||||
switch (ch) {
|
||||
/* comment? */
|
||||
case '#':
|
||||
if (cn == 0)
|
||||
continue nextline;
|
||||
|
||||
text ~= ch;
|
||||
break;
|
||||
|
||||
/* beginning of a section heading? */
|
||||
case '[':
|
||||
if (cn == 0) /* beginning of line? */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue