package cosovo

  1. Overview
  2. Docs
An OCaml library parsing CSV files

Install

dune-project
 Dependency

Authors

Maintainers

Sources

cosovo-3.tbz
sha256=fca9a6d3ad87bbffa483417424b858db69ab4bf7407459ddbb52accf4f368ef1
sha512=5bf77898c9a3be21df6faf1cbd66f881adf4fc29155e02b289ac07215ed33645a6b23375876ce81bff922632fcab2fc1e4b214b76155532d4697b64f9b089630

doc/src/cosovo/lexer.ml.html

Source file 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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
# 1 "lib/lexer.mll"
 

open Lexing
open Printf
open Parser

exception UnterminatedString of int (* line number *)

let newline lexbuf =
  let pos = lexbuf.lex_curr_p in
  lexbuf.lex_curr_p <- {
    pos with
      pos_lnum = pos.pos_lnum + 1;
      pos_bol = pos.pos_cnum
  }

(* also from Yojson *)

let min10 = min_int / 10 - (if min_int mod 10 = 0 then 0 else 1)
let max10 = max_int / 10 + (if max_int mod 10 = 0 then 0 else 1)

(* from Yojson's read.mll.  Merci Martin. *)

exception IntOverflow of (int * string)
(* line number * unparseable string *)

let raise_int_overflow lexbuf ~start ~stop =
  let huge_int = Bytes.sub_string lexbuf.lex_buffer start (stop-start) in
  raise (IntOverflow (lexbuf.lex_start_p.pos_lnum, huge_int))

let dec code =
    code - 48

let extract_positive_int lexbuf =
  let start = lexbuf.lex_start_pos in
  let stop = lexbuf.lex_curr_pos in
  let s = lexbuf.lex_buffer in
  let n = ref 0 in
  for i = start to stop - 1 do
    if !n >= max10 then
      raise_int_overflow lexbuf ~start ~stop
    else
      n := 10 * !n + dec (Bytes.get_uint8 s i)
  done;
  if !n < 0 then
    raise_int_overflow lexbuf ~start ~stop
  else
    !n

let extract_negative_int lexbuf =
  let start = lexbuf.lex_start_pos + 1 in
  let stop = lexbuf.lex_curr_pos in
  let s = lexbuf.lex_buffer in
  let n = ref 0 in
  for i = start to stop - 1 do
    if !n <= min10 then
      raise_int_overflow lexbuf ~start ~stop
    else
      n := 10 * !n - dec (Bytes.get_uint8 s i)
  done;
  if !n > 0 then
    raise_int_overflow lexbuf ~start ~stop
  else
    !n

let float_or_int_of_string s =
  let f = float_of_string s in
  let i = truncate f in
  if f -. (float i) = 0.0 then
    if i <= 0 then
      NEG_INT i
    else
      POS_INT i
  else
    FLOAT f


# 80 "lib/lexer.ml"
let __ocaml_lex_tables = {
  Lexing.lex_base =
   "\000\000\028\000\056\000\106\000\134\000\184\000\247\255\248\255\
    \249\255\010\000\251\255\252\255\253\255\234\000\255\255\004\000\
    \023\001\073\001\106\001\158\001\191\001\241\001\036\002\086\002\
    \144\002\208\002\194\002\241\002\249\255\250\255\251\255\062\000\
    \253\255\013\003\255\255\005\000\037\000\034\000\253\255\254\255\
    \038\000\255\255\049\000\044\000\253\255\254\255\045\000\255\255\
    \223\001\250\255\251\255\252\255\253\255\254\255\255\255";
  Lexing.lex_backtrk =
   "\255\255\013\000\013\000\013\000\013\000\009\000\255\255\255\255\
    \255\255\005\000\255\255\255\255\255\255\001\000\255\255\001\000\
    \013\000\012\000\013\000\012\000\013\000\012\000\013\000\010\000\
    \013\000\012\000\255\255\007\000\255\255\255\255\255\255\003\000\
    \255\255\001\000\255\255\001\000\255\255\003\000\255\255\255\255\
    \001\000\255\255\255\255\003\000\255\255\255\255\001\000\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255";
  Lexing.lex_default =
   "\001\000\001\000\001\000\001\000\001\000\001\000\000\000\000\000\
    \000\000\255\255\000\000\000\000\000\000\013\000\000\000\015\000\
    \001\000\001\000\001\000\001\000\001\000\001\000\001\000\001\000\
    \001\000\001\000\027\000\027\000\000\000\000\000\000\000\255\255\
    \000\000\033\000\000\000\035\000\037\000\037\000\000\000\000\000\
    \037\000\000\000\043\000\043\000\000\000\000\000\043\000\000\000\
    \255\255\000\000\000\000\000\000\000\000\000\000\000\000";
  Lexing.lex_trans =
   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \009\000\009\000\012\000\000\000\009\000\009\000\255\255\255\255\
    \000\000\000\000\009\000\009\000\000\000\000\000\009\000\009\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \009\000\000\000\007\000\013\000\255\255\255\255\255\255\006\000\
    \255\255\255\255\009\000\003\000\008\000\004\000\002\000\040\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
    \005\000\005\000\000\000\046\000\255\255\000\000\255\255\000\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\031\000\031\000\
    \255\255\255\255\031\000\031\000\041\000\255\255\255\255\255\255\
    \000\000\000\000\000\000\047\000\000\000\000\000\000\000\000\000\
    \255\255\000\000\255\255\000\000\000\000\000\000\031\000\255\255\
    \000\000\000\000\000\000\000\000\255\255\000\000\000\000\000\000\
    \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
    \025\000\025\000\255\255\255\255\255\255\000\000\255\255\255\255\
    \000\000\000\000\000\000\011\000\000\000\010\000\255\255\000\000\
    \000\000\038\000\255\255\000\000\000\000\000\000\000\000\000\000\
    \255\255\255\255\255\255\000\000\255\255\044\000\255\255\255\255\
    \255\255\255\255\255\255\255\255\000\000\000\000\255\255\255\255\
    \002\000\255\255\024\000\024\000\024\000\024\000\024\000\024\000\
    \024\000\024\000\024\000\024\000\000\000\000\000\255\255\000\000\
    \255\255\000\000\000\000\000\000\000\000\255\255\000\000\000\000\
    \000\000\000\000\255\255\255\255\002\000\255\255\023\000\023\000\
    \023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\
    \255\255\255\255\255\255\000\000\255\255\255\255\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \255\255\000\000\255\255\000\000\000\000\000\000\000\000\255\255\
    \000\000\000\000\000\000\000\000\255\255\255\255\017\000\255\255\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
    \005\000\005\000\015\000\015\000\255\255\000\000\015\000\015\000\
    \000\000\000\000\000\000\000\000\000\000\016\000\000\000\000\000\
    \014\000\255\255\000\000\255\255\255\255\255\255\000\000\000\000\
    \000\000\000\000\015\000\000\000\015\000\000\000\000\000\000\000\
    \000\000\015\000\000\000\000\000\000\000\000\000\015\000\000\000\
    \000\000\000\000\000\000\000\000\255\255\016\000\000\000\255\255\
    \255\255\255\255\255\255\255\255\255\255\039\000\255\255\000\000\
    \000\000\000\000\000\000\000\000\255\255\255\255\000\000\000\000\
    \000\000\045\000\000\000\255\255\000\000\255\255\000\000\255\255\
    \255\255\255\255\000\000\000\000\000\000\000\000\255\255\000\000\
    \000\000\000\000\022\000\255\255\022\000\000\000\000\000\021\000\
    \021\000\021\000\021\000\021\000\021\000\021\000\021\000\021\000\
    \021\000\255\255\255\255\255\255\000\000\255\255\255\255\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\015\000\000\000\015\000\
    \000\000\255\255\255\255\255\255\000\000\000\000\000\000\000\000\
    \255\255\000\000\255\255\255\255\255\255\255\255\255\255\255\255\
    \000\000\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
    \017\000\017\000\017\000\000\000\000\000\000\000\255\255\000\000\
    \000\000\000\000\255\255\000\000\255\255\000\000\018\000\000\000\
    \000\000\255\255\255\255\000\000\255\255\020\000\255\255\020\000\
    \000\000\000\000\019\000\019\000\019\000\019\000\019\000\019\000\
    \019\000\019\000\019\000\019\000\000\000\000\000\255\255\255\255\
    \255\255\000\000\255\255\255\255\000\000\000\000\018\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \255\255\000\000\000\000\000\000\000\000\000\000\255\255\000\000\
    \255\255\000\000\000\000\000\000\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\000\000\019\000\019\000\
    \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\255\255\
    \000\000\255\255\000\000\000\000\000\000\255\255\255\255\255\255\
    \000\000\000\000\255\255\255\255\000\000\000\000\000\000\019\000\
    \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\
    \019\000\255\255\255\255\255\255\000\000\255\255\255\255\000\000\
    \000\000\054\000\000\000\000\000\000\000\000\000\054\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\255\255\000\000\255\255\000\000\000\000\000\000\255\255\
    \255\255\255\255\000\000\255\255\000\000\255\255\000\000\000\000\
    \000\000\021\000\021\000\021\000\021\000\021\000\021\000\021\000\
    \021\000\021\000\021\000\000\000\255\255\255\255\255\255\000\000\
    \255\255\255\255\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\255\255\054\000\255\255\000\000\000\000\000\000\
    \000\000\053\000\000\000\000\000\255\255\052\000\255\255\000\000\
    \000\000\255\255\000\000\255\255\000\000\049\000\000\000\000\000\
    \255\255\051\000\000\000\050\000\021\000\021\000\021\000\021\000\
    \021\000\021\000\021\000\021\000\021\000\021\000\255\255\255\255\
    \255\255\000\000\255\255\255\255\000\000\000\000\000\000\000\000\
    \000\000\000\000\255\255\000\000\255\255\000\000\255\255\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\255\255\000\000\
    \255\255\000\000\000\000\000\000\000\000\255\255\000\000\000\000\
    \000\000\000\000\255\255\000\000\017\000\000\000\023\000\023\000\
    \023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \255\255\255\255\255\255\016\000\255\255\255\255\255\255\255\255\
    \000\000\255\255\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \255\255\000\000\255\255\000\000\000\000\000\000\000\000\255\255\
    \000\000\000\000\000\000\016\000\255\255\000\000\017\000\255\255\
    \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\
    \024\000\024\000\031\000\031\000\032\000\000\000\031\000\031\000\
    \000\000\255\255\000\000\255\255\000\000\016\000\000\000\000\000\
    \255\255\255\255\255\255\000\000\255\255\255\255\000\000\000\000\
    \000\000\000\000\031\000\000\000\029\000\033\000\000\000\000\000\
    \000\000\028\000\000\000\000\000\000\000\000\000\030\000\000\000\
    \255\255\255\255\255\255\000\000\000\000\016\000\000\000\255\255\
    \000\000\255\255\255\255\255\255\255\255\255\255\255\255\000\000\
    \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
    \025\000\025\000\000\000\255\255\000\000\255\255\000\000\000\000\
    \000\000\255\255\000\000\255\255\000\000\035\000\035\000\255\255\
    \255\255\035\000\035\000\000\000\000\000\255\255\000\000\000\000\
    \000\000\000\000\000\000\000\000\255\255\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\035\000\000\000\035\000\
    \000\000\000\000\000\000\000\000\035\000\000\000\000\000\000\000\
    \000\000\035\000\000\000\000\000\000\000\255\255\000\000\255\255\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\255\255\000\000\255\255\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\255\255\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\255\255\000\000\255\255\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \035\000\000\000\035\000\000\000\000\000\000\000\000\000\000\000\
    \255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\034\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\255\255\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\255\255";
  Lexing.lex_check =
   "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \000\000\000\000\000\000\255\255\000\000\000\000\015\000\035\000\
    \255\255\255\255\009\000\009\000\255\255\255\255\009\000\009\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \000\000\255\255\000\000\000\000\001\000\001\000\001\000\000\000\
    \001\000\001\000\009\000\000\000\000\000\000\000\000\000\036\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\255\255\042\000\001\000\255\255\001\000\255\255\
    \002\000\002\000\002\000\001\000\002\000\002\000\031\000\031\000\
    \001\000\037\000\031\000\031\000\036\000\040\000\043\000\046\000\
    \255\255\255\255\255\255\042\000\255\255\255\255\255\255\255\255\
    \002\000\255\255\002\000\255\255\255\255\255\255\031\000\002\000\
    \255\255\255\255\255\255\255\255\002\000\255\255\255\255\255\255\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\003\000\003\000\003\000\255\255\003\000\003\000\
    \255\255\255\255\255\255\000\000\255\255\000\000\037\000\255\255\
    \255\255\036\000\040\000\255\255\255\255\255\255\255\255\255\255\
    \043\000\046\000\003\000\255\255\003\000\042\000\004\000\004\000\
    \004\000\003\000\004\000\004\000\255\255\255\255\003\000\001\000\
    \003\000\001\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\255\255\255\255\004\000\255\255\
    \004\000\255\255\255\255\255\255\255\255\004\000\255\255\255\255\
    \255\255\255\255\004\000\002\000\004\000\002\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \005\000\005\000\005\000\255\255\005\000\005\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\
    \005\000\255\255\005\000\255\255\255\255\255\255\255\255\005\000\
    \255\255\255\255\255\255\255\255\005\000\003\000\005\000\003\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
    \005\000\005\000\013\000\013\000\013\000\255\255\013\000\013\000\
    \255\255\255\255\255\255\255\255\255\255\005\000\255\255\255\255\
    \000\000\004\000\255\255\004\000\015\000\035\000\255\255\255\255\
    \255\255\255\255\013\000\255\255\013\000\255\255\255\255\255\255\
    \255\255\013\000\255\255\255\255\255\255\255\255\013\000\255\255\
    \255\255\255\255\255\255\255\255\001\000\005\000\255\255\016\000\
    \016\000\016\000\037\000\016\000\016\000\036\000\040\000\255\255\
    \255\255\255\255\255\255\255\255\043\000\046\000\255\255\255\255\
    \255\255\042\000\255\255\005\000\255\255\005\000\255\255\016\000\
    \002\000\016\000\255\255\255\255\255\255\255\255\016\000\255\255\
    \255\255\255\255\016\000\016\000\016\000\255\255\255\255\016\000\
    \016\000\016\000\016\000\016\000\016\000\016\000\016\000\016\000\
    \016\000\017\000\017\000\017\000\255\255\017\000\017\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\013\000\255\255\013\000\
    \255\255\017\000\003\000\017\000\255\255\255\255\255\255\255\255\
    \017\000\255\255\018\000\018\000\018\000\017\000\018\000\018\000\
    \255\255\017\000\017\000\017\000\017\000\017\000\017\000\017\000\
    \017\000\017\000\017\000\255\255\255\255\255\255\004\000\255\255\
    \255\255\255\255\018\000\255\255\018\000\255\255\017\000\255\255\
    \255\255\018\000\016\000\255\255\016\000\018\000\018\000\018\000\
    \255\255\255\255\018\000\018\000\018\000\018\000\018\000\018\000\
    \018\000\018\000\018\000\018\000\255\255\255\255\019\000\019\000\
    \019\000\255\255\019\000\019\000\255\255\255\255\017\000\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \005\000\255\255\255\255\255\255\255\255\255\255\019\000\255\255\
    \019\000\255\255\255\255\255\255\017\000\019\000\017\000\020\000\
    \020\000\020\000\019\000\020\000\020\000\255\255\019\000\019\000\
    \019\000\019\000\019\000\019\000\019\000\019\000\019\000\019\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\020\000\
    \255\255\020\000\255\255\255\255\255\255\018\000\020\000\018\000\
    \255\255\255\255\013\000\020\000\255\255\255\255\255\255\020\000\
    \020\000\020\000\020\000\020\000\020\000\020\000\020\000\020\000\
    \020\000\021\000\021\000\021\000\255\255\021\000\021\000\255\255\
    \255\255\048\000\255\255\255\255\255\255\255\255\048\000\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\021\000\255\255\021\000\255\255\255\255\255\255\016\000\
    \021\000\019\000\255\255\019\000\255\255\021\000\255\255\255\255\
    \255\255\021\000\021\000\021\000\021\000\021\000\021\000\021\000\
    \021\000\021\000\021\000\255\255\022\000\022\000\022\000\255\255\
    \022\000\022\000\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\020\000\048\000\020\000\255\255\255\255\255\255\
    \255\255\048\000\255\255\255\255\022\000\048\000\022\000\255\255\
    \255\255\017\000\255\255\022\000\255\255\048\000\255\255\255\255\
    \022\000\048\000\255\255\048\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\255\255\023\000\023\000\255\255\255\255\255\255\255\255\
    \255\255\255\255\018\000\255\255\021\000\255\255\021\000\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\023\000\255\255\
    \023\000\255\255\255\255\255\255\255\255\023\000\255\255\255\255\
    \255\255\255\255\023\000\255\255\023\000\255\255\023\000\023\000\
    \023\000\023\000\023\000\023\000\023\000\023\000\023\000\023\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \024\000\024\000\024\000\023\000\024\000\024\000\019\000\022\000\
    \255\255\022\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\
    \024\000\255\255\024\000\255\255\255\255\255\255\255\255\024\000\
    \255\255\255\255\255\255\023\000\024\000\255\255\024\000\020\000\
    \024\000\024\000\024\000\024\000\024\000\024\000\024\000\024\000\
    \024\000\024\000\026\000\026\000\026\000\255\255\026\000\026\000\
    \255\255\023\000\255\255\023\000\255\255\024\000\255\255\255\255\
    \025\000\025\000\025\000\255\255\025\000\025\000\255\255\255\255\
    \255\255\255\255\026\000\255\255\026\000\026\000\255\255\255\255\
    \255\255\026\000\255\255\255\255\255\255\255\255\026\000\255\255\
    \025\000\021\000\025\000\255\255\255\255\024\000\255\255\025\000\
    \255\255\027\000\027\000\027\000\025\000\027\000\027\000\255\255\
    \025\000\025\000\025\000\025\000\025\000\025\000\025\000\025\000\
    \025\000\025\000\255\255\024\000\255\255\024\000\255\255\255\255\
    \255\255\027\000\255\255\027\000\255\255\033\000\033\000\033\000\
    \027\000\033\000\033\000\255\255\255\255\027\000\255\255\255\255\
    \255\255\255\255\255\255\255\255\022\000\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\033\000\255\255\033\000\
    \255\255\255\255\255\255\255\255\033\000\255\255\255\255\255\255\
    \255\255\033\000\255\255\255\255\255\255\026\000\255\255\026\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\025\000\255\255\025\000\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\023\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\027\000\255\255\027\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\
    \033\000\255\255\033\000\255\255\255\255\255\255\255\255\255\255\
    \024\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\026\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\
    \025\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\027\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\033\000";
  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 row lexbuf =
   __ocaml_lex_row_rec lexbuf 0
and __ocaml_lex_row_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 98 "lib/lexer.mll"
      ( EOF )
# 389 "lib/lexer.ml"

  | 1 ->
let
# 100 "lib/lexer.mll"
                      c
# 395 "lib/lexer.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 1) lexbuf.Lexing.lex_curr_pos in
# 101 "lib/lexer.mll"
      ( COMMENT c )
# 399 "lib/lexer.ml"

  | 2 ->
# 104 "lib/lexer.mll"
      ( newline lexbuf; EOL )
# 404 "lib/lexer.ml"

  | 3 ->
# 107 "lib/lexer.mll"
      ( LCURLY )
# 409 "lib/lexer.ml"

  | 4 ->
# 110 "lib/lexer.mll"
      ( RCURLY )
# 414 "lib/lexer.ml"

  | 5 ->
# 114 "lib/lexer.mll"
      ( row lexbuf )
# 419 "lib/lexer.ml"

  | 6 ->
# 117 "lib/lexer.mll"
      ( COMMA  )
# 424 "lib/lexer.ml"

  | 7 ->
# 120 "lib/lexer.mll"
      ( STRING (double_quoted_string [] lexbuf) )
# 429 "lib/lexer.ml"

  | 8 ->
# 123 "lib/lexer.mll"
      ( STRING (single_quoted_string [] lexbuf) )
# 434 "lib/lexer.ml"

  | 9 ->
# 126 "lib/lexer.mll"
      ( POS_INT (extract_positive_int lexbuf) )
# 439 "lib/lexer.ml"

  | 10 ->
# 129 "lib/lexer.mll"
      ( NEG_INT (extract_negative_int lexbuf) )
# 444 "lib/lexer.ml"

  | 11 ->
# 132 "lib/lexer.mll"
      ( NEG_INT (extract_negative_int lexbuf) )
# 449 "lib/lexer.ml"

  | 12 ->
# 135 "lib/lexer.mll"
      ( float_or_int_of_string (lexeme lexbuf) )
# 454 "lib/lexer.ml"

  | 13 ->
# 139 "lib/lexer.mll"
                 ( STRING (lexeme lexbuf) )
# 459 "lib/lexer.ml"

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

and header lexbuf =
   __ocaml_lex_header_rec lexbuf 26
and __ocaml_lex_header_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 143 "lib/lexer.mll"
      ( EOF )
# 471 "lib/lexer.ml"

  | 1 ->
let
# 145 "lib/lexer.mll"
                      c
# 477 "lib/lexer.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 1) lexbuf.Lexing.lex_curr_pos in
# 146 "lib/lexer.mll"
      ( COMMENT c )
# 481 "lib/lexer.ml"

  | 2 ->
# 149 "lib/lexer.mll"
      ( newline lexbuf; EOL )
# 486 "lib/lexer.ml"

  | 3 ->
# 153 "lib/lexer.mll"
      ( header lexbuf )
# 491 "lib/lexer.ml"

  | 4 ->
# 156 "lib/lexer.mll"
      ( COMMA  )
# 496 "lib/lexer.ml"

  | 5 ->
# 159 "lib/lexer.mll"
      ( STRING (double_quoted_string [] lexbuf) )
# 501 "lib/lexer.ml"

  | 6 ->
# 162 "lib/lexer.mll"
      ( STRING (single_quoted_string [] lexbuf) )
# 506 "lib/lexer.ml"

  | 7 ->
# 165 "lib/lexer.mll"
      ( STRING (lexeme lexbuf) )
# 511 "lib/lexer.ml"

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

and single_quoted_string l lexbuf =
   __ocaml_lex_single_quoted_string_rec l lexbuf 36
and __ocaml_lex_single_quoted_string_rec l lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 170 "lib/lexer.mll"
      ( String.concat "" (List.rev l) )
# 523 "lib/lexer.ml"

  | 1 ->
# 172 "lib/lexer.mll"
               ( raise (UnterminatedString lexbuf.lex_start_p.pos_lnum) )
# 528 "lib/lexer.ml"

  | 2 ->
# 175 "lib/lexer.mll"
      ( let s = escaped_char lexbuf in single_quoted_string (s :: l) lexbuf )
# 533 "lib/lexer.ml"

  | 3 ->
# 178 "lib/lexer.mll"
      ( single_quoted_string (lexeme lexbuf :: l) lexbuf )
# 538 "lib/lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
      __ocaml_lex_single_quoted_string_rec l lexbuf __ocaml_lex_state

and double_quoted_string l lexbuf =
   __ocaml_lex_double_quoted_string_rec l lexbuf 42
and __ocaml_lex_double_quoted_string_rec l lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 182 "lib/lexer.mll"
      ( String.concat "" (List.rev l) )
# 550 "lib/lexer.ml"

  | 1 ->
# 184 "lib/lexer.mll"
               ( raise (UnterminatedString lexbuf.lex_start_p.pos_lnum) )
# 555 "lib/lexer.ml"

  | 2 ->
# 187 "lib/lexer.mll"
      ( let s = escaped_char lexbuf in double_quoted_string (s :: l) lexbuf )
# 560 "lib/lexer.ml"

  | 3 ->
# 190 "lib/lexer.mll"
      ( double_quoted_string (lexeme lexbuf :: l) lexbuf )
# 565 "lib/lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
      __ocaml_lex_double_quoted_string_rec l lexbuf __ocaml_lex_state

and escaped_char lexbuf =
   __ocaml_lex_escaped_char_rec lexbuf 48
and __ocaml_lex_escaped_char_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 197 "lib/lexer.mll"
      ( lexeme lexbuf )
# 577 "lib/lexer.ml"

  | 1 ->
# 200 "lib/lexer.mll"
      ( "\b" )
# 582 "lib/lexer.ml"

  | 2 ->
# 203 "lib/lexer.mll"
      ( "\012" )
# 587 "lib/lexer.ml"

  | 3 ->
# 206 "lib/lexer.mll"
      ( "\r" )
# 592 "lib/lexer.ml"

  | 4 ->
# 209 "lib/lexer.mll"
      ( "\t" )
# 597 "lib/lexer.ml"

  | 5 ->
# 212 "lib/lexer.mll"
      ( newline lexbuf; "\n" )
# 602 "lib/lexer.ml"

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

;;

# 215 "lib/lexer.mll"
 
  let string_of_tok = function
    | STRING s  -> sprintf "STRING(%s)" s
    | POS_INT i -> sprintf "POS_INT(%d)" i
    | NEG_INT i -> sprintf "NEG_INT(%d)" i
    | FLOAT f   -> sprintf "FLOAT(%f)" f
    | COMMENT s -> sprintf "COMMENT(%s)" s

    | COMMA  -> ","
    | RCURLY -> "}"
    | LCURLY -> "{"

    | EOL -> "eol"
    | EOF -> "eof"


  (* debugging *)
  let print_row lexbuf =
    let rec loop lexbuf =
      let tok = row lexbuf in
      print_endline (string_of_tok tok);
      match tok with
        | EOF -> ()
        | _   -> loop lexbuf
    in
    loop lexbuf


  (* debugging *)
  let tokenize_file file  =
    let ch = open_in file in
    let lexbuf = Lexing.from_channel ch in
    try
      print_row lexbuf
    with End_of_file ->
      close_in ch



# 649 "lib/lexer.ml"
OCaml

Innovation. Community. Security.