package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ea26b5c72e6731e59d856626049cca4d
sha512=55975b62c26f6db77433a3ac31f97af609fc6789bb62ac38b267249c78fd44ff37fe81901f1cf560857b9493a6046dd37b0d1c0234c66bd59e52843aac3ce6cb
doc/batteries.unthreaded/BatCharParser/index.html
Module BatCharParser
Source
Parsing character strings.
This module defines common functions for parsing character strings, encoded in Latin-1. These functions are meant to be used in conjunction with the ParserCo
module.
Note As ParserCo, this module is still very rough and needs testing.
The position inside one file or one stream.
Advance by one char.
advance c p
returns a new position advanced by one char. If c
is '\r' or '\n', the result is {offset = 0; line = p.line + 1}
. Other wise, the result is {offset = p.offset + 1; line = p.line}
.
Create a source from a latin-1 character string.
Create a source from a latin-1 character.
val parse :
(char, 'a, position) BatParserCo.t ->
string ->
('a, position BatParserCo.report) BatPervasives.result
Apply a parser to a string.
Utilities
Recognize exactly one char
Accept any value not in a list As ParserCo.none_of
, just with improved error message.
Accept any value not a given char As none_of
.
Recognize exactly one string
As char
, but case-insensitive
As case_string
, but case-insensitive
Recognizes a newline
Recognizes white-space
Recognizes one upper-case ASCII character, including accentuated characters.
Recognizes one lower-case ASCII character, including accentuated characters.
Recognizes one lower- or upper-case ASCII character, including accentuated characters.
Recognizes one upper-case Latin-1 character, including accentuated characters.
Recognizes one lower-case Latin-1 character, including accentuated characters.
Recognizes one lower- or upper-case Latin1 character, including accentuated characters.
Recognizes one decimal digit
Recognizes one hexadecimal digit (case-insensitive)