1
2
3
4
5
6
7 """pyfics dummy parser
8
9 This module is provided as an example and for test usage.
10 """
11
12 from pyfics.parser import *
13 from pyparsing import Literal, Regex
14
16 """Callback function for login"""
17 protocol.transport.write(conn.username)
22
23 login = Literal("login: ")
24 """login parser
25 @type: pyparsing.Literal"""
26 password = Literal("password: ")
27 """password parser
28 @type: pyparsing.Literal"""
29 unknown = Regex('.*')
30 """parser to match the rest
31 @type: pyparsing.Literal"""
32 auth = login | password | unknown
33 """parser used while authentication
34 @type: pyparsing.Literal"""
35 parser = unknown
36 """parser used after authentication
37 @type: pyparsing.Literal"""
38
39 mainparser = auth
40
42 """parse function for L{IcsParsingProtocol}"""
43 return mainparser.parseString(line)
44