From 121731baf33064577dfea15976489cf64ef5fb8e Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Mon, 19 Apr 2021 22:13:35 +0200
Subject: Initial commit
---
lib/IRC/Grammar.pm6 | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
create mode 100644 lib/IRC/Grammar.pm6
(limited to 'lib/IRC/Grammar.pm6')
diff --git a/lib/IRC/Grammar.pm6 b/lib/IRC/Grammar.pm6
new file mode 100644
index 0000000..f859edc
--- /dev/null
+++ b/lib/IRC/Grammar.pm6
@@ -0,0 +1,51 @@
+#! /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
--
cgit v1.1