from pyparsing import Literal, Word, ZeroOrMore, Group, Dict, Optional, \
printables, ParseException, restOfLine
from getopt import getopt, GetoptError
from pyparsing import Literal, Word, ZeroOrMore, Group, Dict, Optional, \
printables, ParseException, restOfLine
from getopt import getopt, GetoptError
self.fields.append(field)
def decode(self, value, ignore_zero):
self.fields.append(field)
def decode(self, value, ignore_zero):
name_width = max(map(lambda f: len(f.name), self.fields))
str = "0x%0*lx [%d]\n" % (field_width, value, value)
name_width = max(map(lambda f: len(f.name), self.fields))
str = "0x%0*lx [%d]\n" % (field_width, value, value)
- for (id, r) in regs.iteritems():
- print "%18s : %s" % (id, r.name)
+ for (id, r) in regs.items():
+ print("%18s : %s" % (id, r.name))
def search_regs(regs, str):
return dict((k, regs[k]) for k in regs \
def search_regs(regs, str):
return dict((k, regs[k]) for k in regs \
raise ConfigurationError(file,
"Register %s is already defined" % id)
raise ConfigurationError(file,
"Register %s is already defined" % id)
- os.path.walk(conf, parse_config_dir, conf_data)
+ for c in os.walk(conf):
+ parse_config_dir(conf_data, c[0], c[2])
- except ConfigurationError, e:
- print "Error parsing configuration file %s:\n\t%s" % \
- (e.file, e.message)
+ except ConfigurationError as e:
+ print("Error parsing configuration file %s:\n\t%s" % \
+ (e.file, e.message))