package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=1fd7bddce07cf5d244fc9427f7b5e4d4
sha512=c0f2a0fdc8253e0ea999d8d4c58bfbf32b18d251a2e1d9656bf279de5f01a33e9aabac3af4d95f465f8b671e7711ebd37218043face233340a0c11b08fa62f78
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)