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 parse2 | |
(:refer-clojure :exclude [char]) | |
(:require [clojure.core :as core] | |
[clojure.string :as str] | |
[clojure.java.io :as io] | |
[zetta.core :as z] | |
[zetta.parser.seq :as s] | |
[zetta.combinators :as c]) | |
(:use [zetta.core :only [<$> <* *> <|> do-parser]])) |
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)) | |
(def id4 | |
(around |
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
;Hrm... I actually tried a similar approach before but: | |
(def identifier2 | |
(around | |
whitespaces | |
(choice | |
[(*> (string "#") | |
(<* number (string "#"))) | |
(*> (string "#") | |
(<* number (string "=")))]))) |
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
(def identifier | |
(around | |
whitespaces | |
(choice | |
[(<$> (partial apply vector) | |
(*> (string "#") | |
(<* number (string "#")))) | |
; ^ I think you should be using just number here right? | |
; you are trying to parse (many1 digit) | |
(<$> (partial apply vector) |