package fmlib_parse

  1. Overview
  2. Docs

Source file ucharacter_intf.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
module type UNICODE_COMBINATORS =
sig
    type _ t

    val uchar: Uchar.t -> Uchar.t t
    (** [uchar uc] Parse the unicode character [uc]. *)



    val ucharp: (Uchar.t -> bool) -> string -> Uchar.t t
    (** [ucharp p error]

        Parse a unicode character which satisfies the predicate [p]. If the next
        character does not satisfy the predicate, then use the string [error]
        to express the failed expectation.
    *)


    val urange: Uchar.t -> Uchar.t -> Uchar.t t
    (** [urange uc1 uc2]

        Parse a unicode character whose scalar value is in the range between the
        scalar values of [uc1] and [uc2] including the boundaries.
    *)


    val uword: (Uchar.t -> bool) -> (Uchar.t -> bool) -> string -> string t
    (** [uword first inner error]

        Parse a sequence of unicode characters whose first character satisfies
        the predicate [first] and all subsequence characters satisfy the
        predicate [inner]. If no such word is encountered then use the string
        [error] to express the expectation.
    *)

end





module type UC =
sig
    type token
    type final
    type state
    type semantic

    (** {1 Final Parser} *)

    module Parser:
    sig
        include Character_intf.CHARACTER_PARSER
            with type token = token
             and type final = final
             and type state = state
             and type semantic = semantic
        (** @inline *)
    end


    (** {1 Generic Combinators} *)

    include Interfaces.COMBINATOR
        with type state    := state
         and type semantic := semantic
         and type expect   := string
    (** @inline *)



    (** {1 Location Combinators} *)

    include Character_intf.LOCATION_COMBINATORS
        with type 'a t := 'a t



    (** {1 Indentation Combinators} *)

    include Character_intf.INDENTATION_COMBINATORS
        with type 'a t := 'a t



    (** {1 End of Input} *)

    include Character_intf.END_OF_INPUT_COMBINATOR
        with type 'a t := 'a t



    (** {1 Lexer Support} *)

    include Character_intf.LEXER_COMBINATOR
        with type 'a t := 'a t



    (** {1 Character Combinators} *)

    include Character_intf.CHARACTER_COMBINATORS
        with type 'a t := 'a t



    (** {1 Unicode Combinators} *)

    include UNICODE_COMBINATORS
        with type 'a t := 'a t




    (** {1 Make the Final Parser} *)

    include Character_intf.MAKE_FINAL_COMBINATORS
        with type 'a t   := 'a t
         and type state  := state
         and type final  := final
         and type parser := Parser.t
end
OCaml

Innovation. Community. Security.