Source file mustache_parser.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

module MenhirBasics = struct
  
  exception Error
  
  let _eRR =
    fun _s ->
      raise Error
  
  type token = 
    | UNESCAPE_START_AMPERSAND of (
# 47 "lib/mustache_parser.mly"
       (string list)
# 15 "lib/mustache_parser.ml"
  )
    | UNESCAPE_START of (
# 52 "lib/mustache_parser.mly"
       (string list)
# 20 "lib/mustache_parser.ml"
  )
    | UNESCAPE_END
    | SECTION_START of (
# 49 "lib/mustache_parser.mly"
       (string list)
# 26 "lib/mustache_parser.ml"
  )
    | SECTION_INVERT_START of (
# 48 "lib/mustache_parser.mly"
       (string list)
# 31 "lib/mustache_parser.ml"
  )
    | SECTION_END of (
# 50 "lib/mustache_parser.mly"
       (string list)
# 36 "lib/mustache_parser.ml"
  )
    | RAW of (
# 56 "lib/mustache_parser.mly"
       (string)
# 41 "lib/mustache_parser.ml"
  )
    | PARTIAL_START of (
# 51 "lib/mustache_parser.mly"
       (int * string)
# 46 "lib/mustache_parser.ml"
  )
    | ESCAPE_START of (
# 46 "lib/mustache_parser.mly"
       (string list)
# 51 "lib/mustache_parser.ml"
  )
    | EOF
    | END
    | COMMENT of (
# 53 "lib/mustache_parser.mly"
       (string)
# 58 "lib/mustache_parser.ml"
  )
  
end

include MenhirBasics

# 23 "lib/mustache_parser.mly"
  
  open Mustache_types
  open Mustache_types.Locs
  let parse_section start_s end_s contents =
    if start_s = end_s
    then { contents; name=start_s }
    else
      let msg =
        Printf.sprintf "Mismatched section %s with %s"
                       (string_of_dotted_name start_s)
                       (string_of_dotted_name end_s)
      in
      raise (Invalid_template msg)

  let with_loc startpos endpos desc =
    let loc =
      { loc_start = startpos;
        loc_end = endpos } in
    { loc; desc }

# 86 "lib/mustache_parser.ml"

