--- a/Utilities/ClassBrowsers/rbclbr.py Tue Oct 15 22:03:54 2013 +0200 +++ b/Utilities/ClassBrowsers/rbclbr.py Fri Oct 18 23:00:41 2013 +0200 @@ -49,7 +49,8 @@ (?P<MethodIndent> [ \t]* ) def [ \t]+ (?: - (?P<MethodName2> [a-zA-Z0-9_]+ (?: \. | :: ) [a-zA-Z_] [a-zA-Z0-9_?!=]* ) + (?P<MethodName2> [a-zA-Z0-9_]+ (?: \. | :: ) + [a-zA-Z_] [a-zA-Z0-9_?!=]* ) | (?P<MethodName> [a-zA-Z_] [a-zA-Z0-9_?!=]* ) | @@ -102,11 +103,13 @@ (?: (?P<AccessControlType> private | public | protected ) [^_] | - (?P<AccessControlType2> private_class_method | public_class_method ) + (?P<AccessControlType2> + private_class_method | public_class_method ) ) \(? [ \t]* - (?P<AccessControlList> (?: : [a-zA-Z0-9_]+ , \s* )* (?: : [a-zA-Z0-9_]+ )+ )? + (?P<AccessControlList> (?: : [a-zA-Z0-9_]+ , \s* )* + (?: : [a-zA-Z0-9_]+ )+ )? [ \t]* \)? ) @@ -125,7 +128,8 @@ (?P<AttrType> (?: _accessor | _reader | _writer ) )? \(? [ \t]* - (?P<AttrList> (?: : [a-zA-Z0-9_]+ , \s* )* (?: : [a-zA-Z0-9_]+ | true | false )+ ) + (?P<AttrList> (?: : [a-zA-Z0-9_]+ , \s* )* + (?: : [a-zA-Z0-9_]+ | true | false )+ ) [ \t]* \)? ) @@ -133,7 +137,8 @@ | (?P<Begin> ^ [ \t]* - (?: def | if | unless | case | while | until | for | begin ) \b [^_] + (?: def | if | unless | case | while | until | for | begin ) + \b [^_] | [ \t]* do [ \t]* (?: \| .*? \| )? [ \t]* $ ) @@ -209,7 +214,8 @@ """ Class to represent a Ruby function. """ - def __init__(self, module, name, file, lineno, signature='', separator=','): + def __init__(self, module, name, file, lineno, signature='', + separator=','): """ Constructor @@ -244,13 +250,13 @@ def readmodule_ex(module, path=[]): - ''' + """ Read a Ruby file and return a dictionary of classes, functions and modules. @param module name of the Ruby file (string) @param path path the file should be searched in (list of strings) @return the resulting dictionary - ''' + """ global _modules dict = {} @@ -321,7 +327,8 @@ if classstack: # it's a class/module method cur_class = classstack[-1][0] - if isinstance(cur_class, Class) or isinstance(cur_class, Module): + if isinstance(cur_class, Class) or \ + isinstance(cur_class, Module): # it's a method f = Function(None, meth_name, file, lineno, meth_sig) @@ -344,7 +351,8 @@ file, lineno, meth_sig) if meth_name in dict_counts: dict_counts[meth_name] += 1 - meth_name = "{0}_{1:d}".format(meth_name, dict_counts[meth_name]) + meth_name = "{0}_{1:d}".format( + meth_name, dict_counts[meth_name]) else: dict_counts[meth_name] = 0 dict[meth_name] = f @@ -410,7 +418,8 @@ while acstack and \ acstack[-1][1] >= thisindent: del acstack[-1] - acstack.append(["public", thisindent]) # default access control is 'public' + acstack.append(["public", thisindent]) # default access control + # is 'public' elif m.start("Module") >= 0: # we found a module definition @@ -450,7 +459,8 @@ while acstack and \ acstack[-1][1] >= thisindent: del acstack[-1] - acstack.append(["public", thisindent]) # default access control is 'public' + acstack.append(["public", thisindent]) # default access control + # is 'public' elif m.start("AccessControl") >= 0: aclist = m.group("AccessControlList") @@ -475,7 +485,7 @@ m.group("AccessControlType2").split('_')[0] actype = actype.lower() for name in aclist.split(","): - name = name.strip()[1:] # get rid of leading ':' + name = name.strip()[1:] # get rid of leading ':' acmeth = parent._getmethod(name) if acmeth is None: continue @@ -497,7 +507,8 @@ if classstack[index][0] is not None and \ not isinstance(classstack[index][0], Function) and \ not classstack[index][1] >= indent: - attr = Attribute(module, m.group("AttributeName"), file, lineno) + attr = Attribute( + module, m.group("AttributeName"), file, lineno) classstack[index][0]._addattribute(attr) break else: @@ -531,7 +542,7 @@ else: access = m.group("AttrType") for name in m.group("AttrList").split(","): - name = name.strip()[1:] # get rid of leading ':' + name = name.strip()[1:] # get rid of leading ':' attr = parent._getattribute("@" + name) or \ parent._getattribute("@@" + name) or \ Attribute(module, "@" + name, file, lineno) @@ -571,7 +582,8 @@ lineno = lineno + src.count('\n', last_lineno_pos, start) last_lineno_pos = start if "@@Coding@@" not in dict: - dict["@@Coding@@"] = ClbrBaseClasses.Coding(module, file, lineno, coding) + dict["@@Coding@@"] = ClbrBaseClasses.Coding( + module, file, lineno, coding) else: assert 0, "regexp _getnext found something unexpected"