package linol

  1. Overview
  2. Docs
LSP server library

Install

Dune Dependency

Authors

Maintainers

Sources

linol-0.10.tbz
sha256=174bb8cad5b8b0c260d62b0a85da13c4f5caba4fcee042ee58284b09de7896ea
sha512=77460788407c72a33fbe289ec9c78421117543594b3524a5c8fe836f0e272c5ceb1e1074b91c1d1f476f89b75b6f63847a8021675a782ff36457c9626121a7f4

doc/src/linol.lsp/uri_lexer.ml.html

Source file uri_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
# 1 "vendor/lsp/uri_lexer.mll"
 

open Import

type t =
  { scheme : string
  ; authority : string
  ; path : string
  ; query: string option
  ; fragment: string option
  }

let int_of_hex_char c =
  let c = int_of_char (Char.uppercase_ascii c) - 48 in
  if c > 9 then
    if c > 16 && c < 23 then Some (c - 7) else None
  else if c >= 0 then
    Some c
  else
    None

let value_exn = function
   | None -> assert false
   | Some s -> s

let char_of_hexdigits high low =
  let high = value_exn (int_of_hex_char high) in
  let low = value_exn (int_of_hex_char low) in
  Char.chr (high lsl 4 + low)

(* https://github.com/mirage/ocaml-uri/blob/master/lib/uri.ml#L318 *)
let decode b =
  let len = String.length b in
  let buf = Buffer.create len in
  let rec scan start cur =
    if cur >= len then
      Buffer.add_substring buf b start (cur - start)
    else if b.[cur] = '%' then (
      Buffer.add_substring buf b start (cur - start);
      let cur = cur + 1 in
      if cur >= len then
        Buffer.add_char buf '%'
      else
        match int_of_hex_char b.[cur] with
        | None ->
          Buffer.add_char buf '%';
          scan cur cur
        | Some highbits ->
          let cur = cur + 1 in
          if cur >= len then (
            Buffer.add_char buf '%';
            Buffer.add_char buf b.[cur - 1])
          else
            let start_at =
              match int_of_hex_char b.[cur] with
              | Some lowbits ->
                Buffer.add_char buf (Char.chr ((highbits lsl 4) + lowbits));
                cur + 1
              | None ->
                Buffer.add_char buf '%';
                Buffer.add_char buf b.[cur - 1];
                cur
            in
            scan start_at start_at)
    else
      scan start (cur + 1)
  in
  scan 0 0;
  Buffer.contents buf

# 73 "vendor/lsp/uri_lexer.ml"
let __ocaml_lex_tables = {
  Lexing.lex_base =
   "\000\000\253\255\079\000\255\255\102\000\254\255\126\000\001\000\
    \009\000\061\000\127\000\128\000\147\000\002\000\025\000\102\000\
    \148\000\150\000\003\000\027\000\103\000\004\000\005\000\158\000\
    \006\000\056\000\125\000\007\000\008\000\045\000\010\000\046\000\
    \011\000\047\000\012\000";
  Lexing.lex_backtrk =
   "\002\000\255\255\255\255\255\255\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\
    \000\000\000\000\000\000\000\000\000\000\000\000\004\000\003\000\
    \003\000\002\000\001\000";
  Lexing.lex_default =
   "\255\255\000\000\255\255\000\000\255\255\000\000\011\000\007\000\
    \008\000\009\000\009\000\011\000\015\000\013\000\014\000\015\000\
    \015\000\017\000\018\000\019\000\020\000\021\000\022\000\023\000\
    \024\000\025\000\026\000\027\000\028\000\030\000\030\000\032\000\
    \032\000\033\000\034\000";
  Lexing.lex_trans =
   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\003\000\000\000\001\000\003\000\002\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\028\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\022\000\003\000\021\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\027\000\031\000\033\000\034\000\003\000\
    \007\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\000\000\008\000\000\000\003\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\013\000\018\000\000\000\000\000\000\000\000\000\000\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\005\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
    \024\000\007\000\007\000\007\000\000\000\014\000\019\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\010\000\023\000\009\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\013\000\013\000\
    \009\000\018\000\012\000\000\000\025\000\008\000\008\000\008\000\
    \000\000\024\000\016\000\017\000\000\000\020\000\000\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\026\000\000\000\000\000\
    \000\000\000\000\014\000\014\000\000\000\019\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\025\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \001\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\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\255\255\255\255\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\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\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\000\000\000\000\000\000\255\255\255\255\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\255\255\000\000\255\255\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\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\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\008\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\014\000\000\000\019\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\025\000\029\000\031\000\033\000\000\000\
    \009\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\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\009\000\255\255\000\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\015\000\020\000\255\255\255\255\255\255\255\255\255\255\
    \002\000\002\000\002\000\002\000\002\000\002\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \026\000\006\000\010\000\011\000\255\255\015\000\020\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\006\000\010\000\011\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\012\000\016\000\
    \006\000\017\000\011\000\255\255\026\000\006\000\010\000\011\000\
    \255\255\023\000\012\000\016\000\255\255\017\000\255\255\004\000\
    \004\000\004\000\004\000\004\000\004\000\023\000\255\255\255\255\
    \255\255\255\255\012\000\016\000\255\255\017\000\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\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \000\000\007\000\013\000\018\000\021\000\022\000\024\000\027\000\
    \028\000\008\000\030\000\032\000\034\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\014\000\255\255\019\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\029\000\031\000\033\000\
    \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\009\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\015\000\020\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\026\000\006\000\010\000\
    \011\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\012\000\016\000\255\255\017\000\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\023\000";
  Lexing.lex_base_code =
   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\
    \002\000\003\000\004\000\006\000\005\000\007\000\008\000\009\000\
    \010\000\013\000\011\000\014\000\015\000\012\000\016\000\024\000\
    \017\000\019\000\020\000\018\000\021\000\000\000\000\000\005\000\
    \000\000\023\000\000\000";
  Lexing.lex_backtrk_code =
   "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\032\000\
    \050\000\001\000\001\000\001\000\082\000\097\000\114\000\082\000\
    \082\000\131\000\155\000\174\000\131\000\193\000\214\000\233\000\
    \248\000\009\001\233\000\026\001\045\001\000\000\000\000\000\000\
    \000\000\000\000\065\001";
  Lexing.lex_default_code =
   "\000\000\000\000\000\000\000\000\000\000\000\000\014\000\047\000\
    \065\000\024\000\024\000\014\000\024\000\047\000\065\000\024\000\
    \024\000\148\000\047\000\065\000\024\000\047\000\047\000\148\000\
    \047\000\065\000\024\000\047\000\047\000\000\000\000\000\000\000\
    \000\000\062\001\000\000";
  Lexing.lex_trans_code =
   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\019\000\000\000\019\000\019\000\019\000\
    \019\000\019\000\000\000\019\000\019\000\019\000\000\000\024\000\
    \019\000\019\000\019\000\068\000\062\001\024\000\019\000\019\000\
    \000\000\068\000\024\000\019\000\024\000\000\000\000\000\027\000\
    \077\000\000\000\027\000\027\000\027\000\027\000\000\000\024\000\
    \027\000\027\000\000\000\000\000\027\000\000\000\027\000\000\000\
    \000\000\000\000\000\000\027\000\000\000\000\000\000\000\027\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\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_code =
   "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\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\008\000\009\000\010\000\
    \012\000\011\000\255\255\014\000\015\000\016\000\255\255\006\000\
    \017\000\019\000\020\000\010\000\031\000\011\000\025\000\026\000\
    \255\255\016\000\006\000\023\000\017\000\255\255\255\255\006\000\
    \011\000\255\255\009\000\010\000\012\000\011\000\033\000\023\000\
    \015\000\016\000\255\255\255\255\017\000\255\255\020\000\255\255\
    \255\255\255\255\255\255\026\000\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\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\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\007\000\008\000\009\000\010\000\012\000\011\000\013\000\
    \014\000\015\000\016\000\018\000\021\000\017\000\019\000\020\000\
    \022\000\024\000\027\000\025\000\026\000\028\000\255\255\033\000\
    \023\000";
  Lexing.lex_code =
   "\255\009\255\007\255\005\255\003\255\000\011\001\010\255\017\255\
    \010\255\255\014\255\013\255\255\010\255\255\016\255\015\255\255\
    \009\255\007\255\003\255\000\011\001\010\005\014\004\013\255\013\
    \255\255\009\255\005\255\003\255\007\016\006\015\000\011\001\010\
    \255\015\255\255\019\255\018\255\011\255\010\255\255\011\255\010\
    \255\255\007\255\005\255\003\255\009\012\008\017\000\011\001\010\
    \255\007\255\003\255\009\012\008\017\000\011\001\010\005\014\004\
    \013\255\005\255\003\255\009\012\008\017\007\016\006\015\000\011\
    \001\010\255\007\255\005\255\009\012\008\017\000\011\001\010\003\
    \019\002\018\255\011\255\010\255\018\255\255\007\255\009\012\008\
    \017\000\011\001\010\005\014\004\013\003\019\002\018\255\005\255\
    \009\012\008\017\007\016\006\015\000\011\001\010\003\019\002\018\
    \255\009\012\008\017\007\016\006\015\000\011\001\010\005\014\004\
    \013\003\019\002\018\255\003\255\009\012\008\017\007\016\006\015\
    \000\011\001\010\005\014\004\013\255\009\255\007\255\005\255\000\
    \011\001\010\003\019\002\018\255\009\255\007\255\000\011\001\010\
    \005\014\004\013\003\019\002\018\255\009\255\005\255\007\016\006\
    \015\000\011\001\010\003\019\002\018\255\009\255\007\016\006\015\
    \000\011\001\010\005\014\004\013\003\019\002\018\255\009\255\003\
    \255\007\016\006\015\000\011\001\010\005\014\004\013\255\001\255\
    \255\000\001\255";
}

let rec query b lexbuf =
   __ocaml_lex_query_rec b lexbuf 0
and __ocaml_lex_query_rec b lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
let
# 77 "vendor/lsp/uri_lexer.mll"
                                                  c
# 323 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme_char lexbuf lexbuf.Lexing.lex_start_pos in
# 77 "vendor/lsp/uri_lexer.mll"
                                                    ( Buffer.add_char b c; query b lexbuf )
# 327 "vendor/lsp/uri_lexer.ml"

  | 1 ->
let
# 78 "vendor/lsp/uri_lexer.mll"
                   high
# 333 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 1)
and
# 78 "vendor/lsp/uri_lexer.mll"
                                      low
# 338 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme_char lexbuf (lexbuf.Lexing.lex_start_pos + 2) in
# 79 "vendor/lsp/uri_lexer.mll"
  ( Buffer.add_char b (char_of_hexdigits high low);
    query b lexbuf
  )
# 344 "vendor/lsp/uri_lexer.ml"

  | 2 ->
# 82 "vendor/lsp/uri_lexer.mll"
                 ( Buffer.contents b )
# 349 "vendor/lsp/uri_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
      __ocaml_lex_query_rec b lexbuf __ocaml_lex_state

and uri lexbuf =
  lexbuf.Lexing.lex_mem <- Array.make 20 (-1);(* L=3 [12] <- p ; [11] <- p ; [10] <- p ;  *)
  lexbuf.Lexing.lex_mem.(12) <- lexbuf.Lexing.lex_curr_pos ;
  lexbuf.Lexing.lex_mem.(11) <- lexbuf.Lexing.lex_curr_pos ;
  lexbuf.Lexing.lex_mem.(10) <- lexbuf.Lexing.lex_curr_pos ;
 __ocaml_lex_uri_rec lexbuf 6
and __ocaml_lex_uri_rec lexbuf __ocaml_lex_state =
  match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
let
# 85 "vendor/lsp/uri_lexer.mll"
                        scheme
# 366 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(9) lexbuf.Lexing.lex_mem.(8)
and
# 86 "vendor/lsp/uri_lexer.mll"
                           authority
# 371 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(3) lexbuf.Lexing.lex_mem.(2)
and
# 87 "vendor/lsp/uri_lexer.mll"
                 path
# 376 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_mem.(0) lexbuf.Lexing.lex_mem.(1)
and
# 88 "vendor/lsp/uri_lexer.mll"
                  raw_query
# 381 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(7) lexbuf.Lexing.lex_mem.(6)
and
# 89 "vendor/lsp/uri_lexer.mll"
             fragment
# 386 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme_opt lexbuf lexbuf.Lexing.lex_mem.(5) lexbuf.Lexing.lex_mem.(4) in
# 90 "vendor/lsp/uri_lexer.mll"
(
  let scheme = scheme |> Option.value ~default:"file" in
  let authority =
    authority |> Option.map decode |> Option.value ~default:""
  in
  let path =
    let path = path |> decode in
    match scheme with
    | "http" | "https" | "file" ->
      String.add_prefix_if_not_exists path ~prefix:"/"
    | _ -> path
  in
  let query =
    match raw_query with
    | None -> None
    | Some c -> Some (query (Buffer.create (String.length c)) (Lexing.from_string c))
  in
  { scheme; authority; path; query; fragment }
)
# 408 "vendor/lsp/uri_lexer.ml"

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

and path lexbuf =
  lexbuf.Lexing.lex_mem <- Array.make 2 (-1); __ocaml_lex_path_rec lexbuf 29
and __ocaml_lex_path_rec lexbuf __ocaml_lex_state =
  match Lexing.new_engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 111 "vendor/lsp/uri_lexer.mll"
     ( { scheme = "file"; authority = ""; path = "/"; query = None; fragment = None } )
# 420 "vendor/lsp/uri_lexer.ml"

  | 1 ->
let
# 112 "vendor/lsp/uri_lexer.mll"
                    authority
# 426 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 2) lexbuf.Lexing.lex_mem.(0)
and
# 112 "vendor/lsp/uri_lexer.mll"
                                           path
# 431 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_mem.(0) lexbuf.Lexing.lex_curr_pos in
# 112 "vendor/lsp/uri_lexer.mll"
                                                 ( { scheme = "file"; authority; path ; query = None ; fragment = None } )
# 435 "vendor/lsp/uri_lexer.ml"

  | 2 ->
let
# 113 "vendor/lsp/uri_lexer.mll"
                    authority
# 441 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme lexbuf (lexbuf.Lexing.lex_start_pos + 2) lexbuf.Lexing.lex_curr_pos in
# 113 "vendor/lsp/uri_lexer.mll"
                               ( { scheme = "file"; authority; path = "/" ; query = None ; fragment = None } )
# 445 "vendor/lsp/uri_lexer.ml"

  | 3 ->
let
# 114 "vendor/lsp/uri_lexer.mll"
             path
# 451 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 114 "vendor/lsp/uri_lexer.mll"
                   ( { scheme = "file"; authority = ""; path ; query = None ; fragment = None } )
# 455 "vendor/lsp/uri_lexer.ml"

  | 4 ->
let
# 115 "vendor/lsp/uri_lexer.mll"
         path
# 461 "vendor/lsp/uri_lexer.ml"
= Lexing.sub_lexeme lexbuf lexbuf.Lexing.lex_start_pos lexbuf.Lexing.lex_curr_pos in
# 115 "vendor/lsp/uri_lexer.mll"
               ( { scheme = "file"; authority = ""; path = "/" ^ path ; query = None ; fragment = None } )
# 465 "vendor/lsp/uri_lexer.ml"

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

;;

# 117 "vendor/lsp/uri_lexer.mll"
 
  let of_string s =
    let lexbuf = Lexing.from_string s in
    uri lexbuf

  let of_path s =
    let lexbuf = Lexing.from_string s in
    path lexbuf

# 482 "vendor/lsp/uri_lexer.ml"
OCaml

Innovation. Community. Security.