Exemplo n.º 1
0
 def parse(self):
     '''interpret records for PV declarations'''
     tokenLog = TokenLog()
     tokenLog.processFile(self.filename_expanded)
     tok = tokenLog.nextActionable()
     actions = {
                #'NAME alias': self._parse_alias,
                #'NAME info': self._parse_info,
                'NAME grecord': self._parse_record,
                'NAME record': self._parse_record,
                }
     while tok is not None:
         tk = token_key(tok)
         if tk in actions:
             actions[tk](tokenLog)
         tok = tokenLog.nextActionable()
Exemplo n.º 2
0
 def parse(self):
     '''
     interpret the template file for database declarations
     
     The Python tokenizer makes simple work of parsing database files.
     The TokenLog class interprets the contents according to a few simple terms
     such as NAME, OP, COMMENT, NEWLINE.
     '''
     tokenLog = TokenLog()
     tokenLog.processFile(self.filename_expanded)
     tok = tokenLog.nextActionable()
     actions = {
                'NAME file': self._parse_file_statement,
                'NAME global': self._parse_globals_statement,
                }
     while tok is not None:
         tk = token_key(tok)
         if tk in actions:
             actions[tk](tokenLog)
         tok = tokenLog.nextActionable()