this repo has no description
1{ }
2
3(* TODO: implement strings, comments, etc, to ignore ';;' in them *)
4rule fallback_expression = shortest
5 | (_ as expr)* ";;" {
6 expr
7 }
8 | (_ as expr)* eof {
9 expr
10 }
11
12and entry = parse
13 | ((_ # '\n')* as junk) "\n" {
14 (junk, line_prefix [] lexbuf)
15 }
16 | ((_ # '\n')* as junk) eof {
17 (junk, (false, []))
18 }
19
20and line_prefix acc = parse
21 | "# " {
22 true, List.rev acc
23 }
24 | '\n' {
25 line_prefix (""::acc) lexbuf
26 }
27 | _ as c {
28 output_line_legacy c acc lexbuf
29 }
30 | eof {
31 false, List.rev ("" :: acc)
32 }
33
34and output_line_legacy c acc = parse
35 | ((_ # '\n')* as line) "\n" {
36 line_prefix ((String.make 1 c ^ line) :: acc) lexbuf
37 }
38 | (_ # '\n')* as line eof {
39 false, List.rev ((String.make 1 c ^ line) :: acc)
40 }
41