[REBOL] Find problem from ports Re:
From: jsc:dataheaven at: 1-Oct-2000 1:32
IMHO you make too much assumptions on the IRC-protocoll in your parser.
Here's the more complete irc-parsing-function of my IRC-Bot:
parse-msg: func [str [string!]
/local _sender _par_tk _nick_tk _usr_tk _svr_tk _tpar_tk
_trl_tk _cmd_tk _white _nonwhite _parch _space
_middle _params _message] [
_white: charset [#" " #"^-" #"^@" #0 #"^M" #"^/"]
_nonwhite: complement _white
_parch: complement charset " ^-^@^M^/:"
_space: [some _white]
_middle: [_parch any _nonwhite]
_params: [_space [ copy _tpar_tk _middle (append _par_tk _tpar_tk)
_params | [#":" copy _trl_tk to end ]]]
_message: [opt [#":" [[copy _nick_tk to "!" skip
copy _usr_tk to "@" skip
copy _svr_tk to " " skip]
|copy _nick_tk to " " skip]]
copy _cmd_tk to " "
_params]
clear _par_tk: []
set [_nick_tk _usr_tk _svr_tk
_tpar_tk _trl_tk _cmd_tk] none
parse/all str _message
_sender: either _usr_tk [reduce ['nick _nick_tk
'user _usr_tk
'host _svr_tk]]
[_nick_tk]
make object! [
sender: _sender
command: _cmd_tk
parameters: copy _par_tk
trailing-arg: _trl_tk
]
]
It's not absolutely ready yet, but it works for all IRC-messages
On Sat, 30 Sep 2000, you wrote: