Janet 1.0.0-dev Documentation

PEG Module

See The peg documentation for more information.

Index

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 [,start=0])

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.