#! /usr/bin/env false use v6.d; unit grammar IRC::Grammar; regex TOP { [ ':' <.ws> ]? <.ws> * % <.ws> # Use an OPTIONAL crlf, as opposed to RFC 2812's required crlf, to make # it easier for people to use this in regular programs, where they're # more likely to encounter the IRC messages without \r\n. "\r\n"? } token prefix { [ [ '!' ]? '@' ]? | } token command { \d ** 3 | \w+ } token middle { <.nospcrlfcl>+ } token params { <.middle> | [ ':' <( )> ] } token trailing { <-[ \0 \r \n ]>* } token nickname { [ \w | ] [ \w | \d | | '-' ]* } token special { <[ [ \] \\ ` _ ^ { | } ]>+ } token user { <-[ \r \n \s @ ]>+ } token host { | } token hostname { [ '.' ]* '.'? } token hostaddr { | } token ip4addr { [ \d ** 1..3 ] ** 4 % '.' } token ip6addr { [ <[ \d a..f A..F ]> ** 1..4 ] ** 8 % ':' } token shortname { <[ \w \d / ]> <[ \w \d / \- ]>* <[ \w \d / ]>? } token nospcrlfcl { <-[ \0 \r \n \s : ]> } =begin pod =NAME IRC::Grammar =AUTHOR Patrick Spek <~tyil/raku-devel@lists.sr.ht> =VERSION 0.0.0 =head1 Synopsis =head1 Description =head1 Examples =head1 See also =end pod # vim: ft=perl6 noet