--- nfo/patches/glimmer/scripts/FunctionSelector.py 2002/11/08 02:37:25 1.2 +++ nfo/patches/glimmer/scripts/FunctionSelector.py 2002/11/12 22:22:25 1.4 @@ -1,5 +1,5 @@ ################################################## -# $Id: FunctionSelector.py,v 1.2 2002/11/08 02:37:25 jonen Exp $ +# $Id: FunctionSelector.py,v 1.4 2002/11/12 22:22:25 jonen Exp $ # small plugin for glimmer # # Authors: @@ -12,6 +12,15 @@ # # Changelog: # $Log: FunctionSelector.py,v $ +# Revision 1.4 2002/11/12 22:22:25 jonen +# + added support for concurrent pygtk installations +# +# Revision 1.3 2002/11/12 20:14:48 jonen +# + php functions maybe prefixed by a '&'. fixed sigpart regex. +# + forgot 'class' (php) after all. fixed regex. +# + renamed regex_perl to regex_noparenthesis +# + perl subs with an space after the first '{' weren't regognized. fixed regex. +# # Revision 1.2 2002/11/08 02:37:25 jonen # + added cvs header # + added hook for refresh on "save-file" @@ -27,6 +36,11 @@ import os sys.argv=[] sys.argv.append("null") +try: + import pygtk + pygtk.require("1.2") +except: + pass from gtk import * import _gtk import _gnome @@ -43,12 +57,12 @@ # class/function/sub/packages signatures # in source code prefix_pattern = '^[|\s]*' -sigpart = '\s+([\w|:]+?)\s*' -regex_universal=re.compile(prefix_pattern + '(?:\w+?)\*??' + sigpart + '\(.*?\)[\s|:|{]*$') -regex_perl=re.compile(prefix_pattern + '(?:package|sub)' + sigpart + '[;|{]$') +sigpart = '\s+([\w|:|&]+?)\s*' +regex_universal=re.compile(prefix_pattern + '(?:\w+?)\*??' + sigpart + '\(.*?\)[\s|:|{]*\s*$') +regex_noparenthesis=re.compile(prefix_pattern + '(?:package|sub|class)' + sigpart + '[;|{]\s*$') def get_functionNameFromLine(str): - for regex in (regex_universal, regex_perl): + for regex in (regex_universal, regex_noparenthesis): match=regex.search(str) if match: str = match.group(1)