package pacomb
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=17df1ee094890404ec4110f097ac1ab6
sha512=2046537f5dabbe5598c094c4b4e645cd2a4eeb4b3d7fe8fde39659df3398675831f11d2ae3e86069e8a8c350c0725e0299c1571eed2a938f2a3d0c1cc5330804
doc/pacomb/Pacomb/Charset/index.html
Module Pacomb.CharsetSource
A module providing efficient character sets.
Type
The abstract type for a character set.
Charset construction
range cmin cmax returns the charset containing all the characters between cmin and cmax.
from_string s returns the charset corresponding to the description string s, which may contain standalone characters (different from '-', which is only allowed as first character) or ranges. They are build of start and end characters, separated by '-'. An example of a valid description is "-_a-zA-Z0-9". Note that Invalid_argument is raised in case of ill-formed description.
union cs1 cs2 builds a new charset that contins the union of the characters of cs1 and cs2.
inter cs1 cs2 builds a new charset that contins the intersection of the characters of cs1 and cs2.
complement cs returns a new charset containing exactly characters that are not in cs.
add cs c returns a new charset containing the characters of cs and the character c.
del cs c returns a new charset containing the characters of cs but not the character c.
Membership test
Printing and string representation
pp ff cs prints the charset cs to output formatter ff. Compact format is used for printing: ranges, full and empty charsets are not given in full, but abbreviated.
pp_full ff cs is similar to pp ff cs, but it does not abbreviate ranges, full and empty charsets.
show oc cs builds a string representing the charset cs using the same compact format as print.
show_full oc cs is the same as show oc cs but it does not use abreviations (i.e. all characters appear).
Manipulating charsets imperatively
addq cs c adds the character c to the charset cs. Users must be particularly careful when using this function. In particular, it should not be used directly on empty, full or the result of the singleton function as it would change their value permanently. It is advisable to prefer the use of add or to work on a copy.
delq cs c deletes the character c from the charset cs. Similar recomendatiosn as for addq apply.
Comparison and equality test
compare cs1 cs2 compares the charsets cs1 and cs2 according to some (unspecified) total order.