Source file Literal_lexer.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# 12 "lib/Literal_lexer.mll"
 
open Caml

(* To buffer string literals *)

let string_buffer = Buffer.create 256
let reset_string_buffer () = Buffer.reset string_buffer
let get_stored_string () = Buffer.contents string_buffer

let store_string_char c = Buffer.add_char string_buffer c
let store_string s = Buffer.add_string string_buffer s

exception Parse_error


# 18 "lib/Literal_lexer.ml"
let __ocaml_lex_tables = {
  Lexing.lex_base =
   "\000\000\254\255\255\255\001\000\242\255\243\255\244\255\002\000\
    \251\255\006\000\255\255\245\255\001\000\079\000\000\000\016\000\
    \250\255\252\255\253\255\000\000\007\000\008\000\026\000\249\255\
    \036\000\057\000\248\255\102\000\247\255\140\000\166\000\246\255\
    \012\000\002\000\249\255\082\000\221\000\000\000\003\000\013\000\
    \255\255\254\255\255\000\051\000\195\000\004\000\253\255\231\000\
    \005\000\252\255\244\000\038\001\007\000\251\255\054\001\008\000\
    \250\255";
  Lexing.lex_backtrk =
   "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\013\000\
    \255\255\013\000\255\255\255\255\010\000\010\000\010\000\010\000\
    \255\255\255\255\255\255\001\000\010\000\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\006\000\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255";
  Lexing.lex_default =
   "\001\000\000\000\000\000\004\000\000\000\000\000\000\000\255\255\
    \000\000\011\000\000\000\000\000\255\255\255\255\255\255\255\255\
    \000\000\000\000\000\000\255\255\255\255\255\255\255\255\000\000\
    \255\255\255\255\000\000\255\255\000\000\255\255\255\255\000\000\
    \255\255\034\000\000\000\037\000\255\255\255\255\255\255\255\255\
    \000\000\000\000\255\255\255\255\255\255\255\255\000\000\255\255\
    \255\255\000\000\255\255\255\255\255\255\000\000\255\255\255\255\
    \000\000";
  Lexing.lex_trans =
   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\019\000\008\000\006\000\006\000\000\000\007\000\032\000\
    \019\000\019\000\019\000\020\000\021\000\021\000\006\000\038\000\
    \000\000\032\000\039\000\000\000\000\000\000\000\000\000\000\000\
    \019\000\000\000\002\000\010\000\000\000\000\000\017\000\041\000\
    \018\000\035\000\040\000\046\000\049\000\018\000\053\000\056\000\
    \024\000\024\000\024\000\024\000\000\000\000\000\015\000\015\000\
    \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\
    \022\000\022\000\022\000\022\000\022\000\022\000\022\000\022\000\
    \022\000\022\000\023\000\023\000\023\000\023\000\023\000\023\000\
    \023\000\023\000\023\000\023\000\025\000\025\000\025\000\025\000\
    \025\000\025\000\025\000\025\000\038\000\009\000\000\000\039\000\
    \000\000\000\000\018\000\050\000\050\000\050\000\050\000\000\000\
    \018\000\026\000\026\000\026\000\026\000\026\000\026\000\026\000\
    \026\000\000\000\000\000\000\000\016\000\014\000\000\000\000\000\
    \018\000\255\255\018\000\012\000\029\000\000\000\013\000\027\000\
    \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
    \027\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \027\000\027\000\027\000\027\000\027\000\027\000\028\000\028\000\
    \028\000\028\000\028\000\028\000\028\000\028\000\028\000\028\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\028\000\
    \028\000\028\000\028\000\028\000\028\000\000\000\036\000\000\000\
    \027\000\027\000\027\000\027\000\027\000\027\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\030\000\030\000\030\000\030\000\
    \030\000\030\000\030\000\030\000\030\000\030\000\000\000\028\000\
    \028\000\028\000\028\000\028\000\028\000\030\000\030\000\030\000\
    \030\000\030\000\030\000\000\000\000\000\000\000\030\000\030\000\
    \030\000\030\000\030\000\030\000\030\000\030\000\030\000\030\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\030\000\
    \030\000\030\000\030\000\030\000\030\000\030\000\030\000\030\000\
    \030\000\030\000\030\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\045\000\000\000\045\000\
    \255\255\005\000\255\255\000\000\045\000\000\000\255\255\030\000\
    \030\000\030\000\030\000\030\000\030\000\044\000\044\000\044\000\
    \044\000\044\000\044\000\044\000\044\000\044\000\044\000\048\000\
    \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\
    \048\000\000\000\000\000\031\000\051\000\051\000\051\000\051\000\
    \051\000\051\000\051\000\051\000\000\000\000\000\000\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \054\000\045\000\000\000\000\000\000\000\000\000\000\000\045\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\000\000\000\000\
    \000\000\000\000\000\000\045\000\043\000\000\000\000\000\045\000\
    \000\000\045\000\255\255\000\000\000\000\042\000\052\000\052\000\
    \052\000\052\000\052\000\052\000\052\000\052\000\000\000\000\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\055\000\055\000\
    \055\000\055\000\055\000\055\000\055\000\055\000\055\000\055\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\055\000\
    \055\000\055\000\055\000\055\000\055\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\055\000\
    \055\000\055\000\055\000\055\000\055\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000";
  Lexing.lex_check =
   "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\019\000\003\000\003\000\007\000\255\255\003\000\007\000\
    \009\000\020\000\021\000\009\000\020\000\021\000\032\000\039\000\
    \255\255\032\000\039\000\255\255\255\255\255\255\255\255\255\255\
    \019\000\255\255\000\000\003\000\255\255\255\255\009\000\037\000\
    \009\000\033\000\038\000\045\000\048\000\009\000\052\000\055\000\
    \014\000\014\000\014\000\014\000\255\255\255\255\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \015\000\015\000\015\000\015\000\015\000\015\000\015\000\015\000\
    \015\000\015\000\022\000\022\000\022\000\022\000\022\000\022\000\
    \022\000\022\000\022\000\022\000\024\000\024\000\024\000\024\000\
    \024\000\024\000\024\000\024\000\035\000\003\000\255\255\035\000\
    \255\255\255\255\009\000\043\000\043\000\043\000\043\000\255\255\
    \009\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
    \025\000\255\255\255\255\255\255\009\000\009\000\255\255\255\255\
    \009\000\035\000\009\000\009\000\012\000\255\255\009\000\013\000\
    \013\000\013\000\013\000\013\000\013\000\013\000\013\000\013\000\
    \013\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \013\000\013\000\013\000\013\000\013\000\013\000\027\000\027\000\
    \027\000\027\000\027\000\027\000\027\000\027\000\027\000\027\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\027\000\
    \027\000\027\000\027\000\027\000\027\000\255\255\035\000\255\255\
    \013\000\013\000\013\000\013\000\013\000\013\000\255\255\255\255\
    \255\255\255\255\255\255\255\255\029\000\029\000\029\000\029\000\
    \029\000\029\000\029\000\029\000\029\000\029\000\255\255\027\000\
    \027\000\027\000\027\000\027\000\027\000\029\000\029\000\029\000\
    \029\000\029\000\029\000\255\255\255\255\255\255\030\000\030\000\
    \030\000\030\000\030\000\030\000\030\000\030\000\030\000\030\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\030\000\
    \030\000\030\000\030\000\030\000\030\000\029\000\029\000\029\000\
    \029\000\029\000\029\000\044\000\044\000\044\000\044\000\044\000\
    \044\000\044\000\044\000\044\000\044\000\036\000\255\255\036\000\
    \000\000\003\000\033\000\255\255\036\000\255\255\009\000\030\000\
    \030\000\030\000\030\000\030\000\030\000\036\000\036\000\036\000\
    \036\000\036\000\036\000\036\000\036\000\036\000\036\000\047\000\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\255\255\255\255\030\000\050\000\050\000\050\000\050\000\
    \050\000\050\000\050\000\050\000\255\255\255\255\255\255\042\000\
    \042\000\042\000\042\000\042\000\042\000\042\000\042\000\042\000\
    \042\000\036\000\255\255\255\255\255\255\255\255\255\255\036\000\
    \042\000\042\000\042\000\042\000\042\000\042\000\255\255\255\255\
    \255\255\255\255\255\255\036\000\036\000\255\255\255\255\036\000\
    \255\255\036\000\035\000\255\255\255\255\036\000\051\000\051\000\
    \051\000\051\000\051\000\051\000\051\000\051\000\255\255\255\255\
    \042\000\042\000\042\000\042\000\042\000\042\000\054\000\054\000\
    \054\000\054\000\054\000\054\000\054\000\054\000\054\000\054\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\054\000\
    \054\000\054\000\054\000\054\000\054\000\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\054\000\
    \054\000\054\000\054\000\054\000\054\000\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255";
  Lexing.lex_base_code =
   "";
  Lexing.lex_backtrk_code =
   "";
  Lexing.lex_default_code =
   "";
  Lexing.lex_trans_code =
   "";
  Lexing.lex_check_code =
   "";
  Lexing.lex_code =
   "";
}

