package css

  1. Overview
  2. Docs
CSS parser and printer

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ocaml-css-0.4.0.tar.bz2
md5=d402b78761349700da30c192ab9735a3
sha512=9f0ebbf61b37a4df23e3d88fec450ceb75c601b07ae5c52a133c803ba919266fa0cf257b72e43797741e1cd56d651b08a68d1be4ef1fd3fea32857989ff2ca9c

doc/css/Css/U/index.html

Module Css.USource

Utilities for parsing.

Sourceval is_prefix : s:string -> pref:string -> bool
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.

Sourceval handle_end : (T.ctx -> 'a Angstrom.t) -> T.ctx -> 'a Angstrom.t

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 lt : T.ctx -> char Angstrom.t
Sourceval lte : T.ctx -> char Angstrom.t
Sourceval gt : T.ctx -> char Angstrom.t
Sourceval gte : 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

Strings

Sourceval quote_string : string -> string