GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fixed formatting issue with nestlevel and resumes · Jatz/PeopleCodeTools@1346192

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • ExtractCallStack.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎ExtractCallStack.py‎

Copy file name to clipboardExpand all lines: ExtractCallStack.py
+18-1Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,28 @@ def run(self, edit):
6969
# extContext will store a list of contexts to keep track of all the start and start-ext calls
7070
extContext = []
7171

72+
# resumeContext will store a list of contexts to keep track of all the resume calls
73+
resumeContext = []
74+
7275
# Perform initial formatting based on Nest value
7376
for lineContents in lines:
7477
# extract Nest value from lineContents
7578
match = re.search(r'(start-ext|start|end-ext|end|resume|reend)\s+Nest=(\d+)', lineContents)
7679
if match:
80+
prevNestLevel = nestLevel
7781
nestLevel = int(match.group(2)) - lowestNestValue
7882

83+
# Always ensure that the next nest level is always only indented by 1 tab, and not more
84+
if (nestLevel - prevNestLevel) > 1:
85+
nestLevel = prevNestLevel + 1
86+
7987
startIndex = 0
8088

89+
# If within a resume context
90+
if resumeContext:
91+
# The resume code already adds an extra tab, so don't need to indent here
92+
nestLevel -= 1
93+
8194
for x in range(startIndex,nestLevel):
8295
lineContents = '\t' + lineContents
8396
sessionSpecificString = sessionSpecificString + lineContents + '\n'
@@ -95,6 +108,8 @@ def run(self, edit):
95108
extContext.append(matchExt.group(1))
96109
if match.group(1) == 'resume':
97110
lastCall = 'resume'
111+
resumeExt = re.search(r'resume\s+Nest=(?:\d+)\s+\.\s+((?:\w+\.?)+)', lineContents)
112+
resumeContext.append(resumeExt.group(1))
98113
if match.group(1) == 'end-ext':
99114
lastCall = 'end'
100115
# remove the last element from extContext
@@ -105,14 +120,16 @@ def run(self, edit):
105120
extContext.pop()
106121
if match.group(1) == 'reend':
107122
lastCall = 'reend'
123+
# remove the last element from resumeContext
124+
resumeContext.pop()
108125

109126
else:
110127
match = re.search(r'(call (int|setter|getter|private|method)|End-Function|end-get|end-set)', lineContents)
111128
if match:
112129
# if first 4 chars are 'call'
113130
if match.group(1)[:4] == 'call':
114131

115-
if lastCall in ['start', 'resume'] or (lastCall[:4] == 'call'):
132+
if lastCall == 'start' or (lastCall[:4] == 'call'):
116133
nestLevel += 1
117134

118135
if match.group(1) == 'call method':

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.