Jul 18, 2013

A VCD Parser

A co-worker mentioned that a generic VCD parser might be useful. So I wrote one. It is mostly functional, after a few tweaks and some valuable suggestions from colleagues.

The tokenizer got particular attention, due to the rather neat generator expression, assigned to tokeniser

def extract(self, fh):
    '''Tokenize and parse the VCD file'''
    # open the VCD file and create a token generator
    tokeniser = (word for line in fh for word in line.split() if word)

    for count, token in enumerate(tokeniser):

There are comments.

Comments !