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

http://github.com/abeaumont/factor · Factor · 15 lines · 9 code · 4 blank · 2 comment · 4 complexity · 52eb8c0fd870f1fe8135bdad655752d3 MD5 · raw file

  1. ! Copyright (C) 2008 William Schlieper
  2. ! See http://factorcode.org/license.txt for BSD license.
  3. USING: kernel vocabs.loader sequences strings splitting words irc.messages ;
  4. IN: irc.ui.commandparser
  5. : command ( string string -- string command )
  6. [ "say" ] when-empty
  7. dup "irc.ui.commands" lookup
  8. [ nip ]
  9. [ " " append prepend "quote" "irc.ui.commands" lookup ] if* ;
  10. : parse-message ( string -- )
  11. "/" ?head [ " " split1 swap command ] [ "say" command ] if execute ;