Module Future.UChar_parser


module Future.UChar_parser: Extlib.UCharParser
Parsing unicode text

This module defines common functions for parsing Unicode texts. These functions are meant to be used in conjunction with the Future.Parser_co module.

Note As ParserCo, this module is still very rough and needs testing.
Author(s): David Teller


type position = Future.Char_parser.position = {
   offset : int; (*Offset on the line (starting at 0)*)
   line : int; (*Line number (starting at 0)*)
}
The position inside one file or one stream.
val advance : UChar.t ->
position -> position
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}.

val source_of_rope : Rope.t ->
(UChar.t, position)
Future.Parser_co.Source.t
Create a source from a Unicode Rope.
val source_of_enum : UChar.t Enum.t ->
(UChar.t, position)
Future.Parser_co.Source.t
Create a source from an enumeration of unicode characters.
val parse : (UChar.t, 'a, position) Future.Parser_co.t ->
Rope.t ->
('a, position Future.Parser_co.report) Extlib.Std.result
Apply a parser to a Unicode Rope.

Utilities

val char : UChar.t ->
(UChar.t, UChar.t,
position)
Future.Parser_co.t
Recognize exactly one char
val none_of : UChar.t list ->
(UChar.t, UChar.t,
position)
Future.Parser_co.t
Accept any value not in a list As ParserCo.none_of, just with improved error message.
val not_char : UChar.t ->
(UChar.t, UChar.t,
position)
Future.Parser_co.t
Accept any value not a given char As none_of.
val string : string ->
(UChar.t, string, position)
Future.Parser_co.t
Recognize exactly one string
val rope : Rope.t ->
(UChar.t, Rope.t, position)
Future.Parser_co.t
Recognize exactly one string
val ustring : UTF8.t ->
(UChar.t, UTF8.t, position)
Future.Parser_co.t
Recognize exactly one string
val case_char : UChar.t ->
(UChar.t, UTF8.t, position)
Future.Parser_co.t
As char, but case-insensitive
val case_string : string ->
(UChar.t, string, position)
Future.Parser_co.t
As string, but case-insensitive
val case_ustring : UTF8.t ->
(UChar.t, UTF8.t, position)
Future.Parser_co.t
As ustring, but case-insensitive
val case_rope : Rope.t ->
(UChar.t, Rope.t, position)
Future.Parser_co.t
As rope, but case-insensitive
val newline : (UChar.t, UChar.t,
position)
Future.Parser_co.t
Recognizes a newline
val whitespace : (UChar.t, UChar.t,
position)
Future.Parser_co.t
Recognizes white-space
val uppercase : (UChar.t, UChar.t,
position)
Future.Parser_co.t
Recognizes one upper-case ASCII character, including accentuated characters.
val lowercase : (UChar.t, UChar.t,
position)
Future.Parser_co.t
Recognizes one lower-case character, including accentuated characters.
val letter : (UChar.t, UChar.t,
position)
Future.Parser_co.t
Recognizes one lower- or upper-case character.
val digit : (UChar.t, UChar.t,
position)
Future.Parser_co.t
Recognizes one decimal digit
val hex : (UChar.t, UChar.t,
position)
Future.Parser_co.t
Recognizes one hexadecimal digit (case-insensitive)