'Parse the .h file written by pgen.  (Internal)
This file is a sequence of #define statements defining the
nonterminals of the grammar as numbers.  We build two tables
mapping the numbers to names and back.'

def parse_graminit_h(self, filename):

    try:
        f = open(filename)
    except IOError as err:
        print ("Can't    open    %s:    %s" % (filename, err))
        return False
    self.symbol2number = {}
    self.number2symbol = {}
    lineno = 0
    for line in f:
        lineno += 1
        mo = re.match('^#define\\s+(\\w+)\\s+(\\d+)$', line)
        if ((not mo) and line.strip()):
            print ("%s(%s):    can't    parse    %s" % (filename, lineno, line.strip()))
        else:
            (symbol, number) = mo.groups()
            number = int(number)
            self.symbol2number[symbol] = number
            self.number2symbol[number] = symbol
    return True
