Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Created June 6, 2021 08:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sogaiu/8ae759e1affcf588f6113b1f503a2d92 to your computer and use it in GitHub Desktop.
Save sogaiu/8ae759e1affcf588f6113b1f503a2d92 to your computer and use it in GitHub Desktop.
janet peg peg/match struct example
(first
(peg/match ~(cmt (sequence (capture "hello")
(some (set " ,"))
(capture "world"))
,(fn [cap1 cap2]
{:greeting cap1 :name cap2}))
"hello, world"))
# => {:greeting "hello" :name "world"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment