@@ -29,7 +29,6 @@ type input = {
29
29
(* {2 Output} *)
30
30
31
31
let add_warning input warning = input.warnings := warning :: ! (input.warnings)
32
-
33
32
let junk input = Stream. junk input.tokens
34
33
35
34
let peek input =
@@ -355,7 +354,8 @@ let paragraph : input -> Ast.nestable_block_element with_location =
355
354
fun acc ->
356
355
match npeek 2 input with
357
356
| { value = `Single_newline ws; location }
358
- :: { value = #token_that_always_begins_an_inline_element ; _ } :: _ ->
357
+ :: { value = #token_that_always_begins_an_inline_element ; _ }
358
+ :: _ ->
359
359
junk input;
360
360
let acc = Loc. at location (`Space ws) :: acc in
361
361
let acc = paragraph_line acc in
@@ -371,34 +371,34 @@ let paragraph : input -> Ast.nestable_block_element with_location =
371
371
(* {3 Helper types} *)
372
372
373
373
(* The interpretation of tokens in the block parser depends on where on a line
374
- each token appears. The five possible "locations" are:
375
-
376
- - [`At_start_of_line], when only whitespace has been read on the current
377
- line.
378
- - [`After_tag], when a valid tag token, such as [@deprecated], has been read,
379
- and only whitespace has been read since.
380
- - [`After_shorthand_bullet], when a valid shorthand list item bullet, such as
381
- [-], has been read, and only whitespace has been read since.
382
- - [`After_explicit_list_bullet], when a valid explicit bullet, such as [{li],
383
- has been read, and only whitespace has been read since.
384
- - [`After_text], when any other valid non-whitespace token has already been
385
- read on the current line.
386
-
387
- Here are some examples of how this affects the interpretation of tokens:
388
-
389
- - A paragraph can start anywhere except [`After_text] (two paragraphs cannot
390
- be on the same line, but paragraphs can be nested in just about anything).
391
- - [`Minus] is interpreted as a list item bullet [`At_start_of_line],
392
- [`After_tag], and [`After_explicit_list_bullet].
393
- - Tags are only allowed [`At_start_of_line].
394
-
395
- To track the location accurately, the functions that make up the block parser
396
- pass explicit [where_in_line] values around and return them.
397
-
398
- In a few cases, [where_in_line] can be inferred from what helper was called.
399
- For example, the [paragraph] parser always stops on the same line as the last
400
- significant token that is in the paragraph it consumed, so the location must
401
- be [`After_text]. *)
374
+ each token appears. The five possible "locations" are:
375
+
376
+ - [`At_start_of_line], when only whitespace has been read on the current
377
+ line.
378
+ - [`After_tag], when a valid tag token, such as [@deprecated], has been read,
379
+ and only whitespace has been read since.
380
+ - [`After_shorthand_bullet], when a valid shorthand list item bullet, such as
381
+ [-], has been read, and only whitespace has been read since.
382
+ - [`After_explicit_list_bullet], when a valid explicit bullet, such as [{li],
383
+ has been read, and only whitespace has been read since.
384
+ - [`After_text], when any other valid non-whitespace token has already been
385
+ read on the current line.
386
+
387
+ Here are some examples of how this affects the interpretation of tokens:
388
+
389
+ - A paragraph can start anywhere except [`After_text] (two paragraphs cannot
390
+ be on the same line, but paragraphs can be nested in just about anything).
391
+ - [`Minus] is interpreted as a list item bullet [`At_start_of_line],
392
+ [`After_tag], and [`After_explicit_list_bullet].
393
+ - Tags are only allowed [`At_start_of_line].
394
+
395
+ To track the location accurately, the functions that make up the block parser
396
+ pass explicit [where_in_line] values around and return them.
397
+
398
+ In a few cases, [where_in_line] can be inferred from what helper was called.
399
+ For example, the [paragraph] parser always stops on the same line as the last
400
+ significant token that is in the paragraph it consumed, so the location must
401
+ be [`After_text]. *)
402
402
type where_in_line =
403
403
[ `At_start_of_line
404
404
| `After_tag
@@ -438,7 +438,6 @@ type stopped_implicitly =
438
438
439
439
(* Ensure that the above two types are really subsets of [Token.t]. *)
440
440
let _check_subset : stops_at_delimiters -> Token.t = fun t -> (t :> Token.t )
441
-
442
441
let _check_subset : stopped_implicitly -> Token.t = fun t -> (t :> Token.t )
443
442
444
443
(* The different contexts in which the block parser [block_element_list] can be
@@ -907,8 +906,7 @@ let rec block_element_list :
907
906
|> accepted_in_all_contexts context
908
907
|> Loc. at location
909
908
in
910
- consume_block_elements ~parsed_a_tag `At_start_of_line
911
- (paragraph :: acc)
909
+ consume_block_elements ~parsed_a_tag `At_start_of_line (paragraph :: acc)
912
910
in
913
911
914
912
let where_in_line =
@@ -993,8 +991,7 @@ and explicit_list_items :
993
991
let next_token = peek input in
994
992
match next_token.value with
995
993
| `End ->
996
- Parse_error. not_allowed next_token.location
997
- ~what: (Token. describe `End )
994
+ Parse_error. not_allowed next_token.location ~what: (Token. describe `End )
998
995
~in_what: (Token. describe parent_markup)
999
996
|> add_warning input;
1000
997
(List. rev acc, next_token.location)
@@ -1043,8 +1040,7 @@ and explicit_list_items :
1043
1040
| `Right_brace -> junk input
1044
1041
| `End ->
1045
1042
Parse_error. not_allowed token_after_list_item.location
1046
- ~what: (Token. describe `End )
1047
- ~in_what: (Token. describe token)
1043
+ ~what: (Token. describe `End ) ~in_what: (Token. describe token)
1048
1044
|> add_warning input);
1049
1045
1050
1046
let acc = content :: acc in
@@ -1092,7 +1088,7 @@ let parse warnings tokens =
1092
1088
in
1093
1089
1094
1090
junk input;
1095
- elements @ block :: parse_block_elements ()
1091
+ elements @ ( block :: parse_block_elements () )
1096
1092
in
1097
1093
let ast = parse_block_elements () in
1098
1094
(ast, List. rev ! (input.warnings))
0 commit comments