package batteries
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=b691e5870f876c6e590d6aa51b4c5457
sha512=3b0643ff337cd70da8c4b77887d212e82d043a7163fca36588be12186bc86bbcf0d56b13349325f12eabb96c846204c88560786342f50af7bf4e20b9480d3964
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)