Module For_testing.Parse_queue

val sexp_of_token_with_loc : token_with_loc -> Sexplib0.Sexp.t
val throw_error_for_token : f:(Css_parser_common.Token.t -> string) -> token_with_loc -> 'a
val raise : loc:Css_parser_common.Location.t -> string -> 'a
val raise_no_location : string -> 'a
module Match : sig ... end
module Typed_match : sig ... end
type t
val of_list : parsing_config:Parsing_config.t -> token_with_loc list -> t
val to_list : t -> token_with_loc list
val dequeue : t -> token_with_loc option
val drain : while_:(token_with_loc -> bool) -> f:(token_with_loc -> unit) -> t -> unit
val dequeue_exn : ?error_msg:string Core.Lazy.t -> t -> token_with_loc
val dequeue_if_matches : f:Match.t -> t -> bool
val dequeue_and_ignore_exn : t -> unit
val dequeue_and_ignore_if_matches : f:Match.t -> t -> unit
val require_next_token_to_match : matches:'a Typed_match.t -> error_msg:(Css_parser_common.Token.t -> string) -> t -> 'a * Css_parser_common.Location.t
val dequeue_and_check_if_next_token_matches : matches:Match.t -> t -> bool
val require_next_token_to_match_and_ignore : matches:Match.t -> error_msg:(Css_parser_common.Token.t -> string) -> t -> unit
val peek : t -> token_with_loc option
val peek_exn : t -> token_with_loc
val peek_token : t -> Css_parser_common.Token.t option
val peek_token_exn : t -> Css_parser_common.Token.t
val get_nth_token_exn : n:int -> t -> Css_parser_common.Token.t
val process : while_:Match.t -> f:(Css_parser_common.Token.t -> unit) -> t -> unit

Unlike drain, process does not dequeue the token. Preventing infinite loops by making sure that the first element in the queue is not the same as in the last loop using phys_equal. This is __very__ rudimentary, but good enough for the CSS parsers needs

val fold_until : t -> init:'a -> f: ('a -> (token_with_loc -> ('a, 'b) Base.Continue_or_stop.t) @ local) @ local -> (finish:('a -> 'b) @ local -> 'b) @ local
val throw_error_if_next_token_matches : error_msg:string -> f:Match.t -> t -> unit
val maybe_throw_ocaml_code_error : t -> unit
val process_into_list : ?allow_ocaml_code:bool -> while_:Match.t -> f:(Css_parser_common.Token.t -> 'a option) -> t -> 'a list
val consume_and_ignore : while_matches:Match.t -> t -> unit
val consume_and_ignore_whitespaces : t -> unit
val consume_comments_only : t -> (string * Css_parser_common.Location.t) list
val handle_recoverable_error : t -> Recoverable_error.t -> unit
val consume_comment_and_whitespace : t -> [ `Comment of string * Css_parser_common.Location.t | `Whitespace of Css_parser_common.Location.t ] list
val consume_comments_and_ignore_whitespaces : t -> (string * Css_parser_common.Location.t) list
val with_context : Css_parser_common.Context.t -> f:(t -> 'a) -> t -> 'a

Wrap f by pushing then popping a Context.t from the context stack

val with_loc : ?context:Css_parser_common.Context.t option -> f:(t -> 'a) -> t -> ('a * Css_parser_common.Location.t) option

with_loc retrieves the location of the next token before f is run, and then the location of the last token that was processed after f is run. Optionally, wrap the inner call to f with with_context if a Context.t is provided.

This function should _never_ mutate tokens itself, only f should mutate tokens

val with_loc_exn : ?context:Css_parser_common.Context.t option -> here:lexing_position -> f:(t -> 'a) -> t -> 'a * Css_parser_common.Location.t