let rec string mode lexbuf =
   __ocaml_lex_string_rec mode lexbuf 0
and __ocaml_lex_string_rec mode lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 34 "lib/Literal_lexer.mll"
      ( reset_string_buffer ();
        string_aux mode lexbuf;
        get_stored_string () )
# 214 "lib/Literal_lexer.ml"

  | 1 ->
# 37 "lib/Literal_lexer.mll"
      ( raise Parse_error )
# 219 "lib/Literal_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
      __ocaml_lex_string_rec mode lexbuf __ocaml_lex_state

and string_aux mode lexbuf =
   __ocaml_lex_string_aux_rec mode lexbuf 3
and __ocaml_lex_string_aux_rec mode lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 42 "lib/Literal_lexer.mll"
      ( () )
# 231 "lib/Literal_lexer.ml"

  | 1 ->
# 44 "lib/Literal_lexer.mll"
      ( string_aux mode lexbuf )
# 236 "lib/Literal_lexer.ml"

  | 2 ->
# 46 "lib/Literal_lexer.mll"
      ( store_string (Lexing.lexeme lexbuf);
        string_aux mode lexbuf )
# 242 "lib/Literal_lexer.ml"

  | 3 ->
# 49 "lib/Literal_lexer.mll"
      ( begin match mode with
          | `Normalize -> store_string " "
          | `Preserve -> store_string "\\ " end;
        string_aux mode lexbuf )
