Janet 1.3.1 Documentation

PEG Module

See The peg documentation for more information.


peg/compile peg/match

peg/compile cfunction
(peg/compile peg)

Compiles a peg source data structure into a <core/peg>. This will speed up matching if the same peg will be used multiple times.

peg/match cfunction
(peg/match peg text &opt start & args)

Match a Parsing Expression Grammar to a byte string and return an array of captured values. Returns nil if text does not match the language defined by peg. The syntax of PEGs are very similar to those defined by LPeg, and have similar capabilities.