'Scanner(lexicon, stream, name = \'\')
|lexicon| is a Plex.Lexicon instance specifying the lexical tokens
to be recognised.
|stream| can be a file object or anything which implements a
compatible read() method.
|name| is optional, and may be the name of the file being
scanned or any other identifying string.'

def __init__(self, lexicon, stream, name='', initial_pos=None):

    self.trace = 0
    self.buffer = u''
    self.buf_start_pos = 0
    self.next_pos = 0
    self.cur_pos = 0
    self.cur_line = 1
    self.start_pos = 0
    self.start_line = 0
    self.start_col = 0
    self.text = None
    self.state_name = None
    self.lexicon = lexicon
    self.stream = stream
    self.name = name
    self.queue = []
    self.initial_state = None
    self.begin('')
    self.next_pos = 0
    self.cur_pos = 0
    self.cur_line_start = 0
    self.cur_char = BOL
    self.input_state = 1
    if (initial_pos is not None):
        (self.cur_line, self.cur_line_start) = (initial_pos[1], (- initial_pos[2]))