# 250 "lib/Literal_lexer.ml"

  | 4 ->
# 54 "lib/Literal_lexer.mll"
      ( begin match mode with
          | `Normalize -> store_string "\\t"
          | `Preserve -> store_string "\t" end;
        string_aux mode lexbuf )
# 258 "lib/Literal_lexer.ml"

  | 5 ->
# 59 "lib/Literal_lexer.mll"
      ( begin match mode with
          | `Normalize -> store_string "\n"
          | `Preserve -> store_string "\\n" end;
        string_aux mode lexbuf )
# 266 "lib/Literal_lexer.ml"

  | 6 ->
# 64 "lib/Literal_lexer.mll"
      ( store_string (Lexing.lexeme lexbuf);
        string_aux mode lexbuf )
# 272 "lib/Literal_lexer.ml"

  | 7 ->
# 67 "lib/Literal_lexer.mll"
      ( store_string (Lexing.lexeme lexbuf);
        string_aux mode lexbuf )
# 278 "lib/Literal_lexer.ml"

  | 8 ->
# 70 "lib/Literal_lexer.mll"
      ( store_string (Lexing.lexeme lexbuf);
        string_aux mode lexbuf )
# 284 "lib/Literal_lexer.ml"

  | 9 ->
# 73 "lib/Literal_lexer.mll"
      ( store_string (Lexing.lexeme lexbuf);
        string_aux mode lexbuf )
