-
-
Save takeoutweight/2338894 to your computer and use it in GitHub Desktop.
This file contains hidden or 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) | |
| (*> (string "#") | |
| (<* number (string "="))))]))) | |
| ; ^ same applies here |
(def id3
(around whitespaces (*> (char \#)
(<* number (choice [(char \=)
char \#)])))))Try this one out
Author
Yep that parses for me now. Am I able to distinguish between which choice is made with this approach? (i.e I want #'s to mean reference ids and ='s to mean id definitions)
I guess the trick would be not to throw away the parsed = and #, but throw the number and the matched char to a higher function with <$> ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you change the order on the choice vector, the = works but the # doesn't...
uhmm it seems we have an issue here with the buffer not having the content back after going to the next choice :-/
Need to figure out why that's happening