Skip to content

Commit

Permalink
Remove support for variant and tuple internal parser ops
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonidas-from-XIV committed Dec 27, 2022
1 parent f916c96 commit 9482492
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/read.mli
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ val map_ident :
lexer_state -> (string -> int -> int -> 'a) -> Lexing.lexbuf -> 'a
(* equivalent to read_ident *)

type variant_kind = [ `Edgy_bracket | `Square_bracket | `Double_quote ]
type variant_kind = [ `Square_bracket | `Double_quote ]

val start_any_variant : lexer_state -> Lexing.lexbuf -> variant_kind
val read_lt : lexer_state -> Lexing.lexbuf -> unit
Expand Down
4 changes: 1 addition & 3 deletions lib/read.mll
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
let len = lexbuf.lex_curr_pos - lexbuf.lex_start_pos in
f (Bytes.sub_string lexbuf.lex_buffer lexbuf.lex_start_pos len) 0 len

type variant_kind = [ `Edgy_bracket | `Square_bracket | `Double_quote ]
type variant_kind = [ `Square_bracket | `Double_quote ]
type tuple_kind = [ `Parenthesis | `Square_bracket ]
}

Expand Down Expand Up @@ -364,7 +364,6 @@ and read_comma v = parse
| eof { custom_error "Unexpected end of input" v lexbuf }

and start_any_variant v = parse
'<' { `Edgy_bracket }
| '"' { Buffer.clear v.buf;
`Double_quote }
| '[' { `Square_bracket }
Expand Down Expand Up @@ -624,7 +623,6 @@ and read_colon v = parse
| eof { custom_error "Unexpected end of input" v lexbuf }

and start_any_tuple v = parse
'(' { false }
| '[' { true }
| _ { long_error "Expected '(' or '[' but found" v lexbuf }
| eof { custom_error "Unexpected end of input" v lexbuf }
Expand Down
2 changes: 0 additions & 2 deletions test/testable.ml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
let yojson = Alcotest.testable Yojson.Safe.pp Yojson.Safe.equal

let variant_kind_pp fmt = function
| `Edgy_bracket -> Format.fprintf fmt "`Edgy_bracket"
| `Square_bracket -> Format.fprintf fmt "`Square_bracket"
| `Double_quote -> Format.fprintf fmt "`Double_quote"

let variant_kind_equal a b =
match (a, b) with
| `Edgy_bracket, `Edgy_bracket -> true
| `Square_bracket, `Square_bracket -> true
| `Double_quote, `Double_quote -> true
| _ -> false
Expand Down

0 comments on commit 9482492

Please sign in to comment.