package batteries
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=b7f3b99f12f21b1da6b6aa13d993206d
sha512=8b7f2479eb0271bcfd9168887c1e4a9a815c512eab3ee61b150fc4dfa9ec803e4f73115155f20b3017e4a822148d0e6d1c1e8e5f96790fd691b419dd39a908a2
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)