]> gitweb.factorcode.org Git - factor.git/blob - unmaintained/irc-ui/commandparser/commandparser.factor
Factor source files should not be executable
[factor.git] / unmaintained / irc-ui / commandparser / commandparser.factor
1 ! Copyright (C) 2008 William Schlieper\r
2 ! See http://factorcode.org/license.txt for BSD license.\r
3 \r
4 USING: kernel vocabs.loader sequences strings splitting words irc.messages ;\r
5 \r
6 IN: irc.ui.commandparser\r
7 \r
8 : command ( string string -- string command )\r
9     [ "say" ] when-empty\r
10     dup "irc.ui.commands" lookup\r
11     [ nip ]\r
12     [ " " append prepend "quote" "irc.ui.commands" lookup ] if* ;\r
13 \r
14 : parse-message ( string -- )\r
15     "/" ?head [ " " split1 swap command ] [ "say" command ] if execute ;\r