Your absolutely right - I made my ircparser very simple for the bots
messages it recieves in the input-buffer based on what I am trying to
achieve.  I do intend to make a full fledged ircparser soon for my script
but more importantly as a full irc compliant client in accorance with RFC
1459.  I will also include ident server also when I am done.  I did find
that it wasnt a problem with find it was that I had received a message that
didnt contain the "!" in the parse.  It presented the problem.  I fixed it
with an if function to check for "!" before ircparsing.  I have been very
selective on the which incoming messages I use this ircparser function as I
have other functions for different messages.

I appreciate your input.  Very helpful.

Paul Tretter


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 30, 2000 6:32 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] Find problem from ports Re:


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:
> I was creating a script for IRC when I noticed that the find command
> doesn't seem to work right from reading the port and parsing the data but
> does when reading from the console with the same functions.  I am reading
> in a typical message string into iput-buffer for example (Port is opening
a
> port to irc):
>
> ircparser: func [/local a b c][
>     a: parse/all copy input-buffer "!"
>     sendnick: pick a 1
>     b: pick a 2
>     print b
>     sendmsg: find b ":"
>     print sendmsg
>     c: parse copy input-buffer
>     senduser: pick c 2
>     sendcmd: pick c 3
>     sendchan: pick c 4
> ]
>
> while [true][
>
>   wait port
>
>   input-buffer: copy first port
>
>   if find/part input-buffer ":" 1 [
>      input-buffer: remove head input-buffer
>      ircparser
>   ]
>
> _________________________________ Console Windows _______________
> NOTICE AUTH :*** Looking up your hostname...
> NOTICE AUTH :*** Found your hostname, cached
> NOTICE AUTH :*** Checking Ident
> NOTICE AUTH :*** No Ident response
> none
> ** Script Error: find expected series argument of type: series port
bitset.
> ** Where: sendmsg: find b ":"
> print
>
> ________________________________________________________________
>
> Anyone know what the problem is?
>
> Seems to work ok if I recreate the issue from the console.

Reply via email to