From 21258ec3e64b5d1d909a0853cb0f530bb1cc0fa5 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Wed, 17 Aug 2016 19:22:54 +0200 Subject: Wrote a proper IRC parser There are limitations : currently the parser would loop infinitely if there were no \r\n (but the c wrapper would catch that), or if there were no spaces, and it would miss the cmd and params starting char if they were separated by more than one space. Those caveats aside, it works great! And that's more than enough for now. --- bot.b98 | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/bot.b98 b/bot.b98 index 3252448..4834fa1 100644 --- a/bot.b98 +++ b/bot.b98 @@ -1,6 +1,19 @@ - #;>:#,_e-j; "PASS my_secrets"da - #;>:#,_e-j; "NICK b98"da - #;>:#,_e-j; "USER b98 0 0 b98"da - #;>:#,_e-j; "JOIN #test"da - > >~:'P-#v_~'I-#v_~'N-#v_~'G-#v_ $ ad"uoarg GNOP"ck,v - ^$ <# < < < < +< v < > #;>:#,_e-j; "PASS my_secrets"da p300 + #;>:#,_e-j; "NICK b98"da +;v;<; < > #;>:#,_e-j; "USER b98 0 0 b98"da +#####;len,pos,cmd,params,counter; +################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ + v < p300< < + v_d03g2-4g-| > 13gv + ~ vp320p310< |+1g31g4p31-1: ;>3g23pv;# <^ ,kg30< + 0a3| 1v < ; + 3p3>v_^v_13g33p23g:1+13p4g'0-#v_13g:1+13p4g'0-#v_13g:1+13p4g'1-#v_ad"tset# nioj"bk,^ + g4p#1- 1-v < < < + :p0-3 3 >23g:1+13p4g'P-#v_13g:1+13p4g'I-#v_13g:1+13p4g'N-#v_13g:1+13p4g'G-#v_13g:1+13p4g' -#v_'O14p^ + 134:g' g' ;v < < < < < + +0g':g :g ^< + >^>^14 14 + +p +p + 13 13 + >^ >^ -- cgit v1.2.3