docgen understands and ignores *when false*

This commit is contained in:
Araq 2010-11-18 22:26:20 +01:00
commit adf13aaea3
18 changed files with 1194 additions and 79 deletions

30
lib/pure/cookies.nim Normal file
View file

@ -0,0 +1,30 @@
#
#
# Nimrod's Runtime Library
# (c) Copyright 2010 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
## This module implements helper procs for parsing Cookies.
import strtabs
proc parseCookies*(s: string): PStringTable =
## parses cookies into a string table.
result = newStringTable(modeCaseInsensitive)
var i = 0
while true:
while s[i] == ' ' or s[i] == '\t': inc(i)
var keystart = i
while s[i] != '=' and s[i] != '\0': inc(i)
var keyend = i-1
if s[i] == '\0': break
inc(i) # skip '='
var valstart = i
while s[i] != ';' and s[i] != '\0': inc(i)
result[copy(s, keystart, keyend)] = copy(s, valstart, i-1)
if s[i] == '\0': break
inc(i) # skip ';'