Skip to content

Commit

Permalink
makePDF: special error reporting for unclosed parens in commands
Browse files Browse the repository at this point in the history
  • Loading branch information
msiniscalchi committed Jun 17, 2012
1 parent f29d3b5 commit 90b97be
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions makePDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def handle_warning(l):
# Use our own iterator instead of for loop
log_iterator = log.__iter__()
line_num=0
line = ""

recycle_extra = False # just in case

Expand All @@ -78,6 +79,8 @@ def handle_warning(l):
#print "Recycling line"
recycle_extra = False
else:
# save previous line for "! File ended while scanning use of..." message
prev_line = line
try:
line = log_iterator.next() # will fail when no more lines
except StopIteration:
Expand Down Expand Up @@ -163,6 +166,16 @@ def handle_warning(l):
line = line_purged
else:
break
# Special error reporting for e.g. \footnote{text NO MATCHING PARENS & co
if "! File ended while scanning use of" in line:
scanned_command = line[35:-2] # skip space and period at end
# we may be unable to report a file by popping it, so HACK HACK HACK
file_name = log_iterator.next() # <inserted text>
file_name = log_iterator.next() # \par
file_name = log_iterator.next()[3:] # here is the file name with <*> in front
errors.append("TeX STOPPED: " + line[2:-2]+prev_line[:-5])
errors.append("TeX reports the error was in file:" + file_name)
continue
if "! ==> Fatal error occurred, no output" in line:
continue
if "! Emergency stop." in line:
Expand Down

0 comments on commit 90b97be

Please sign in to comment.