Package pyfics :: Package parser :: Module ficsparser
[hide private]

Module ficsparser

source code

Fics parser module for pyfics

This module has necessary parsers to parse Fics output and generate pyparsing.ParserResult objects

Classes [hide private]
  SanitizeNewline
Convert server's line sep to
  ToInteger
Converter to make token into an integer.
Functions [hide private]
 
on_login(s, loc, toks)
Callback function called when login parser matches.
source code
 
on_password(s, loc, toks)
Callback function called when password parser matches.
source code
 
on_sessionstart(s, loc, toks)
Callback function called when sessionstart parser matches.
source code
 
on_invalidlogin(s, loc, toks)
Callback function called when invalidlogin parser matches.
source code
 
on_invalidpass(s, loc, expr, err)
Callback function called when invalidpass parser matches.
source code
 
parse(line)
Return default parser
source code
Variables [hide private]
  beginbr = Suppress:("(")
  endbr = Suppress:(")")
  handle = W:(abcd...)
  tag = {{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppress:("...
  line = Re:('.*')
  ivars_set = "#Ivars set."
  stars = Suppress:("****")
  telnet_seq = Suppress:({{"\xff" Re:('[\xfb\xfc]')} ""})
  integer = ToInteger:(W:(0123...))
  wrap = Suppress:("\ ")
  ch = {{Suppress:("(") ToInteger:(W:(0123...))} Suppress:(")")}
  rating = Re:('[\\d\\+]{1,4}')
  rating_ex = Re:('[\\d]{1,4}[PE ]')
  result = Re:('1\\-0|0\\-1|1\\/2\\-1\\/2|\\*')
  rated = Re:('[ru]')
  tp = Re:('blitz|standard')
  colour = Re:('\\?|white|black')
  auto = Re:('[tf]')
  formula = Re:('[tf]')
  nick = {W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\...
  eol = {Suppress:({LineEnd LineStart}) [Suppress:("\ ")]}
  msg = {Re:('.*') [{{Suppress:({LineEnd LineStart}) [Suppress:(...
  say = {{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\...
  tell = {{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|...
  ctell = {{{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|...
  qtell = {":" {Re:('.*') [{{Suppress:({LineEnd LineStart}) [Sup...
  shout = {{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U...
  cshout = {{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|...
  it = {{"-->" {W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|...
  state = Re:('arrived|departed')
  notify = {{{{"Notification:" {W:(abcd...) [{{{Suppress:("(") R...
  msgs = {{{{{"You have" ToInteger:(W:(0123...))} "messages"} Su...
  adj = {{"You have" ToInteger:(W:(0123...))} "adjourned games."}
  inc = {"Present company includes:" {W:(abcd...)}...}
  si = {{{{{{{{{{{{{{{{{{{{{{{{{"<s>" ToInteger:(W:(0123...))} "...
  sr = {"<sr>" {ToInteger:(W:(0123...))}...}
  login = "login: "
  password = "password: "
  invalidlogin = Re:('Press\\ return\\ to\\ enter\\ the\\ server...
  invalidpass = {{Suppress:("****") "Invalid password!"} Suppres...
  sessionstart = {{{{Suppress:("****") "Starting FICS session as...
  unknown = Re:('.*')
  authparser = {{{{{{"login: " | "password: "} | {{{{Suppress:("...
  parser = {{{{{{{{{{{{{{{{"You have" ToInteger:(W:(0123...))} "...
  mainparser = {{{{{{"login: " | "password: "} | {{{{Suppress:("...
Variables Details [hide private]

tag

Value:
{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppress:(")")}

nick

Value:
{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppress:(\
")")}}...]}

msg

Value:
{Re:('.*') [{{Suppress:({LineEnd LineStart}) [Suppress:("\   ")]} Re:(\
'.*')}]...}

say

Value:
{{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppress\
:(")")}}...]} "says:"} {Re:('.*') [{{Suppress:({LineEnd LineStart}) [S\
uppress:("\   ")]} Re:('.*')}]...}}

tell

Value:
{{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppress\
:(")")}}...]} "tells you:"} {Re:('.*') [{{Suppress:({LineEnd LineStart\
}) [Suppress:("\   ")]} Re:('.*')}]...}}

ctell

Value:
{{{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppres\
s:(")")}}...]} {{Suppress:("(") ToInteger:(W:(0123...))} Suppress:(")"\
)}} ":"} {Re:('.*') [{{Suppress:({LineEnd LineStart}) [Suppress:("\   \
")]} Re:('.*')}]...}}

qtell

Value:
{":" {Re:('.*') [{{Suppress:({LineEnd LineStart}) [Suppress:("\   ")]}\
 Re:('.*')}]...}}

shout

Value:
{{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppress\
:(")")}}...]} "shouts:"} {Re:('.*') [{{Suppress:({LineEnd LineStart}) \
[Suppress:("\   ")]} Re:('.*')}]...}}

cshout

Value:
{{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppress\
:(")")}}...]} "c-shouts:"} {Re:('.*') [{{Suppress:({LineEnd LineStart}\
) [Suppress:("\   ")]} Re:('.*')}]...}}

it

Value:
{{"-->" {W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Su\
ppress:(")")}}...]}} {Re:('.*') [{{Suppress:({LineEnd LineStart}) [Sup\
press:("\   ")]} Re:('.*')}]...}}

notify

Value:
{{{{"Notification:" {W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C\
|U|\\*')} Suppress:(")")}}...]}} "has"} Re:('arrived|departed')} "."}

msgs

Value:
{{{{{"You have" ToInteger:(W:(0123...))} "messages"} Suppress:("(")} T\
oInteger:(W:(0123...))} "unread."}

si

Value:
{{{{{{{{{{{{{{{{{{{{{{{{{"<s>" ToInteger:(W:(0123...))} "w="} W:(abcd.\
..)} "ti="} ToInteger:(W:(0123...))} "rt="} Re:('[\\d]{1,4}[PE ]')} "t\
="} ToInteger:(W:(0123...))} "i="} ToInteger:(W:(0123...))} "r="} Re:(\
'[ru]')} "tp="} Re:('blitz|standard')} "c="} Re:('\\?|white|black')} "\
rr="} Re:('[\\d\\+]{1,4}')} "-"} Re:('[\\d\\+]{1,4}')} "a="} Re:('[tf]\
')} "f="} Re:('[tf]')}

invalidlogin

Value:
Re:('Press\\ return\\ to\\ enter\\ the\\ server\\ as|Logging\\ you\\ i\
n\\ as')

invalidpass

Value:
{{Suppress:("****") "Invalid password!"} Suppress:("****")}

sessionstart

Value:
{{{{Suppress:("****") "Starting FICS session as"} W:(abcd...)} {{Suppr\
ess:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppress:(")")}} Suppress:("****\
")}

authparser

Value:
{{{{{{"login: " | "password: "} | {{{{Suppress:("****") "Starting FICS\
 session as"} W:(abcd...)} {{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')\
} Suppress:(")")}} Suppress:("****")}} | Re:('Press\\ return\\ to\\ en\
ter\\ the\\ server\\ as|Logging\\ you\\ in\\ as')} | {{Suppress:("****\
") "Invalid password!"} Suppress:("****")}} | Suppress:({{"\xff" Re:('\
[\xfb\xfc]')} ""})} | Re:('.*')}

parser

Value:
{{{{{{{{{{{{{{{{"You have" ToInteger:(W:(0123...))} "adjourned games."\
} | {"Present company includes:" {W:(abcd...)}...}} | {{{W:(abcd...) [\
{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppress:(")")}}...]} "s\
ays:"} {Re:('.*') [{{Suppress:({LineEnd LineStart}) [Suppress:("\   ")\
]} Re:('.*')}]...}}} | {{{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM\
|TD|C|U|\\*')} Suppress:(")")}}...]} "tells you:"} {Re:('.*') [{{Suppr\
ess:({LineEnd LineStart}) [Suppress:("\   ")]} Re:('.*')}]...}}} | {{{\
{W:(abcd...) [{{{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')} Suppress:(\
...

mainparser

Value:
{{{{{{"login: " | "password: "} | {{{{Suppress:("****") "Starting FICS\
 session as"} W:(abcd...)} {{Suppress:("(") Re:('CA|SR|TM|TD|C|U|\\*')\
} Suppress:(")")}} Suppress:("****")}} | Re:('Press\\ return\\ to\\ en\
ter\\ the\\ server\\ as|Logging\\ you\\ in\\ as')} | {{Suppress:("****\
") "Invalid password!"} Suppress:("****")}} | Suppress:({{"\xff" Re:('\
[\xfb\xfc]')} ""})} | Re:('.*')}