razom-text-util-0.1.2.0: Common text/parsing tools for Razom language packages.

Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Razom.Uid

Synopsis

Documentation

uid :: Regex String Source

Regex which matches and returns a Uid, unescaped and with delimiters removed.

>>> match uid "<12<34\\>56\\\\7>"
Just "12<34>56\\7"

generator :: Regex String Source

Regex which matches and returns a Uid generator, without delimiters and the leading prefix character.

>>> match generator "<%>"
Just ""
>>> match generator "<%mylabel>"
Just "mylabel"

escapeUid :: String -> String Source

Convert a Uid string into a form which can be put in a semantic document. It doesn't add delimiters.

>>> escapeUid "1>2\\3"
"1\\>2\\\\3"

To prevent confusion, the above is the same as:

['1', '\\', '>', '2', '\\', '\\', '3']

unescapeUid :: String -> String Source

Convert a Uid as encoded in a semantic document into normal form, i.e. converting escape sequences to their target characters.

>>> unescapeUid "1\\>2\\\\3"
"1>2\\3"