Created
September 2, 2012 09:44
-
-
Save LunaBorowska/3596279 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
grammar RawEvent { | |
token TOP { | |
^ | |
[':' [<user>|<server=host>] <.space> || <?>] | |
<command> | |
[ <.space>+ [':'$<params>=(.*)$ || $<params>=<-space>+] ]* | |
$ | |
} | |
token user { | |
$<nick>=<-[:!]>+ '!' $<ident>=<-[@]>+ '@' <host> | |
} | |
token host { | |
#[ <-space - [. $ @ !]>+ ] ** '.' | |
#Due to some IRC servers/services allowing anything as a host format, | |
#I've decided to define a 'host' as 'anything but a space'. Bah. | |
<-space>+ | |
} | |
token command { | |
<.alpha>+ | \d\d\d | |
} | |
token params { | |
[ ':'.*$ | <-space>+ ] | |
} | |
} | |
print RawEvent.parse(':moorcock.freenode.net 004 SixtySixBot moorcock.freenode.net ircd-seven-1.1.3 DOQRSZaghilopswz CFILMPQbcefgijklmnopqrstvz bkloveqjfI') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment