Skip to content

Commit b09deaf

Browse files
Revert "Extend error messages if too much code to c-analyzer"
This reverts commit 7f62d59.
1 parent 7f62d59 commit b09deaf

2 files changed

Lines changed: 4 additions & 30 deletions

File tree

Tools/c-analyzer/c_parser/parser/__init__.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -208,27 +208,7 @@ def _iter_source(lines, *, maxtext=11_000, maxlines=200, showtext=False):
208208
return
209209
# At this point either the file ended prematurely
210210
# or there's "too much" text.
211-
filename, lno_from, lno_to = srcinfo.filename, srcinfo.start, srcinfo.end
212-
text = srcinfo.text
211+
filename, lno, text = srcinfo.filename, srcinfo._start, srcinfo.text
213212
if len(text) > 500:
214213
text = text[:500] + '...'
215-
216-
if srcinfo.too_much_text(maxtext):
217-
msg = [
218-
'too much text, try to increase MAX_SIZES[MAXTEXT] in cpython/_parser.py',
219-
f'{filename} starting at line {lno_from} to {lno_to}',
220-
f'has code with length {len(text)} greater than {maxtext}:',
221-
text
222-
]
223-
raise Exception('\n'.join(msg))
224-
225-
if srcinfo.too_much_lines(maxlines):
226-
msg = [
227-
'too much lines, try to increase MAX_SIZES[MAXLINES] in cpython/_parser.py',
228-
f'{filename} starting at line {lno_from} to {lno_to}',
229-
f'has code with number of lines {lno_to - lno_from} greater than {maxlines}:',
230-
text
231-
]
232-
raise Exception('\n'.join(msg))
233-
234-
raise Exception(f'unmatched text ({filename} starting at line {lno_from}):\n{text}')
214+
raise Exception(f'unmatched text ({filename} starting at line {lno}):\n{text}')

Tools/c-analyzer/c_parser/parser/_info.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,10 @@ def resolve(self, kind, data, name, parent=None):
123123
def done(self):
124124
self._set_ready()
125125

126-
def too_much_text(self, maxtext):
127-
return maxtext and len(self.text) > maxtext
128-
129-
def too_much_lines(self, maxlines):
130-
return maxlines and self.end - self.start > maxlines
131-
132126
def too_much(self, maxtext, maxlines):
133-
if self.too_much_text(maxtext):
127+
if maxtext and len(self.text) > maxtext:
134128
pass
135-
elif self.too_much_lines(maxlines):
129+
elif maxlines and self.end - self.start > maxlines:
136130
pass
137131
else:
138132
return False

0 commit comments

Comments
 (0)