diff options
Diffstat (limited to 'wlp.py')
-rw-r--r-- | wlp.py | 20 |
1 files changed, 2 insertions, 18 deletions
@@ -1,27 +1,11 @@ -# -*- coding: utf-8 -*- import wlp_parser -__current_file = None - - -def setfilebyname(name): - global __current_file - __current_file = open(name, 'r') - - -def setfilebyfd(fd): - global __current_file - __current_file = fd - - -def mkdict(): +def mkdict(infile): dict = {} - if __current_file is None: - raise ValueError('current file has not been set.') tree = wlp_parser.parser.parse( - wlp_parser.lexer.lex(__current_file.read())) + wlp_parser.lexer.lex(infile.read())) for subtree in tree: current_key = subtree[0].getstr().strip('<>') |