PageRenderTime 33ms CodeModel.GetById 25ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/unmaintained/irc-ui/commandparser/commandparser.factor

http://github.com/abeaumont/factor
Unknown | 15 lines | 11 code | 4 blank | 0 comment | 0 complexity | 52eb8c0fd870f1fe8135bdad655752d3 MD5 | raw file
 1! Copyright (C) 2008 William Schlieper
 2! See http://factorcode.org/license.txt for BSD license.
 3
 4USING: kernel vocabs.loader sequences strings splitting words irc.messages ;
 5
 6IN: irc.ui.commandparser
 7
 8: command ( string string -- string command )
 9    [ "say" ] when-empty
10    dup "irc.ui.commands" lookup
11    [ nip ]
12    [ " " append prepend "quote" "irc.ui.commands" lookup ] if* ;
13
14: parse-message ( string -- )
15    "/" ?head [ " " split1 swap command ] [ "say" command ] if execute ;