@@ -26,11 +26,11 @@ def run(self, edit): |
26 | 26 | # Add an end-get for relevant lines |
27 | 27 | # I.e. Find all internal call getters and add end-gets. This is done by matching line number before the call getter and after the getter method has finished |
28 | 28 | # Note: This is really ugly, but I couldn't find a better way to do this. Plus it's all done in one line of code |
29 | | - newViewString = re.sub(r'(\d+:.*)(\n.*call getter\s+(?:\w+:?)+\.\w+[\s\S]*?)(.*)(\1)', r'\1\2\3End-Get;', newViewString) |
| 29 | + newViewString = re.sub(r'(\d+:.*)(\n.*call getter\s+(?:\w+:?)+\.\w+[\s\S]*?)(.*)(\1)', r'\1\2\3end-get;', newViewString) |
30 | 30 |
|
31 | 31 | # Extract all lines containing start, end, Nest=, call int, call private, call method and End-Function |
32 | 32 | # Note: we ignore call constructor and call setter |
33 | | - str_list = re.findall(r'(?:(?:.*(?:start|end|resume|reend).*Nest=.*)|(?:.*call (?:int|private|method|getter).*)|.*End-Function.*|.*End-Get.*)', newViewString, re.MULTILINE) |
| 33 | + str_list = re.findall(r'(?:(?:.*(?:start|end|resume|reend).*Nest=.*)|(?:.*call (?:int|private|method|getter|setter).*)|.*End-Function.*|.*end-get.*|.*end-set.*)', newViewString, re.MULTILINE) |
34 | 34 | newViewString = '\n'.join(str_list) |
35 | 35 |
|
36 | 36 | # Get the unique session numbers and store them in a list |
@@ -46,7 +46,7 @@ def run(self, edit): |
46 | 46 | sessionSpecificString = '\n'.join(str_list) |
47 | 47 |
|
48 | 48 | # Remove header junk for each of the lines |
49 | | - str_list = re.findall(r'(?:(?:(?:start|end|resume|reend).*Nest=.*)|(?:call (?:int|private|method|getter).*)|End-Function.*|End-Get.*)', sessionSpecificString, re.MULTILINE) |
| 49 | + str_list = re.findall(r'(?:(?:(?:start|end|resume|reend).*Nest=.*)|(?:call (?:int|private|method|getter|setter).*)|End-Function.*|end-get.*|end-set.*)', sessionSpecificString, re.MULTILINE) |
50 | 50 | sessionSpecificString = '\n'.join(str_list) |
51 | 51 |
|
52 | 52 | # Get all the Nest values and store them in a list and store the lowest Nest value |
@@ -79,59 +79,62 @@ def run(self, edit): |
79 | 79 |
|
80 | 80 | if match.group(1) == 'start': |
81 | 81 | lastCall = 'start' |
82 | | - # PSAPPSRV.3320 (556) 1-32321 10.37.25 0.000000 >>> start Nest=12 DERIVED_ADDR.ADDRESSLONG.RowInit |
| 82 | + # E.g. >>> start Nest=12 DERIVED_ADDR.ADDRESSLONG.RowInit |
83 | 83 | matchExt = re.search(r'start.*Nest=(?:\d+).*?((?:\w+\.?)+)', lineContents) |
84 | 84 | extContext.append(matchExt.group(1)) |
85 | 85 | if match.group(1) == 'start-ext': |
86 | 86 | lastCall = 'start' |
87 | 87 | # keep track of start-ext location so that we can append the location to call private and call int lines |
| 88 | + # E.g. >>> start-ext Nest=14 ActivePrograms_SCT SSR_STUDENT_RECORDS.SR_StudentData.StudentActivePrograms.OnExecute |
88 | 89 | matchExt = re.search(r'start-ext.*Nest=(?:\d+).*\w+\s(.*)', lineContents) |
89 | 90 | extContext.append(matchExt.group(1)) |
90 | | - #print('Added %s' % extContext[-1]) |
91 | 91 | if match.group(1) == 'resume': |
92 | 92 | lastCall = 'resume' |
93 | 93 | if match.group(1) == 'end-ext': |
94 | 94 | lastCall = 'end' |
95 | 95 | # remove the last element from extContext |
96 | | - #print('Removed %s' % extContext[-1]) |
97 | 96 | extContext.pop() |
98 | 97 | if match.group(1) == 'end': |
99 | 98 | lastCall = 'end' |
100 | 99 | if match.group(1) == 'reend': |
101 | 100 | lastCall = 'reend' |
102 | 101 |
|
103 | 102 | else: |
104 | | - match = re.search(r'(call (int|setter|getter|private)|End-Function|End-Get)', lineContents) |
| 103 | + match = re.search(r'(call (int|setter|getter|private)|End-Function|end-get|end-set)', lineContents) |
105 | 104 | if match: |
106 | 105 | # if first 4 chars are 'call' |
107 | 106 | if match.group(1)[:4] == 'call': |
108 | 107 |
|
109 | | - if (lastCall == 'start') or (lastCall == 'resume') or (lastCall == 'callGetter') or (lastCall == 'callPrivate'): |
110 | | - nestLevel= nestLevel + 1 |
| 108 | + if lastCall in ['start', 'resume'] or (lastCall[:4] == 'call'): |
| 109 | + nestLevel = nestLevel + 1 |
111 | 110 |
|
112 | 111 | if match.group(1) == 'call getter': |
113 | 112 | lastCall = 'callGetter' |
114 | 113 |
|
| 114 | + if match.group(1) == 'call setter': |
| 115 | + lastCall = 'callSetter' |
| 116 | + # Remove extra space after call setter |
| 117 | + # E.g. call setter EO:CA:Address.EditPageHeader #params=3 |
| 118 | + lineContents = re.sub(r'call setter\s+(\w+.*)', r'call setter \1', lineContents) |
115 | 119 | if match.group(1) == 'call private': |
116 | 120 | lastCall = 'callPrivate' |
117 | | - # Now we need to append the last value in extContext |
118 | | - # i.e. extContext[-1] |
| 121 | + # Now we need to append the last value in extContext (i.e. extContext[-1]) |
119 | 122 | lineContents = re.sub(r'call private\s+(\w+)', r'call private \1 %s' % extContext[-1], lineContents) |
120 | 123 | if match.group(1) == 'call int': |
121 | 124 | lastCall = 'callInt' |
122 | | - # Now we need to append the last value in extContext |
123 | | - # i.e. extContext[-1] |
124 | | - print(lineContents) |
125 | | - #print(extContext[-1]) |
| 125 | + # Now we need to append the last value in extContext (i.e. extContext[-1]) |
126 | 126 | lineContents = re.sub(r'call int\s+(\w+)', r'call int \1 %s' % extContext[-1], lineContents) |
127 | 127 | else: |
128 | 128 | lastCall='call' |
129 | 129 | else: |
130 | | - if lastCall == 'endFunction': |
| 130 | + if match.group(1) == 'End-Function': |
131 | 131 | lastCall ='endFunction' |
132 | | - else: |
| 132 | + if match.group(1) == 'end-get': |
133 | 133 | # End-Get reached |
134 | 134 | lastCall = 'endGet' |
| 135 | + if match.group(1) == 'end-set': |
| 136 | + # End-Get reached |
| 137 | + lastCall = 'endSet' |
135 | 138 |
|
136 | 139 | startIndex = 0 |
137 | 140 |
|
@@ -147,10 +150,7 @@ def run(self, edit): |
147 | 150 | if lastCall[:4] == 'call': |
148 | 151 | nestLevel = nestLevel + 1 |
149 | 152 |
|
150 | | - if lastCall == 'endFunction': |
151 | | - nestLevel = nestLevel - 1 |
152 | | - |
153 | | - if lastCall == 'endGet': |
| 153 | + if lastCall in ['endFunction', 'endGet', 'endSet']: |
154 | 154 | nestLevel = nestLevel - 1 |
155 | 155 |
|
156 | 156 | # Remove Nest from each line since we no longer need it |
@@ -205,14 +205,14 @@ def run(self, edit): |
205 | 205 |
|
206 | 206 | # Clean lines |
207 | 207 | # Remove the end-ext, End-Function, resume, end and reend calls, since we no longer need them |
208 | | - str_list = re.findall(r'(?:.*(?:start).*)|.*(?:call (?:int|private|method|getter).*)', sessionSpecificString, re.MULTILINE) |
| 208 | + str_list = re.findall(r'(?:.*(?:start).*)|.*(?:call (?:int|private|method|getter|setter).*)', sessionSpecificString, re.MULTILINE) |
209 | 209 | sessionSpecificString = '\n'.join(str_list) |
210 | 210 |
|
211 | 211 | # Rearrange the call getter so that it is in the same format as all the other calls |
212 | 212 | sessionSpecificString = re.sub(r'call getter\s+((?:\w+(?::?))+)\.(\w+)', r'call getter \2 \1.OnExecute', sessionSpecificString) |
213 | 213 |
|
214 | 214 | # Remove the start and call int/private/method strings from all lines as these strings are no longer required |
215 | | - #sessionSpecificString = re.sub(r'(start|call (int|private|method|getter)|start-ext)\s+', '', sessionSpecificString) |
| 215 | + #sessionSpecificString = re.sub(r'(start|call (int|private|method|getter|setter)|start-ext)\s+', '', sessionSpecificString) |
216 | 216 |
|
217 | 217 | # Remove unnecessary trailer junk (e.g. params= or #params=) |
218 | 218 | sessionSpecificString = re.sub(r'Dur=.*', '', sessionSpecificString) |
@@ -221,10 +221,6 @@ def run(self, edit): |
221 | 221 | # Replace any colons with dots |
222 | 222 | sessionSpecificString = re.sub(':', r'.', sessionSpecificString) |
223 | 223 |
|
224 | | - # Find all functions (?<=\s)\w+(?=\n) |
225 | | - # Add their location |
226 | | - |
227 | | - |
228 | 224 | # We now have the complete callstack for the session |
229 | 225 | # Insert the call stack in the new view |
230 | 226 | newViewAllTextRegion = sublime.Region(0, newView.size()) |
|