Commit cc12e9c8 authored by Fred Drake's avatar Fred Drake

Fix up the extraction of optional parameters a little.

Be more informative in an exception message.
parent 20bfe26f
...@@ -26,7 +26,7 @@ _end_env_rx = re.compile(r"[\\]end{([^}]*)}") ...@@ -26,7 +26,7 @@ _end_env_rx = re.compile(r"[\\]end{([^}]*)}")
_begin_macro_rx = re.compile("[\\\\]([a-zA-Z]+[*]?)({|\\s*\n?)") _begin_macro_rx = re.compile("[\\\\]([a-zA-Z]+[*]?)({|\\s*\n?)")
_comment_rx = re.compile("%+[ \t]*(.*)\n") _comment_rx = re.compile("%+[ \t]*(.*)\n")
_text_rx = re.compile(r"[^]%\\{}]+") _text_rx = re.compile(r"[^]%\\{}]+")
_optional_rx = re.compile(r"[[]([^]]*)[]]") _optional_rx = re.compile(r"\s*[[]([^]]*)[]]")
_parameter_rx = re.compile("[ \n]*{([^}]*)}") _parameter_rx = re.compile("[ \n]*{([^}]*)}")
_token_rx = re.compile(r"[a-zA-Z][a-zA-Z0-9.-]*$") _token_rx = re.compile(r"[a-zA-Z][a-zA-Z0-9.-]*$")
_start_group_rx = re.compile("[ \n]*{") _start_group_rx = re.compile("[ \n]*{")
...@@ -181,8 +181,8 @@ def subconvert(line, ofp, table, discards, autoclosing, knownempty, ...@@ -181,8 +181,8 @@ def subconvert(line, ofp, table, discards, autoclosing, knownempty,
m = _parameter_rx.match(line) m = _parameter_rx.match(line)
if not m: if not m:
raise LaTeXFormatError( raise LaTeXFormatError(
"could not extract parameter group: " "could not extract parameter %s for %s: %s"
+ `line`) % (attrname, macroname, `line[:100]`))
value = m.group(1) value = m.group(1)
if _token_rx.match(value): if _token_rx.match(value):
dtype = "TOKEN" dtype = "TOKEN"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment