--- nfo/patches/glimmer/scripts/FunctionSelector.py 2002/11/08 02:18:51 1.1 +++ nfo/patches/glimmer/scripts/FunctionSelector.py 2002/11/12 20:14:48 1.3 @@ -1,12 +1,31 @@ -# FunctionSelector v0.04 script for glimmer -# last edit by Andreas Motl -# and Sebastian Utz 2002-11-01 +################################################## +# $Id: FunctionSelector.py,v 1.3 2002/11/12 20:14:48 jonen Exp $ +# small plugin for glimmer # -#ToDo: +# Authors: +# Andreas Motl +# Sebastian Utz +# +# ToDo: # - Bug: FunctionList doesn't refresh on new opened files by its own # - tune regex for more languages # - +# Changelog: +# $Log: FunctionSelector.py,v $ +# 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" +# suggested by Mark McAulay +# +# +################################################## + import glimmer import string import re @@ -30,12 +49,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) @@ -138,7 +157,6 @@ functionwindow.add(functionlist) functionlist.show() #functionlist.column_titles_show(1) -#functionlist.set_column_title(0, "Functions:") glimmer.add_paned_object(functionbox._o, "FunctionSelector", 0) our_main() checkitem = GtkCheckMenuItem("Function Selector") @@ -150,6 +168,8 @@ glimmer.register_signal_hook("change-file", callback_change) +glimmer.register_signal_hook("save-file", callback_change) + args = (checkitem, functionbox, ) _gtk.gtk_signal_connect(closebutton._o, "clicked", close_function_selector, args) args = (None, )