irc.messages.parser: simplify parser
parent
334477d94a
commit
2d5368f4af
|
@ -9,20 +9,14 @@ IN: irc.messages.parser
|
||||||
: split-at-first ( seq separators -- before after )
|
: split-at-first ( seq separators -- before after )
|
||||||
dupd '[ _ member? ] find [ cut rest ] [ swap ] if ;
|
dupd '[ _ member? ] find [ cut rest ] [ swap ] if ;
|
||||||
|
|
||||||
: split-trailing ( string -- string string/f ) ":" split1 ;
|
! ":ircuser!n=user@isp.net JOIN :#factortest"
|
||||||
: remove-heading-: ( seq -- seq ) ":" ?head drop ;
|
|
||||||
|
|
||||||
: split-prefix ( string -- string/f string )
|
|
||||||
dup ":" head? [
|
|
||||||
remove-heading-: " " split1
|
|
||||||
] [ f swap ] if ;
|
|
||||||
|
|
||||||
: split-message ( string -- prefix command parameters trailing )
|
: split-message ( string -- prefix command parameters trailing )
|
||||||
split-prefix split-trailing
|
":" ?head [ " " split1 ] [ f swap ] if
|
||||||
[ [ blank? ] trim " " split unclip swap ] dip ;
|
":" split1
|
||||||
|
[ " " split harvest unclip swap ] dip ;
|
||||||
|
|
||||||
: sender ( irc-message -- sender )
|
: sender ( irc-message -- sender )
|
||||||
prefix>> [ remove-heading-: "!" split-at-first drop ] [ f ] if* ;
|
prefix>> [ ":" ?head drop "!" split-at-first drop ] [ f ] if* ;
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: string>irc-message ( string -- irc-message )
|
: string>irc-message ( string -- irc-message )
|
||||||
|
|
Loading…
Reference in New Issue