aboutsummaryrefslogtreecommitdiff
path: root/lib/IRC/Grammar
diff options
context:
space:
mode:
authorZoffix Znet <cpan@zoffix.com>2015-12-06 15:05:29 -0500
committerZoffix Znet <cpan@zoffix.com>2015-12-06 15:05:29 -0500
commitba793ec6d1d4c66300f40cbced25f9ffd23ec792 (patch)
treebc419699af8499c4b90026d605f72aa832325ef5 /lib/IRC/Grammar
parente0b2a598b9475edcfca40b7cb4faa7746232a30c (diff)
Debug
Diffstat (limited to 'lib/IRC/Grammar')
-rw-r--r--lib/IRC/Grammar/Actions.pm630
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/IRC/Grammar/Actions.pm6 b/lib/IRC/Grammar/Actions.pm6
index 039f11e..7093b99 100644
--- a/lib/IRC/Grammar/Actions.pm6
+++ b/lib/IRC/Grammar/Actions.pm6
@@ -1,6 +1,26 @@
-class IRC::Grammar::Actions {
- method class ($/) { $/.make: ~$/ }
- method rules ($/) { $/.make: ~$/ }
- method pair ($/) { $/.make: $<class>.made => $<rules>.made }
- method TOP ($/) { $/.make: $<pair>».made }
+unit class IRC::Grammar::Actions:ver<1.001001>;
+method TOP ($/) { $/.make: $<message>>>.made }
+method message ($/) {
+ my $pref = $/<prefix>;
+ my %args = command => ~$/<command>;
+ if ( $pref<servername>.defined ) {
+ %args<who><host> = ~$pref<servername>;
+ }
+ else {
+ %args<who><nick user host> = $pref<nick user host>».Str;
+ }
+
+ my $p = $/<params>;
+ loop {
+ if ( $p<middle>.defined ) {
+ %args<params>.append: ~$p<middle>;
+ }
+ if ( $p<trailing>.defined ) {
+ %args<params>.append: ~$p<trailing>;
+ last;
+ }
+ $p = $p<params>;
+ }
+
+ $/.make: %args;
}