package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=d02c4f044e53edca010de46f9139ce00
sha512=99a5afa3604c4cf0c849c670111d617f7f255acb0da043b73ddffdf0e299948bce52516ee31921f269de6088156c4e0a187e0b931543c6819c6b25966b303281
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)