Revision: 1697
Author: sebastien.lelong
Date: Mon Feb 22 06:08:10 2010
Log: because some include/proc/func are declared through conditional compilation, consider these even if nested (not explicitely declared as globals). There must be a treshold between retrieving everything (local/global) and just globals... Also fix missing exception definition
http://code.google.com/p/jallib/source/detail?r=1697

Modified:
 /trunk/tools/jallib.py

=======================================
--- /trunk/tools/jallib.py      Sun Feb 21 22:45:32 2010
+++ /trunk/tools/jallib.py      Mon Feb 22 06:08:10 2010
@@ -1174,6 +1174,8 @@
 INLINE_IF_RE = re.compile("if\s*.*\s+then\s+.*\s+end\s+if",re.IGNORECASE)
 level_keep = [INLINE_WHILE_RE,INLINE_IF_RE]

+class APIParsingError(Exception): pass
+
 def api_parse_content(lines,strict=True):

     def get_params(signature):
@@ -1204,17 +1206,19 @@
                 _,name,_,_,_ = PSEU_RE.match(content).groups()
# line won't be accurate, as we only keep the last pseudovar def, that is either 'put or 'get
                 desc['pseudovar'][name] = {'name' : name, 'line' : num}
-            elif PROC_RE.match(content):
-                name,signature = PROC_RE.match(content).groups()
-                params = get_params(signature)
- desc['procedure'][name] = {'name' : name, 'params' : params, 'line' : num}
-            elif FUNC_RE.match(content):
-                name,signature,rettype = FUNC_RE.match(content).groups()
-                params = get_params(signature)
- desc['function'][name] = {'name' : name, 'params' : params, 'return' : rettype, 'line' : num}
-            elif INCL_RE.match(content):
-                lib = INCL_RE.match(content).groups()[0]
-                desc['include'][lib] = {'name' : lib, 'line' : num}
+
+ # because of conditional compile, we consider every include/proc/func, even those nested
+        if INCL_RE.match(content):
+            lib = INCL_RE.match(content).groups()[0]
+            desc['include'][lib] = {'name' : lib, 'line' : num}
+        elif PROC_RE.match(content):
+            name,signature = PROC_RE.match(content).groups()
+            params = get_params(signature)
+ desc['procedure'][name] = {'name' : name, 'params' : params, 'line' : num}
+        elif FUNC_RE.match(content):
+            name,signature,rettype = FUNC_RE.match(content).groups()
+            params = get_params(signature)
+ desc['function'][name] = {'name' : name, 'params' : params, 'return' : rettype, 'line' : num}

if [matching for matching in level_keep if matching.match(content)]: ##print >> sys.stderr, "content KEEP (%s): %s " % (level,repr(content))

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to