Skip to content

Commit

Permalink
More parselog fixes
Browse files Browse the repository at this point in the history
xypic special handling, "[]" as over/underfull end marker
  • Loading branch information
msiniscalchi committed Nov 7, 2012
1 parent 7f05bd9 commit 5d75143
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion parseTeXlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def parse_tex_log(data):
line_rx_latex_warn = re.compile(r"input line (\d+)\.$") # Warnings, line number
matched_parens_rx = re.compile(r"\([^()]*\)") # matched parentheses, to be deleted (note: not if nested)
assignment_rx = re.compile(r"\\[^=]*=") # assignment, heuristics for line merging
xypic_rx = re.compile(r".*? loaded\)(.*)") # crazy xypic way to declare end of file processing

files = []

Expand Down Expand Up @@ -295,14 +296,31 @@ def handle_warning(l):
break
line_num += 1
debug("Over/underfull: skip " + line + " (%d) " % line_num)
if len(line)>0 and line[0:3] == " []":
# Sometimes it's " []" and sometimes it's "[]"...
if len(line)>0 and line in [" []", "[]"]:
ou_processing = False
if ou_processing:
errors.append("Malformed LOG file: over/underfull")
break
else:
continue

# Before we strip potential initial blank, match xypic's " loaded)" markers
xypic_match = xypic_rx.match(line)
if xypic_match:
debug("xypic match: " + line)
# Do an extra check to make sure we are not too eager: is the topmost file
# likely to be an xypic file? Look for xypic in the file name
if files and "xypic" in files[-1]:
debug(" "*len(files) + files[-1] + " (%d)" % (line_num,))
files.pop()
extra = xypic_match.group(1)
debug("Reprocessing " + extra)
reprocess_extra = True
continue
else:
debug("Found loaded) but top file name doesn't have xy")

line = line.strip() # get rid of initial spaces
# note: in the next line, and also when we check for "!", we use the fact that "and" short-circuits
if len(line)>0 and line[0]==')': # denotes end of processing of current file: pop it from stack
Expand Down

0 comments on commit 5d75143

Please sign in to comment.