~ubuntu-branches/ubuntu/maverick/wxwidgets2.8/maverick-proposed

« back to all changes in this revision

Viewing changes to wxPython/wx/tools/Editra/plugins/codebrowser/codebrowser/gentag/innotags.py

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2008-06-30 22:02:17 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080630220217-vag3tkfp91t0453d
Tags: 2.8.8.0-0ubuntu1
* New upstream version, based on the upstream tarball
  wxPython-src-2.8.8.0.tar.bz2, remove upstream debian dir (LP: #244355).
* Add debian/watch file, LP: #242164.
* Edit get-orig-source target to provide a .orig.tar.gz with the same md5 for
  each .orig.tar.gz generated.
* debian/rules: remove get-orig-source from .PHONY target.
* debian/control.in: add python-wxtools in python-wxgtk=V=U Suggests field.
* Do not apply fix_from_upstream_svn_r52465 patch, not needed.
* Regenerate octave_oct, tcl_tk_tcl patches for the new version.
* Fix spelling-error-in-description lintian warning.
* Fix depends-on-obsolete-package lintian error.
* Fix executable-not-elf-or-script lintian warnings.
* Fix script-not-executable lintian warnings.
* Fix missing-dependency-on-libc lintian error.
* Fix dbg-package-missing-depends lintian warnings.
* Fix package-contains-empty-directory lintian warnings.
* Fix manpage-has-errors-from-man lintian warning.
* Fix image-file-in-usr-lib lintian warnings:
  - add editra_pixmaps patch
  - add xrced_bitmaps patch
* Fix unused-override lintian info.
* Fix malformed-override lintian errors.
* Fix extra-license-file lintian warnings.
* Install upstream wx.pth instead of generated file links (LP: #211553).
* Add editra.png, pyshell.png (encoded using uuencode) icons, LP: #236876:
  - debian/rules: use uudecode to decode .png icons.
* Add a new pyshell.xpm icon.
* Fix doc-base-file-references-missing-file lintian error.
* Fix doc-base-unknown-section lintian warning.
* Fix ruby-script-but-no-ruby-dep lintian errors.
* Fix wish-script-but-no-wish-dep lintian errors.
* Fix missing-dep-for-interpreter errors.
* Bump Standards-Version to 3.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
###############################################################################
 
2
# Name: innotags.py                                                           #
 
3
# Purpose: Generate Tags for Inno Setup Scripts                               #
 
4
# Author: Cody Precord <cprecord@editra.org>                                  #
 
5
# Copyright: (c) 2008 Cody Precord <staff@editra.org>                         #
 
6
# License: wxWindows License                                                  #
 
7
###############################################################################
 
8
 
 
9
"""
 
10
FILE: innotags.py
 
11
AUTHOR: Cody Precord
 
12
LANGUAGE: Python
 
13
SUMMARY:
 
14
  Generate a DocStruct object that captures the structure of a Inno Setup Script
 
15
Currently supports parsing of Sections, Function Definitions, Procedure
 
16
Definitions, and Global Define statements.
 
17
 
 
18
"""
 
19
 
 
20
__author__ = "Cody Precord <cprecord@editra.org>"
 
21
__svnid__ = "$Id: innotags.py 52675 2008-03-22 03:34:38Z CJP $"
 
22
__revision__ = "$Revision: 52675 $"
 
23
 
 
24
#--------------------------------------------------------------------------#
 
25
# Dependancies
 
26
import taglib
 
27
import parselib
 
28
 
 
29
#--------------------------------------------------------------------------#
 
30
 
 
31
def GenerateTags(buff):
 
32
    """Create a DocStruct object that represents an Inno Setup Script
 
33
    @param buff: a file like buffer object (StringIO)
 
34
    @todo: perhaps group functions, procedures within the Scope of a Section
 
35
           object.
 
36
 
 
37
    """
 
38
    rtags = taglib.DocStruct()
 
39
    rtags.SetElementDescription('section', "Sections")
 
40
    rtags.SetElementDescription('variable', "Defines")
 
41
    rtags.SetElementDescription('function', "Function Definitions")
 
42
    rtags.SetElementDescription('procedure', "Procedure Definitions")
 
43
    rtags.SetElementPriority('section', 3)
 
44
    rtags.SetElementPriority('function', 2)
 
45
    rtags.SetElementPriority('procedure', 1)
 
46
 
 
47
    for lnum, line in enumerate(buff):
 
48
        line = line.strip()
 
49
 
 
50
        # Skip comment and empty lines
 
51
        if line.startswith(u";") or not line:
 
52
            continue
 
53
 
 
54
        # Check for a section
 
55
        if line.startswith(u"["):
 
56
            secend = line.find(u"]")
 
57
            if secend != -1:
 
58
                section = taglib.Section(line[1:secend], lnum)
 
59
                rtags.AddElement('section', section)
 
60
        elif parselib.IsToken(line, 0, u'function'):
 
61
            name = parselib.GetFirstIdentifier(line[8:].strip())
 
62
            if name is not None:
 
63
                rtags.AddFunction(taglib.Function(name, lnum))
 
64
        elif parselib.IsToken(line, 0, u'procedure'):
 
65
            name = parselib.GetFirstIdentifier(line[9:].strip())
 
66
            if name is not None:
 
67
                rtags.AddElement('procedure',
 
68
                                 taglib.Function(name, lnum, 'procedure'))
 
69
        elif parselib.IsToken(line, 0, u'#define'):
 
70
            name = parselib.GetFirstIdentifier(line[7:].strip())
 
71
            if name is not None:
 
72
                rtags.AddVariable(taglib.Variable(name, lnum))
 
73
        else:
 
74
            pass
 
75
 
 
76
    return rtags
 
77
 
 
78
#-----------------------------------------------------------------------------#
 
79
# Test
 
80
if __name__ == '__main__':
 
81
    import sys
 
82
    import StringIO
 
83
    fhandle = open(sys.argv[1])
 
84
    txt = fhandle.read()
 
85
    fhandle.close()
 
86
    tags = GenerateTags(StringIO.StringIO(txt))
 
87
    print "\n\nElements:"
 
88
    for element in tags.GetElements():
 
89
        print "\n%s:" % element.keys()[0]
 
90
        for val in element.values()[0]:
 
91
            print "%s [%d]" % (val.GetName(), val.GetLine())
 
92
    print "END"