Document parser utils.

This commit is contained in:
Dominik Pantůček 2023-04-09 17:50:38 +02:00
parent 27dc75a7c1
commit 1aaf5e477a

View file

@ -66,6 +66,40 @@ most scheme implementations.
Returns a list containing only elements matching given ```pred?```
predicate.
### Parser
(import util-parser)
This module contains common functions for both configuration and
member file parsers. All functions are UTF-8 aware.
(parser-preprocess-line line)
* ```line``` - a string with contents of one source line
If the input ```line``` contains the ```#``` character, the rest of
the line (including this character) is removed.
Any leading and trailing space is removed.
Returns a string representing the preprocessed line.
(parser-parse-line line)
* ```line``` - preprocessed line (string)
If the ```line``` is empty, returns ```#f```.
If the line contains only one token consisting of non-whitespace
characters before the first whitespace character (there is no
whitespace), returns a symbol created by interning the whole
```line```.
When the ```line``` contains whitespace character(s), it returns a
pair consisting of symbol created by interning the string of
non-whitespace characters before the first whitespace character and
the string with the rest of the line.
### Set (List)
(import util-set-list)