type ('s, 'r) _menhir_state = 
  | MenhirState00 : ('s, _menhir_box_mustache) _menhir_state
    (** State 00.
        Stack shape : .
        Start symbol: mustache. *)

  | MenhirState06 : (('s, _menhir_box_mustache) _menhir_cell1_SECTION_START _menhir_cell0_END, _menhir_box_mustache) _menhir_state
    (** State 06.
        Stack shape : SECTION_START END.
        Start symbol: mustache. *)

  | MenhirState08 : (('s, _menhir_box_mustache) _menhir_cell1_SECTION_INVERT_START _menhir_cell0_END, _menhir_box_mustache) _menhir_state
    (** State 08.
        Stack shape : SECTION_INVERT_START END.
        Start symbol: mustache. *)

  | MenhirState19 : (('s, _menhir_box_mustache) _menhir_cell1_mustache_element, _menhir_box_mustache) _menhir_state
    (** State 19.
        Stack shape : mustache_element.
        Start symbol: mustache. *)


and ('s, 'r) _menhir_cell1_mustache_element = 
  | MenhirCell1_mustache_element of 's * ('s, 'r) _menhir_state * (Mustache_types.Locs.t) * Lexing.position

and 's _menhir_cell0_END = 
  | MenhirCell0_END of 's * Lexing.position

and ('s, 'r) _menhir_cell1_SECTION_INVERT_START = 
  | MenhirCell1_SECTION_INVERT_START of 's * ('s, 'r) _menhir_state * (
# 48 "lib/mustache_parser.mly"
       (string list)
# 120 "lib/mustache_parser.ml"
) * Lexing.position

and ('s, 'r) _menhir_cell1_SECTION_START = 
  | MenhirCell1_SECTION_START of 's * ('s, 'r) _menhir_state * (
# 49 "lib/mustache_parser.mly"
       (string list)
# 127 "lib/mustache_parser.ml"
) * Lexing.position

and _menhir_box_mustache = 
  | MenhirBox_mustache of (Mustache_types.Locs.t) [@@unboxed]

let _menhir_action_01 =
  fun () ->
    (
# 216 "<standard.mly>"
    ( [] )
# 138 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t list))

let _menhir_action_02 =
  fun x xs ->
    (
# 219 "<standard.mly>"
    ( x :: xs )
# 146 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t list))

let _menhir_action_03 =
  fun mexpr ->
    (
# 100 "lib/mustache_parser.mly"
                              ( mexpr )
# 154 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_action_04 =
  fun _endpos__2_ _startpos_elt_ elt ->
    let _endpos = _endpos__2_ in
    let _symbolstartpos = _startpos_elt_ in
    (
# 78 "lib/mustache_parser.mly"
                                      ( with_loc _symbolstartpos _endpos (Unescaped elt) )
# 164 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_action_05 =
  fun _endpos__2_ _startpos_elt_ elt ->
    let _endpos = _endpos__2_ in
    let _symbolstartpos = _startpos_elt_ in
    (
# 79 "lib/mustache_parser.mly"
                                       ( with_loc _symbolstartpos _endpos (Unescaped elt) )
# 174 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_action_06 =
  fun _endpos__2_ _startpos_elt_ elt ->
    let _endpos = _endpos__2_ in
    let _symbolstartpos = _startpos_elt_ in
    (
# 80 "lib/mustache_parser.mly"
                           ( with_loc _symbolstartpos _endpos (Escaped elt) )
# 184 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_action_07 =
  fun _endpos__2_ _startpos_elt_ elt ->
    let _endpos = _endpos__2_ in
    let _symbolstartpos = _startpos_elt_ in
    (
# 81 "lib/mustache_parser.mly"
                            (
      with_loc _symbolstartpos _endpos
        (Partial { indent = fst elt;
                   name = snd elt;
                   contents = lazy None })
    )
# 199 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_action_08 =
  fun _endpos_s_ _startpos_s_ s ->
    let _endpos = _endpos_s_ in
    let _symbolstartpos = _startpos_s_ in
    (
# 87 "lib/mustache_parser.mly"
                ( with_loc _symbolstartpos _endpos (Comment s) )
# 209 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_action_09 =
  fun sec ->
    (
# 88 "lib/mustache_parser.mly"
                  ( sec )
# 217 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_action_10 =
  fun _endpos_s_ _startpos_s_ s ->
    let _endpos = _endpos_s_ in
    let _symbolstartpos = _startpos_s_ in
    (
# 89 "lib/mustache_parser.mly"
            ( with_loc _symbolstartpos _endpos (String s) )
# 227 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_action_11 =
  fun _endpos_elts_ _startpos_elts_ elts ->
    let _endpos = _endpos_elts_ in
    let _symbolstartpos = if _startpos_elts_ != _endpos_elts_ then
      _startpos_elts_
    else
      _endpos in
    (
# 92 "lib/mustache_parser.mly"
                                  (
    match elts with
    | [] -> with_loc _symbolstartpos _endpos (String "")
    | [x] -> x
    | xs -> with_loc _symbolstartpos _endpos (Concat xs)
  )
# 245 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_action_12 =
  fun _endpos__5_ _startpos_ss_ e se ss ->
    let _endpos = _endpos__5_ in
    let _symbolstartpos = _startpos_ss_ in
    (
# 66 "lib/mustache_parser.mly"
                         (
    with_loc _symbolstartpos _endpos
      (Inverted_section (parse_section ss se e))
  )
# 258 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_action_13 =
  fun _endpos__5_ _startpos_ss_ e se ss ->
    let _endpos = _endpos__5_ in
    let _symbolstartpos = _startpos_ss_ in
    (
# 72 "lib/mustache_parser.mly"
                         (
    with_loc _symbolstartpos _endpos
      (Section (parse_section ss se e))
  )
# 271 "lib/mustache_parser.ml"
     : (Mustache_types.Locs.t))

let _menhir_print_token : token -> string =
  fun _tok ->
    match _tok with
    | COMMENT _ ->
        "COMMENT"
    | END ->
        "END"
    | EOF ->
        "EOF"
    | ESCAPE_START _ ->
        "ESCAPE_START"
    | PARTIAL_START _ ->
        "PARTIAL_START"
    | RAW _ ->
        "RAW"
    | SECTION_END _ ->
        "SECTION_END"
    | SECTION_INVERT_START _ ->
        "SECTION_INVERT_START"
    | SECTION_START _ ->
        "SECTION_START"
    | UNESCAPE_END ->
        "UNESCAPE_END"
    | UNESCAPE_START _ ->
        "UNESCAPE_START"
    | UNESCAPE_START_AMPERSAND _ ->
        "UNESCAPE_START_AMPERSAND"

let _menhir_fail : unit -> 'a =
  fun () ->
    Printf.eprintf "Internal failure -- please contact the parser generator's developers.\n%!";
    assert false

include struct
  
  [@@@ocaml.warning "-4-37"]
  
  let _menhir_run_25 : type  ttv_stack. ttv_stack -> _ -> _ -> _menhir_box_mustache =
    fun _menhir_stack _v _tok ->
      match (_tok : MenhirBasics.token) with
      | EOF ->
          let mexpr = _v in
          let _v = _menhir_action_03 mexpr in
          MenhirBox_mustache _v
      | _ ->
          _eRR ()
  
  let rec _menhir_run_01 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _startpos = _menhir_lexbuf.Lexing.lex_start_p in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | END ->
          let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
          let _tok = _menhir_lexer _menhir_lexbuf in
          let (_endpos__2_, _startpos_elt_, elt) = (_endpos, _startpos, _v) in
          let _v = _menhir_action_05 _endpos__2_ _startpos_elt_ elt in
          _menhir_goto_mustache_element _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos_elt_ _v _menhir_s _tok
      | _ ->
          _eRR ()
  
  and _menhir_goto_mustache_element : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _ -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos _v _menhir_s _tok ->
      let _menhir_stack = MenhirCell1_mustache_element (_menhir_stack, _menhir_s, _v, _startpos) in
      match (_tok : MenhirBasics.token) with
      | UNESCAPE_START_AMPERSAND _v_0 ->
          _menhir_run_01 _menhir_stack _menhir_lexbuf _menhir_lexer _v_0 MenhirState19
      | UNESCAPE_START _v_1 ->
          _menhir_run_03 _menhir_stack _menhir_lexbuf _menhir_lexer _v_1 MenhirState19
      | SECTION_START _v_2 ->
          _menhir_run_05 _menhir_stack _menhir_lexbuf _menhir_lexer _v_2 MenhirState19
      | SECTION_INVERT_START _v_3 ->
          _menhir_run_07 _menhir_stack _menhir_lexbuf _menhir_lexer _v_3 MenhirState19
      | RAW _v_4 ->
          _menhir_run_09 _menhir_stack _menhir_lexbuf _menhir_lexer _v_4 MenhirState19
      | PARTIAL_START _v_5 ->
          _menhir_run_10 _menhir_stack _menhir_lexbuf _menhir_lexer _v_5 MenhirState19
      | ESCAPE_START _v_6 ->
          _menhir_run_12 _menhir_stack _menhir_lexbuf _menhir_lexer _v_6 MenhirState19
      | COMMENT _v_7 ->
          _menhir_run_14 _menhir_stack _menhir_lexbuf _menhir_lexer _v_7 MenhirState19
      | EOF | SECTION_END _ ->
          let _v_8 = _menhir_action_01 () in
          _menhir_run_20 _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _v_8 _tok
      | _ ->
          _eRR ()
  
  and _menhir_run_03 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _startpos = _menhir_lexbuf.Lexing.lex_start_p in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | UNESCAPE_END ->
          let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
          let _tok = _menhir_lexer _menhir_lexbuf in
          let (_endpos__2_, _startpos_elt_, elt) = (_endpos, _startpos, _v) in
          let _v = _menhir_action_04 _endpos__2_ _startpos_elt_ elt in
          _menhir_goto_mustache_element _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos_elt_ _v _menhir_s _tok
      | _ ->
          _eRR ()
  
  and _menhir_run_05 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _startpos = _menhir_lexbuf.Lexing.lex_start_p in
      let _menhir_stack = MenhirCell1_SECTION_START (_menhir_stack, _menhir_s, _v, _startpos) in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | END ->
          let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
          let _menhir_stack = MenhirCell0_END (_menhir_stack, _endpos) in
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | UNESCAPE_START_AMPERSAND _v_0 ->
              _menhir_run_01 _menhir_stack _menhir_lexbuf _menhir_lexer _v_0 MenhirState06
          | UNESCAPE_START _v_1 ->
              _menhir_run_03 _menhir_stack _menhir_lexbuf _menhir_lexer _v_1 MenhirState06
          | SECTION_START _v_2 ->
              _menhir_run_05 _menhir_stack _menhir_lexbuf _menhir_lexer _v_2 MenhirState06
          | SECTION_INVERT_START _v_3 ->
              _menhir_run_07 _menhir_stack _menhir_lexbuf _menhir_lexer _v_3 MenhirState06
          | RAW _v_4 ->
              _menhir_run_09 _menhir_stack _menhir_lexbuf _menhir_lexer _v_4 MenhirState06
          | PARTIAL_START _v_5 ->
              _menhir_run_10 _menhir_stack _menhir_lexbuf _menhir_lexer _v_5 MenhirState06
          | ESCAPE_START _v_6 ->
              _menhir_run_12 _menhir_stack _menhir_lexbuf _menhir_lexer _v_6 MenhirState06
          | COMMENT _v_7 ->
              _menhir_run_14 _menhir_stack _menhir_lexbuf _menhir_lexer _v_7 MenhirState06
          | SECTION_END _ ->
              let _v_8 = _menhir_action_01 () in
              _menhir_run_21 _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _endpos _v_8 MenhirState06 _tok
          | _ ->
              _eRR ())
      | _ ->
          _eRR ()
  
  and _menhir_run_07 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _startpos = _menhir_lexbuf.Lexing.lex_start_p in
      let _menhir_stack = MenhirCell1_SECTION_INVERT_START (_menhir_stack, _menhir_s, _v, _startpos) in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | END ->
          let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
          let _menhir_stack = MenhirCell0_END (_menhir_stack, _endpos) in
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | UNESCAPE_START_AMPERSAND _v_0 ->
              _menhir_run_01 _menhir_stack _menhir_lexbuf _menhir_lexer _v_0 MenhirState08
          | UNESCAPE_START _v_1 ->
              _menhir_run_03 _menhir_stack _menhir_lexbuf _menhir_lexer _v_1 MenhirState08
          | SECTION_START _v_2 ->
              _menhir_run_05 _menhir_stack _menhir_lexbuf _menhir_lexer _v_2 MenhirState08
          | SECTION_INVERT_START _v_3 ->
              _menhir_run_07 _menhir_stack _menhir_lexbuf _menhir_lexer _v_3 MenhirState08
          | RAW _v_4 ->
              _menhir_run_09 _menhir_stack _menhir_lexbuf _menhir_lexer _v_4 MenhirState08
          | PARTIAL_START _v_5 ->
              _menhir_run_10 _menhir_stack _menhir_lexbuf _menhir_lexer _v_5 MenhirState08
          | ESCAPE_START _v_6 ->
              _menhir_run_12 _menhir_stack _menhir_lexbuf _menhir_lexer _v_6 MenhirState08
          | COMMENT _v_7 ->
              _menhir_run_14 _menhir_stack _menhir_lexbuf _menhir_lexer _v_7 MenhirState08
          | SECTION_END _ ->
              let _v_8 = _menhir_action_01 () in
              _menhir_run_21 _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _endpos _v_8 MenhirState08 _tok
          | _ ->
              _eRR ())
      | _ ->
          _eRR ()
  
  and _menhir_run_09 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _startpos = _menhir_lexbuf.Lexing.lex_start_p in
      let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
      let _tok = _menhir_lexer _menhir_lexbuf in
      let (_endpos_s_, _startpos_s_, s) = (_endpos, _startpos, _v) in
      let _v = _menhir_action_10 _endpos_s_ _startpos_s_ s in
      _menhir_goto_mustache_element _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos_s_ _v _menhir_s _tok
  
  and _menhir_run_10 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _startpos = _menhir_lexbuf.Lexing.lex_start_p in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | END ->
          let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
          let _tok = _menhir_lexer _menhir_lexbuf in
          let (_endpos__2_, _startpos_elt_, elt) = (_endpos, _startpos, _v) in
          let _v = _menhir_action_07 _endpos__2_ _startpos_elt_ elt in
          _menhir_goto_mustache_element _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos_elt_ _v _menhir_s _tok
      | _ ->
          _eRR ()
  
  and _menhir_run_12 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _startpos = _menhir_lexbuf.Lexing.lex_start_p in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | END ->
          let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
          let _tok = _menhir_lexer _menhir_lexbuf in
          let (_endpos__2_, _startpos_elt_, elt) = (_endpos, _startpos, _v) in
          let _v = _menhir_action_06 _endpos__2_ _startpos_elt_ elt in
          _menhir_goto_mustache_element _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos_elt_ _v _menhir_s _tok
      | _ ->
          _eRR ()
  
  and _menhir_run_14 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s ->
      let _startpos = _menhir_lexbuf.Lexing.lex_start_p in
      let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
      let _tok = _menhir_lexer _menhir_lexbuf in
      let (_endpos_s_, _startpos_s_, s) = (_endpos, _startpos, _v) in
      let _v = _menhir_action_08 _endpos_s_ _startpos_s_ s in
      _menhir_goto_mustache_element _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos_s_ _v _menhir_s _tok
  
  and _menhir_run_21 : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _ -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos _v _menhir_s _tok ->
      let (_endpos_elts_, _startpos_elts_, elts) = (_endpos, _startpos, _v) in
      let _v = _menhir_action_11 _endpos_elts_ _startpos_elts_ elts in
      _menhir_goto_mustache_expr _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok
  
  and _menhir_goto_mustache_expr : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _ -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _menhir_s _tok ->
      match _menhir_s with
      | MenhirState00 ->
          _menhir_run_25 _menhir_stack _v _tok
      | MenhirState06 ->
          _menhir_run_22 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | MenhirState08 ->
          _menhir_run_16 _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok
      | _ ->
          _menhir_fail ()
  
  and _menhir_run_22 : type  ttv_stack. (ttv_stack, _menhir_box_mustache) _menhir_cell1_SECTION_START _menhir_cell0_END -> _ -> _ -> _ -> _ -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      match (_tok : MenhirBasics.token) with
      | SECTION_END _v_0 ->
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | END ->
              let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
              let _tok = _menhir_lexer _menhir_lexbuf in
              let MenhirCell0_END (_menhir_stack, _) = _menhir_stack in
              let MenhirCell1_SECTION_START (_menhir_stack, _menhir_s, ss, _startpos_ss_) = _menhir_stack in
              let (_endpos__5_, se, e) = (_endpos, _v_0, _v) in
              let _v = _menhir_action_13 _endpos__5_ _startpos_ss_ e se ss in
              _menhir_goto_section _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos_ss_ _v _menhir_s _tok
          | _ ->
              _eRR ())
      | _ ->
          _eRR ()
  
  and _menhir_goto_section : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _ -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos _v _menhir_s _tok ->
      let (_startpos_sec_, sec) = (_startpos, _v) in
      let _v = _menhir_action_09 sec in
      _menhir_goto_mustache_element _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos_sec_ _v _menhir_s _tok
  
  and _menhir_run_16 : type  ttv_stack. (ttv_stack, _menhir_box_mustache) _menhir_cell1_SECTION_INVERT_START _menhir_cell0_END -> _ -> _ -> _ -> _ -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _v _tok ->
      match (_tok : MenhirBasics.token) with
      | SECTION_END _v_0 ->
          let _tok = _menhir_lexer _menhir_lexbuf in
          (match (_tok : MenhirBasics.token) with
          | END ->
              let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
              let _tok = _menhir_lexer _menhir_lexbuf in
              let MenhirCell0_END (_menhir_stack, _) = _menhir_stack in
              let MenhirCell1_SECTION_INVERT_START (_menhir_stack, _menhir_s, ss, _startpos_ss_) = _menhir_stack in
              let (_endpos__5_, se, e) = (_endpos, _v_0, _v) in
              let _v = _menhir_action_12 _endpos__5_ _startpos_ss_ e se ss in
              _menhir_goto_section _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos_ss_ _v _menhir_s _tok
          | _ ->
              _eRR ())
      | _ ->
          _eRR ()
  
  and _menhir_run_20 : type  ttv_stack. (ttv_stack, _menhir_box_mustache) _menhir_cell1_mustache_element -> _ -> _ -> _ -> _ -> _ -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _v _tok ->
      let MenhirCell1_mustache_element (_menhir_stack, _menhir_s, x, _startpos_x_) = _menhir_stack in
      let (_endpos_xs_, xs) = (_endpos, _v) in
      let _v = _menhir_action_02 x xs in
      _menhir_goto_list_mustache_element_ _menhir_stack _menhir_lexbuf _menhir_lexer _endpos_xs_ _startpos_x_ _v _menhir_s _tok
  
  and _menhir_goto_list_mustache_element_ : type  ttv_stack. ttv_stack -> _ -> _ -> _ -> _ -> _ -> (ttv_stack, _menhir_box_mustache) _menhir_state -> _ -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos _v _menhir_s _tok ->
      match _menhir_s with
      | MenhirState00 ->
          _menhir_run_21 _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos _v _menhir_s _tok
      | MenhirState06 ->
          _menhir_run_21 _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos _v _menhir_s _tok
      | MenhirState08 ->
          _menhir_run_21 _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _startpos _v _menhir_s _tok
      | MenhirState19 ->
          _menhir_run_20 _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _v _tok
  
  let _menhir_run_00 : type  ttv_stack. ttv_stack -> _ -> _ -> _menhir_box_mustache =
    fun _menhir_stack _menhir_lexbuf _menhir_lexer ->
      let _endpos = _menhir_lexbuf.Lexing.lex_curr_p in
      let _tok = _menhir_lexer _menhir_lexbuf in
      match (_tok : MenhirBasics.token) with
      | UNESCAPE_START_AMPERSAND _v ->
          _menhir_run_01 _menhir_stack _menhir_lexbuf _menhir_lexer _v MenhirState00
      | UNESCAPE_START _v ->
          _menhir_run_03 _menhir_stack _menhir_lexbuf _menhir_lexer _v MenhirState00
      | SECTION_START _v ->
          _menhir_run_05 _menhir_stack _menhir_lexbuf _menhir_lexer _v MenhirState00
      | SECTION_INVERT_START _v ->
          _menhir_run_07 _menhir_stack _menhir_lexbuf _menhir_lexer _v MenhirState00
      | RAW _v ->
          _menhir_run_09 _menhir_stack _menhir_lexbuf _menhir_lexer _v MenhirState00
      | PARTIAL_START _v ->
          _menhir_run_10 _menhir_stack _menhir_lexbuf _menhir_lexer _v MenhirState00
      | ESCAPE_START _v ->
          _menhir_run_12 _menhir_stack _menhir_lexbuf _menhir_lexer _v MenhirState00
      | COMMENT _v ->
          _menhir_run_14 _menhir_stack _menhir_lexbuf _menhir_lexer _v MenhirState00
      | EOF ->
          let _v = _menhir_action_01 () in
          _menhir_run_21 _menhir_stack _menhir_lexbuf _menhir_lexer _endpos _endpos _v MenhirState00 _tok
      | _ ->
          _eRR ()
  
end

let mustache =
  fun _menhir_lexer _menhir_lexbuf ->
    let _menhir_stack = () in
    let MenhirBox_mustache v = _menhir_run_00 _menhir_stack _menhir_lexbuf _menhir_lexer in
    v

# 102 "lib/mustache_parser.mly"
  

# 610 "lib/mustache_parser.ml"