'Create a new Lexer.
error_func:
An error function. Will be called with an error
message, line and column as arguments, in case of
an error during lexing.
on_lbrace_func, on_rbrace_func:
Called when an LBRACE or RBRACE is encountered
(likely to push/pop type_lookup_func\'s scope)
type_lookup_func:
A type lookup function. Given a string, it must
return True IFF this string is a name of a type
that was defined with a typedef earlier.'

def __init__(self, error_func, on_lbrace_func, on_rbrace_func, type_lookup_func):

    self.error_func = error_func
    self.on_lbrace_func = on_lbrace_func
    self.on_rbrace_func = on_rbrace_func
    self.type_lookup_func = type_lookup_func
    self.filename = ''
    self.last_token = None
    self.line_pattern = re.compile('([     DCTB ]*line\\W)|([     DCTB ]*\\d+)')
    self.pragma_pattern = re.compile('[     DCTB ]*pragma\\W')
