Skip to content

Commit

Permalink
address review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lubegasimon committed Nov 30, 2023
1 parent f7fa297 commit 6d728a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/parser/parse_error.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ let truncated_code_block_meta : Loc.span -> Warning.t =
let truncated_code_block : Loc.span -> Warning.t =
Warning.make ~suggestion:"add ']}'." "Missing end of code block."

let unclosed_table : Loc.span -> Warning.t =
Warning.make ~suggestion:"try to add '}' at the end of table content."
"Unclosed table '{t ...' or '{table ...'"
let invalid_table_syntax : ?suggestion:string -> Loc.span -> Warning.t =
fun ?suggestion ->
Warning.make ?suggestion "Unclosed table '{t ...' or '{table ...'"
7 changes: 5 additions & 2 deletions src/parser/syntax.ml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ module Reader = struct
junk input;
`End (acc, next_token.location)
| `End ->
Parse_error.unclosed_table next_token.location |> add_warning input;
Parse_error.invalid_table_syntax next_token.location
~suggestion:"try to add '}' at the end of table content."
|> add_warning input;
junk input;
`End (acc, next_token.location)
| `Space _ | `Single_newline _ | `Blank_line _ ->
Expand Down Expand Up @@ -1345,7 +1347,8 @@ and light_table_row ~parent_markup ~last_loc input =
let next_token = peek input in
match next_token.value with
| `End ->
Parse_error.unclosed_table next_token.location |> add_warning input;
Parse_error.invalid_table_syntax next_token.location
|> add_warning input;
junk input;
(`Stop, return acc_row acc_cell, next_token.location)
| `Right_brace ->
Expand Down

0 comments on commit 6d728a9

Please sign in to comment.