source: specdomain/src/specdomain/test/parser.py @ 954

Last change on this file since 954 was 954, checked in by jemian, 11 years ago

start work on the SPEC macro source code file parser

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision URL Header
File size: 813 bytes
Line 
1#!/usr/bin/env python
2
3########### SVN repository information ###################
4# $Date: 2012-06-20 18:36:11 +0000 (Wed, 20 Jun 2012) $
5# $Author: jemian $
6# $Revision: 954 $
7# $HeadURL: specdomain/src/specdomain/test/parser.py $
8# $Id: parser.py 954 2012-06-20 18:36:11Z jemian $
9########### SVN repository information ###################
10
11
12"""
13Construct a SPEC macro source code file parser for
14use by the specdomain for Sphinx.
15"""
16
17import os
18import re
19
20
21class SpecMacrofileParser:
22    '''
23    Parse a SPEC macro file for macro definitions,
24    variable declarations, and extended comments.
25    '''
26
27    def __init__(self, macrofile):
28        '''
29        Constructor
30        '''
31        self.filename = macrofile
32        if not os.path.exists(macrofile):
33            raise Exception, "file not found: " + str(macrofile)
34
35
36if __name__ == '__main__':
37    p = SpecMacrofileParser('test-battery.mac')
38    p = SpecMacrofileParser('cdef-examples.mac')
39    pass
Note: See TracBrowser for help on using the repository browser.