Source file mustache_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
# 22 "lib/mustache_lexer.mll"
 
  open Lexing
  open Mustache_parser

  let tok_arg f lexbuf =
    let start_p = lexbuf.Lexing.lex_start_p in
    let x = f lexbuf in
    lexbuf.Lexing.lex_start_p <- start_p;
    x

  let with_space space f =
    tok_arg (fun lexbuf ->
      let () = space lexbuf in
      let x = f lexbuf in
      let () = space lexbuf in
      x
    )

  let split_on_char sep s =
    let open String in
    let r = ref [] in
    let j = ref (length s) in
    for i = length s - 1 downto 0 do
      if unsafe_get s i = sep then begin
        r := sub s (i + 1) (!j - i - 1) :: !r;
        j := i
      end
    done;
    sub s 0 !j :: !r

  let split_ident ident =
    if ident = "." then []
    else split_on_char '.' ident

# 37 "lib/mustache_lexer.ml"
let __ocaml_lex_tables = {
  Lexing.lex_base =
   "\000\000\001\000\255\255\000\000\078\000\156\000\234\000\255\255\
    \056\001\134\001\027\001\252\255\254\255\102\001\103\001\011\000\
    \255\255\182\001\242\255\245\255\183\001\247\001\012\000\001\000\
    \226\001\249\255\250\255\251\255\252\255\253\255\254\255\255\255\
    \013\000\247\255";
  Lexing.lex_backtrk =
   "\001\000\255\255\255\255\255\255\000\000\255\255\000\000\255\255\
    \255\255\000\000\002\000\255\255\255\255\002\000\002\000\003\000\
    \255\255\011\000\255\255\255\255\011\000\011\000\012\000\012\000\
    \007\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \009\000\255\255";
  Lexing.lex_default =
   "\255\255\255\255\000\000\255\255\255\255\255\255\255\255\000\000\
    \255\255\255\255\013\000\000\000\000\000\013\000\013\000\255\255\
    \000\000\020\000\000\000\000\000\020\000\020\000\255\255\255\255\
    \255\255\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \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\000\000\002\000\002\000\000\000\001\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\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\000\000\004\000\
    \000\000\000\000\000\000\000\000\000\000\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\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\000\000\000\000\000\000\000\000\004\000\
    \000\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\024\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \016\000\032\000\033\000\000\000\000\000\000\000\000\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\000\000\000\000\000\000\000\000\004\000\000\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\006\000\007\000\006\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\000\000\
    \000\000\000\000\000\000\006\000\000\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \008\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\000\000\012\000\000\000\000\000\
    \014\000\000\000\000\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\000\000\000\000\000\000\
    \000\000\006\000\000\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\009\000\000\000\009\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \012\000\012\000\000\000\014\000\014\000\000\000\000\000\000\000\
    \000\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\000\000\000\000\000\000\011\000\009\000\
    \015\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\008\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \019\000\019\000\000\000\021\000\021\000\000\000\000\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\255\255\255\255\255\255\255\255\009\000\000\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\019\000\000\000\025\000\021\000\029\000\000\000\000\000\
    \030\000\000\000\000\000\000\000\000\000\000\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\255\255\000\000\000\000\000\000\000\000\
    \026\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\023\000\255\255\022\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\
    \028\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\031\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\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\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\018\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\000\000\000\000\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\
    \255\255\000\000\000\000\001\000\255\255\000\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\
    \000\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\003\000\255\255\003\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\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\255\255\255\255\255\255\255\255\003\000\
    \255\255\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\004\000\023\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \015\000\022\000\032\000\255\255\255\255\255\255\255\255\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\255\255\255\255\255\255\255\255\004\000\255\255\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\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\255\255\255\255\255\255\
    \255\255\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\005\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\255\255\
    \255\255\255\255\255\255\005\000\255\255\005\000\005\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\255\255\010\000\255\255\255\255\
    \010\000\255\255\255\255\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\255\255\255\255\255\255\
    \255\255\006\000\255\255\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\006\000\006\000\006\000\
    \006\000\006\000\006\000\006\000\006\000\008\000\255\255\008\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \013\000\014\000\255\255\013\000\014\000\255\255\255\255\255\255\
    \255\255\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
    \008\000\008\000\008\000\255\255\255\255\255\255\010\000\008\000\
    \010\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
    \008\000\008\000\008\000\008\000\008\000\008\000\008\000\008\000\
    \008\000\008\000\008\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \017\000\020\000\255\255\017\000\020\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\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\013\000\014\000\013\000\014\000\009\000\255\255\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\009\000\009\000\009\000\009\000\009\000\009\000\009\000\
    \009\000\021\000\255\255\024\000\021\000\024\000\255\255\255\255\
    \024\000\255\255\255\255\255\255\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\010\000\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\017\000\020\000\017\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\
    \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\024\000\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\013\000\014\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\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\017\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\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\021\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 space lexbuf =
   __ocaml_lex_space_rec lexbuf 0
and __ocaml_lex_space_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 64 "lib/mustache_lexer.mll"
                  ( new_line lexbuf; space lexbuf )
# 272 "lib/mustache_lexer.ml"

  | 1 ->
# 65 "lib/mustache_lexer.mll"
          ( () )
# 277 "lib/mustache_lexer.ml"

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

and id lexbuf =
   __ocaml_lex_id_rec lexbuf 3
and __ocaml_lex_id_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 68 "lib/mustache_lexer.mll"
       ( lexeme lexbuf )
# 289 "lib/mustache_lexer.ml"

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

and ident lexbuf =
   __ocaml_lex_ident_rec lexbuf 5
and __ocaml_lex_ident_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 71 "lib/mustache_lexer.mll"
          ( lexeme lexbuf )
# 301 "lib/mustache_lexer.ml"

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

and comment acc lexbuf =
   __ocaml_lex_comment_rec acc lexbuf 10
and __ocaml_lex_comment_rec acc lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 74 "lib/mustache_lexer.mll"
                ( String.concat "" (List.rev acc) )
# 313 "lib/mustache_lexer.ml"

  | 1 ->
# 75 "lib/mustache_lexer.mll"
                ( new_line lexbuf; comment ((lexeme lexbuf) :: acc) lexbuf )
# 318 "lib/mustache_lexer.ml"

  | 2 ->
# 76 "lib/mustache_lexer.mll"
                ( comment ((lexeme lexbuf) :: acc) lexbuf )
# 323 "lib/mustache_lexer.ml"

  | 3 ->
# 77 "lib/mustache_lexer.mll"
                ( comment ((lexeme lexbuf) :: acc) lexbuf )
# 328 "lib/mustache_lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf;
      __ocaml_lex_comment_rec acc lexbuf __ocaml_lex_state

and mustache lexbuf =
   __ocaml_lex_mustache_rec lexbuf 17
and __ocaml_lex_mustache_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 80 "lib/mustache_lexer.mll"
                 ( UNESCAPE_START (with_space space ident lexbuf |> split_ident) )
# 340 "lib/mustache_lexer.ml"

  | 1 ->
# 81 "lib/mustache_lexer.mll"
                 ( UNESCAPE_START_AMPERSAND (with_space space ident lexbuf |> split_ident) )
# 345 "lib/mustache_lexer.ml"

  | 2 ->
# 82 "lib/mustache_lexer.mll"
                 ( SECTION_START (with_space space ident lexbuf |> split_ident) )
# 350 "lib/mustache_lexer.ml"

  | 3 ->
# 83 "lib/mustache_lexer.mll"
                 ( SECTION_INVERT_START (with_space space ident lexbuf |> split_ident) )
# 355 "lib/mustache_lexer.ml"

  | 4 ->
# 84 "lib/mustache_lexer.mll"
                 ( SECTION_END (with_space space ident lexbuf |> split_ident) )
# 360 "lib/mustache_lexer.ml"

  | 5 ->
# 85 "lib/mustache_lexer.mll"
                 ( PARTIAL_START (0, with_space space ident lexbuf) )
# 365 "lib/mustache_lexer.ml"

  | 6 ->
# 86 "lib/mustache_lexer.mll"
                 ( COMMENT (tok_arg (comment []) lexbuf) )
# 370 "lib/mustache_lexer.ml"

  | 7 ->
# 87 "lib/mustache_lexer.mll"
                 ( ESCAPE_START (with_space space ident lexbuf |> split_ident) )
# 375 "lib/mustache_lexer.ml"

  | 8 ->
# 88 "lib/mustache_lexer.mll"
                 ( UNESCAPE_END )
# 380 "lib/mustache_lexer.ml"

  | 9 ->
# 89 "lib/mustache_lexer.mll"
                 ( END )
# 385 "lib/mustache_lexer.ml"

  | 10 ->
# 90 "lib/mustache_lexer.mll"
                 ( new_line lexbuf; RAW (lexeme lexbuf) )
# 390 "lib/mustache_lexer.ml"

  | 11 ->
# 91 "lib/mustache_lexer.mll"
                 ( RAW (lexeme lexbuf) )
# 395 "lib/mustache_lexer.ml"

  | 12 ->
# 92 "lib/mustache_lexer.mll"
                 ( RAW (lexeme lexbuf) )
# 400 "lib/mustache_lexer.ml"

  | 13 ->
# 93 "lib/mustache_lexer.mll"
                 ( EOF )
# 405 "lib/mustache_lexer.ml"

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

;;

# 95 "lib/mustache_lexer.mll"
 
   let handle_standalone lexer lexbuf =
     let ends_with_newline s =
       String.length s > 0 &&
       s.[String.length s - 1] = '\n'
     in
     let get_loc () = lexbuf.Lexing.lex_curr_p in
     let get_tok () =
       let loc_start = get_loc () in
       let tok = lexer lexbuf in
       let loc_end = get_loc () in
       (tok, loc_start, loc_end)
     in
     let slurp_line () =
       let rec loop acc =
         let tok = get_tok () in
         match tok with
         | EOF, _, _ -> tok :: acc
         | RAW s, _, _ when ends_with_newline s -> tok :: acc
         | _ -> loop (tok :: acc)
       in
       List.rev (loop [])
     in
     let is_blank s =
       let ret = ref true in
       for i = 0 to String.length s - 1 do
         if not (List.mem s.[i] [' '; '\t'; '\r'; '\n']) then
           ret := false
       done;
       !ret
     in
     let skip_blanks l =
       let rec loop skipped = function
         | (RAW s, _, _) :: toks when is_blank s ->
           loop (skipped + String.length s) toks
         | toks -> (skipped, toks)
       in
       loop 0 l
     in
     let segment_before tail l =
       let rec loop acc = function
         | [] -> List.rev acc
         | l when l == tail -> List.rev acc
         | y :: ys -> loop (y :: acc) ys
       in
       loop [] l
     in
     let is_standalone toks =
       let (skipped, toks) = skip_blanks toks in
       match toks with
       | (SECTION_START _, _, _) :: (END, _, _) :: toks'
       | (SECTION_INVERT_START _, _, _) :: (END, _, _) :: toks'
       | (SECTION_END _, _, _) :: (END, _, _) :: toks'
       | (PARTIAL_START _, _, _) :: (END, _, _) :: toks'
       | (COMMENT _, _, _) :: toks' ->
         let (_, toks_rest) = skip_blanks toks' in
         begin match toks_rest with
         | [] | [(EOF, _, _)] ->
           let toks_standalone =
             segment_before toks' toks |>
             function
             | [(PARTIAL_START (_, p), loc1, loc2); tok_end] ->
               [(PARTIAL_START (skipped, p), loc1, loc2); tok_end]
             | toks -> toks
           in
           Some (toks_standalone, toks_rest)
         | _ -> None
         end
       | _ -> None
     in

     let buffer = ref [] in
     fun () ->
       match !buffer with
       | tok :: toks ->
         buffer := toks; tok
       | [] ->
         let toks = slurp_line () in
         match is_standalone toks with
         | Some (toks_standalone, toks_rest) ->
           buffer := List.tl toks_standalone @ toks_rest;
           List.hd toks_standalone
         | None ->
           buffer := List.tl toks; List.hd toks

# 498 "lib/mustache_lexer.ml"