@@ -16,21 +16,21 @@ let labels l =
16
16
failwith msg
17
17
}
18
18
19
- let eol = '\n' | '\r' '\n' | eof
19
+ let eol = '\n' | " \r\n " | eof
20
20
let ws = [' ' '\t' ]
21
21
22
- let until_eol = [^ '\n' '\r' ]
23
- let until_ws = [^ ' ' '\t' ]
24
- let until_ws_or_eol = [^ ' ' '\t' '\n' '\r' ]
22
+ let not_eol = [^ '\n' '\r' ]
23
+ let not_ws = [^ ' ' '\t' ]
24
+ let not_ws_or_eol = [^ ' ' '\t' '\n' '\r' ]
25
25
26
26
rule text section = parse
27
27
| eof { [] }
28
- | (" #" + as n) " " (until_eol * as str) eol
28
+ | (" #" + as n) " " (not_eol * as str) eol
29
29
{ let section = (String. length n, str) in
30
30
newline lexbuf;
31
31
`Section section :: text (Some section ) lexbuf }
32
- | ( "<!--" ws * "$MDX" ws * (until_ws * as label_cmt ) ws * "-->" ws * eol ? )?
33
- "```" (until_ws_or_eol * as h ) ws * (until_eol * as legacy_labels ) eol
32
+ | ( "<!--" ws * "$MDX" ws * (not_ws * as label_cmt ) ws * "-->" ws * eol ? )?
33
+ "```" (not_ws_or_eol * as h ) ws * (not_eol * as legacy_labels ) eol
34
34
{ let header = Block.Header. of_string h in
35
35
let contents = block lexbuf in
36
36
let labels , legacy_labels =
@@ -67,7 +67,7 @@ rule text section = parse
67
67
List. iter (fun _ -> newline lexbuf ) errors ;
68
68
newline lexbuf );
69
69
`Block block :: text section lexbuf }
70
- | "<!--" ws * "$MDX" ws * (until_ws * as label_cmt ) ws * "-->" ws * eol
70
+ | "<!--" ws * "$MDX" ws * (not_ws * as label_cmt ) ws * "-->" ws * eol
71
71
{ let labels = labels label_cmt in
72
72
newline lexbuf ;
73
73
let loc = Location. curr lexbuf in
@@ -77,24 +77,24 @@ rule text section = parse
77
77
| Error (`Msg msg ) -> failwith msg
78
78
in
79
79
`Block block :: text section lexbuf }
80
- | (until_eol * as str) eol
80
+ | (not_eol * as str) eol
81
81
{ newline lexbuf;
82
82
`Text str :: text section lexbuf }
83
83
84
84
and block = parse
85
85
| eof | " ```" ws* eol { [] }
86
- | (until_eol * as str) eol { str :: block lexbuf }
86
+ | (not_eol * as str) eol { str :: block lexbuf }
87
87
88
88
and error_block = parse
89
89
| " ```mdx-error" ws* eol { block lexbuf }
90
90
91
91
and cram_text section = parse
92
92
| eof { [] }
93
- | (" #" + as n) " " (until_eol * as str) eol
93
+ | (" #" + as n) " " (not_eol * as str) eol
94
94
{ let section = (String. length n, str) in
95
95
newline lexbuf;
96
96
`Section section :: cram_text (Some section ) lexbuf }
97
- | " " (until_eol * as first_line) eol
97
+ | " " (not_eol * as first_line) eol
98
98
{ let header = Some (Block.Header. Shell `Sh ) in
99
99
let requires_empty_line, contents = cram_block lexbuf in
100
100
let contents = first_line :: contents in
@@ -113,7 +113,7 @@ and cram_text section = parse
113
113
in
114
114
`Block block
115
115
:: (if requires_empty_line then `Text " " :: rest else rest) }
116
- | " <-- non-deterministic" ws* (until_eol * as choice) eol
116
+ | " <-- non-deterministic" ws* (not_eol * as choice) eol
117
117
{ let header = Some (Block.Header. Shell `Sh ) in
118
118
let requires_empty_line, contents = cram_block lexbuf in
119
119
let labels =
@@ -136,14 +136,14 @@ and cram_text section = parse
136
136
in
137
137
`Block block
138
138
:: (if requires_empty_line then `Text " " :: rest else rest) }
139
- | (until_eol * as str) eol
139
+ | (not_eol * as str) eol
140
140
{ newline lexbuf;
141
141
`Text str :: cram_text section lexbuf }
142
142
143
143
and cram_block = parse
144
144
| eof { false , [] }
145
145
| eol { newline lexbuf; true , [] }
146
- | " " (until_eol * as str) eol
146
+ | " " (not_eol * as str) eol
147
147
{ let requires_empty_line, lst = cram_block lexbuf in
148
148
requires_empty_line, str :: lst }
149
149
0 commit comments