Ignore:
Timestamp:
Jul 2, 2012 3:13:44 PM (10 years ago)
Author:
jemian
Message:

refs #8, still need to understand how the index is configured in the domain

File:
1 edited

Legend:

Unmodified
Added
Removed
  • specdomain/trunk/src/specdomain/sphinxcontrib/specmacrofileparser.py

    r987 r989  
    4949        Assume all extended comments contain ReST formatted comments,
    5050        *including initial section titles or transitions*.
    51         The first and simplest thing to do is to read the .mac file and only extract
    52         all the extended comments and add them as nodes to the current document.
    5351   
    5452    Assume macro definitions are not nested (but test for this).
     53   
     54    Assume macro files are small enough to load completely in memory.
    5555       
    5656    An additional step would be to parse for:
    57     * def
    58     * cdef
    59     * rdef
     57    * def    (done)
     58    * cdef    (done)
     59    * rdef    (done)
    6060    * global    (done)
    6161    * local    (done)
     
    379379        macros = []             # def, cdef, and rdef macros
    380380        functions = []          # def and rdef function macros
    381         title = 'Extended Comments'
    382         s = ['', title, '='*len(title), ]
     381        #title = 'Extended Comments'
     382        #s = ['', title, '='*len(title), ]
     383        s = []
    383384        for r in self.findings:
    384385            if r['objtype'] == 'extended comment':
     
    390391                s.append( '' )
    391392                s.append(r['text'])
    392             elif r['objtype'] in ('def', 'rdef', 'cdef'):
     393            elif r['objtype'] in ('def', 'rdef', 'cdef', ):
    393394                macros.append(r)
     395                s.append( '' )
     396                s.append( '.. %s %s %s %d %d' % (self.filename,
     397                                              r['objtype'],
     398                                              r['name'],
     399                                              r['start_line'],
     400                                              r['end_line']) )
     401                s.append( '' )
     402                s.append( '.. rubric:: %s macro declaration' % r['objtype']  )
     403                s.append( '' )
     404                #s.append( '.. spec:%s:: %s %s' % ( r['objtype'], r['name'], r['args'],) )
     405                s.append( '.. spec:%s:: %s' % ( r['objtype'], r['name'],) )
    394406            elif r['objtype'] in ('function def', 'function rdef',):
     407                # FIXME:  not getting here, such as for kohzuE_cmd()
    395408                functions.append(r)
     409                s.append( '' )
     410                s.append( '.. %s %s %s %d %d' % (self.filename,
     411                                              r['objtype'],
     412                                              r['name'],
     413                                              r['start_line'],
     414                                              r['end_line']) )
     415                s.append( '' )
     416                s.append( '.. rubric:: %s macro function declaration' % r['objtype']  )
     417                s.append( '' )
     418                s.append( '.. spec:%s:: %s(%s)' % ( r['objtype'], r['name'], r['args']) )
    396419            elif r['objtype'] in ('local', 'global', 'constant'):
    397420                declarations.append(r)
Note: See TracChangeset for help on using the changeset viewer.