-
-
Save roman/2339136 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns blah | |
(:use [zetta.parser.seq :only (whitespace number char)] | |
[zetta.combinators :only (choice around)] | |
[zetta.core :only (*>, <*)]) | |
(:require [zetta.core :as z])) | |
(def whitespaces (many whitespace)) | |
; For that you should use parser combinators and the monadic interface! | |
; if you have conditionals in your parser, this is the way to go | |
(def id5 | |
(z/do-parser [ | |
_ (char \#) | |
n number | |
symb (<|> (char \#) (char \=))] | |
(if (= symb \#) | |
[:ref n] | |
[:def n]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment