pelecanus v0.4.0 Pelecanus.TerminalSymbol

Terminal Symbol parsing You can use regex.

Pelecanus provide useful sigil ~p, which replace term/1. See also Pelecanus module.

Link to this section Summary

Functions

Returns a parser which succeeds if given regex match

returns a parser use regex which compiled from given source and opts

Similar to term/1, but doesn’t recompile given regex

Link to this section Functions

Link to this function term(pattern \\ ~r"\\S*"us)
term(Regex.t()) :: Pelecanus.parser()

Returns a parser which succeeds if given regex match

The parser return {:ok, next_state, matched_string} if it succeeds.

This function insert \A into given regex. So parser this function returns always match at the offset position of input string.

next_state are incremented its offset by matched_string’s length. Note that this length is not codepoints count. This means, if you take only a part of Combining Character Sequence and leave rest, parsing result will be broken.

Link to this function term(source, opts)

returns a parser use regex which compiled from given source and opts

opts is binary Regex.opts/1 returns.

Link to this function term_raw(reg)
term_raw(Regex.t()) :: Pelecanus.parser()

Similar to term/1, but doesn’t recompile given regex