package css

  1. Overview
  2. Docs
CSS parser and printer

Install

Dune Dependency

Authors

Maintainers

Sources

ocaml-css-0.3.0.tar.bz2
md5=70981bffdf5df82fd8ed20eb61b62e4d
sha512=45083ab20d89e3289bfdee0eb32717b8e37f7b0aedf6652afaa7a96008c9b35981c451be82d63d070e27c7ec0087619f2c0271301645907a8897163b8f49fd3d

doc/css/Css/U/index.html

Module Css.USource

Utilities for parsing.

Sourceval remove_options : 'a option list -> 'a list
Sourceval with_loc : T.ctx -> 'a Angstrom.t -> ('a * T.loc) Angstrom.t
Sourceval is_hex : char -> bool
Sourceval is_digit : char -> bool
Sourceval fail_at : T.ctx -> T.parse_error -> 'a

Parser failing with the given message where current position is added.

Sourceval parse_error_at : T.ctx -> T.parse_error -> 'a Angstrom.t

parse_error ctx e raises a T.Error with a parse error e and last position of ctx.

Sourceval string_of_char_list : char list -> string

Util parsers

Sourceval opt_ : 'a Angstrom.t -> 'a option Angstrom.t

opt_ p returns None if p fails, else return Some r where r is the result of p.

Sourceval take_char : char option Angstrom.t

take_char is a parser returning None is there is no more char, else accept any character c, Angstrom.advance by 1 char and returns Some c.

Sourceval take_while_upto : (char -> bool) -> int -> string Angstrom.t

take_while_upto pred n accepts at most n characters or as long a pred returns true. Returns accepted characters as a string.

Sourceval take_while1_upto : (char -> bool) -> int -> string Angstrom.t

Same as take_while_upto but fails if no character is available.

Sourceval comment : T.ctx -> string Angstrom.t

Accept a comment.

Sourceval is_ws : char -> bool
Sourceval ws : T.ctx -> string Angstrom.t

ws ctx accepts any number of white spaces or comments.

Parser combinators

Sourceval map_fst : ('a -> ('b * 'c) Angstrom.t) -> 'a -> 'b Angstrom.t
Sourceval (&&&) : 'a Angstrom.t -> 'b Angstrom.t -> ('a * 'b) Angstrom.t

p1 &&& p2 returns a parser succeeding when p1 and p2 succeed, in any order.

Sourceval (|||) : 'a Angstrom.t -> 'b Angstrom.t -> ('a option * 'b option) Angstrom.t

p1 ||| p2 returns a parser accepting values for p1 or p2 or both.

Sourceval alt_1_2 : 'a -> 'a Angstrom.t -> 'b -> 'b Angstrom.t -> ('a * 'b) Angstrom.t

alt_1_2 def1 p1 def2 p2 is the same as (|||) but returns the provided default values for each parser.

Predefined character parsers

All these parser accept a character after optional white spaces or comments.

Sourceval lchar : char -> T.ctx -> char Angstrom.t
Sourceval lbracket : T.ctx -> char Angstrom.t
Sourceval rbracket : T.ctx -> char Angstrom.t
Sourceval lbrace : T.ctx -> char Angstrom.t
Sourceval rbrace : T.ctx -> char Angstrom.t
Sourceval lpar : T.ctx -> char Angstrom.t
Sourceval rpar : T.ctx -> char Angstrom.t
Sourceval dot : T.ctx -> char Angstrom.t
Sourceval colon : T.ctx -> char Angstrom.t
Sourceval semicolon : T.ctx -> char Angstrom.t
Sourceval ampersand : T.ctx -> char Angstrom.t
Sourceval comma : T.ctx -> char Angstrom.t
Sourceval dquote : T.ctx -> char Angstrom.t
Sourceval quote : T.ctx -> char Angstrom.t
Sourceval plus : T.ctx -> char Angstrom.t
Sourceval minus : T.ctx -> char Angstrom.t
Sourceval pipe : T.ctx -> char Angstrom.t
Sourceval sharp : T.ctx -> char Angstrom.t
Sourceval slash : T.ctx -> char Angstrom.t
Sourceval gt : T.ctx -> char Angstrom.t
Sourceval tilde : T.ctx -> char Angstrom.t

Parsing integers and sign

Sourceval sign : T.ctx -> char Angstrom.t
Sourceval integer : T.ctx -> int Angstrom.t
OCaml

Innovation. Community. Security.