# 290 "lib/Literal_lexer.ml"

  | 10 ->
# 76 "lib/Literal_lexer.mll"
      ( (*  Should be an error, but we are very lax.
            raise (Error (Illegal_escape (Lexing.lexeme lexbuf),
            Location.curr lexbuf))
        *)
        store_string (Lexing.lexeme lexbuf);
        string_aux mode lexbuf
      )
# 301 "lib/Literal_lexer.ml"

  | 11 ->
# 84 "lib/Literal_lexer.mll"
      ( store_string (Lexing.lexeme lexbuf);
        string_aux mode lexbuf )
# 307 "lib/Literal_lexer.ml"

  | 12 ->
# 87 "lib/Literal_lexer.mll"
      ( raise Parse_error )
# 312 "lib/Literal_lexer.ml"

  | 13 ->
# 89 "lib/Literal_lexer.mll"
      ( store_string_char (Lexing.lexeme_char lexbuf 0);
        string_aux mode lexbuf )
# 318 "lib/Literal_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
      __ocaml_lex_string_aux_rec mode lexbuf __ocaml_lex_state

and char lexbuf =
   __ocaml_lex_char_rec lexbuf 33
and __ocaml_lex_char_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 94 "lib/Literal_lexer.mll"
      ( "\\n" )
# 330 "lib/Literal_lexer.ml"

  | 1 ->
let
# 95 "lib/Literal_lexer.mll"
                                         x
# 336 "lib/Literal_lexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1) in
# 96 "lib/Literal_lexer.mll"
      ( String.make 1 x )
# 340 "lib/Literal_lexer.ml"

  | 2 ->
let
# 97 "lib/Literal_lexer.mll"
                                                       x
# 346 "lib/Literal_lexer.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 1) (lexbuf.Lexing.lex_start_pos + 3) in
# 98 "lib/Literal_lexer.mll"
      ( x )
# 350 "lib/Literal_lexer.ml"

  | 3 ->
let
# 99 "lib/Literal_lexer.mll"
                                                x
# 356 "lib/Literal_lexer.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 1) (lexbuf.Lexing.lex_start_pos + 5) in
# 100 "lib/Literal_lexer.mll"
      ( x )
# 360 "lib/Literal_lexer.ml"

  | 4 ->
let
# 101 "lib/Literal_lexer.mll"
                                                    x
# 366 "lib/Literal_lexer.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 1) (lexbuf.Lexing.lex_start_pos + 6) in
# 102 "lib/Literal_lexer.mll"
      ( x )
# 370 "lib/Literal_lexer.ml"

  | 5 ->
let
# 103 "lib/Literal_lexer.mll"
                                                                          x
# 376 "lib/Literal_lexer.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 1) (lexbuf.Lexing.lex_start_pos + 5) in
# 104 "lib/Literal_lexer.mll"
      ( x )
# 380 "lib/Literal_lexer.ml"

  | 6 ->
# 106 "lib/Literal_lexer.mll"
      ( raise Parse_error )
# 385 "lib/Literal_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
      __ocaml_lex_char_rec lexbuf __ocaml_lex_state

;;

# 108 "lib/Literal_lexer.mll"
 
  let string mode s =
    let lexbuf = Lexing.from_string s in
    match string mode lexbuf with
    | s -> Some s
    | exception Parse_error -> None

  let char s =
    let lexbuf = Lexing.from_string s in
    match char lexbuf with
    | s -> Some s
    | exception Parse_error -> None

# 406 "lib/Literal_lexer.ml"