Skip to content

Commit

Permalink
Improve xparse messages, especially for environments
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Le Floch committed Feb 27, 2019
1 parent 5d2552a commit bb50b33
Show file tree
Hide file tree
Showing 6 changed files with 213 additions and 226 deletions.
2 changes: 1 addition & 1 deletion l3packages/CHANGELOG.md
Expand Up @@ -12,7 +12,7 @@ this project uses date-based 'snapshot' version identifiers.

### Changed
- `xparse`: make \IfBooleanTF safer
- `xparse`: clearer error messages
- `xparse`: clearer error messages, especially for environments

## [2018-09-24]

Expand Down
46 changes: 20 additions & 26 deletions l3packages/xparse/testfiles/xparse003.tlg
Expand Up @@ -8,40 +8,37 @@ I got '\foo*-%#^^-{}
I got '\foo*-%^^-{}
I got '\foo[ak]-%-{}
I got '\foo[a]-bcd-{de}
! LaTeX3 Error: The verbatim command '\foo ' cannot be used inside an
(LaTeX3) argument.
! LaTeX3 Error: The verbatim command '\foo' cannot be used inside an argument.
For immediate help type H <return>.
...
l. ...\use:n {\foo*+&#~+}
The command '\foo ' takes a verbatim argument. It may not appear within the
The command '\foo' takes a verbatim argument. It may not appear within the
argument of another function. It received an illegal token '##'.
LaTeX will ignore '+&'.
I got '\foo*--NoValue--{##}
! LaTeX3 Error: The verbatim command '\foo ' cannot be used inside an
(LaTeX3) argument.
! LaTeX3 Error: The verbatim command '\foo' cannot be used inside an argument.
For immediate help type H <return>.
...
l. ...\use:n {\foo[\ab]+\ab+}
The command '\foo ' takes a verbatim argument. It may not appear within the
The command '\foo' takes a verbatim argument. It may not appear within the
argument of another function. It received an illegal token '\ab '.
LaTeX will ignore '+'.
I got '\foo[\ab ]--NoValue--{\ab }
! LaTeX3 Error: The verbatim command '\foo ' cannot be used inside an
(LaTeX3) argument.
! LaTeX3 Error: The verbatim command '\foo' cannot be used inside an argument.
For immediate help type H <return>.
...
l. ...\use:n {\foo\abc\ }
The command '\foo ' takes a verbatim argument. It may not appear within the
The command '\foo' takes a verbatim argument. It may not appear within the
argument of another function. It received an illegal token '\abc '.
LaTeX will ignore ''.
I got '\foo--NoValue--{\abc }
! LaTeX3 Error: Verbatim argument of '\foo ' ended by end of line.
! LaTeX3 Error: Verbatim argument of command '\foo' ended by end of line.
For immediate help type H <return>.
...
l. ...\foo+a
The verbatim argument of '\foo ' cannot contain more than one line, but the
end of the current line has been reached. You may have forgotten the closing
delimiter.
The verbatim argument of the command '\foo' cannot contain more than one line,
but the end of the current line has been reached. You may have forgotten the
closing delimiter.
LaTeX will ignore '+a'.
I got '\foo--NoValue--{+}
I got '\foo-b-{}
Expand All @@ -51,22 +48,21 @@ I got '\foo-%#$|+-{}
I got '\foo-@#${%{$}#}-{}
I got '\foo-{{}}-{}
I got '\foo--{}
! LaTeX3 Error: Verbatim argument of '\foo ' ended by end of line.
! LaTeX3 Error: Verbatim argument of command '\foo' ended by end of line.
For immediate help type H <return>.
...
l. ...\foo{
The verbatim argument of '\foo ' cannot contain more than one line, but the
end of the current line has been reached. You may have forgotten the closing
delimiter.
The verbatim argument of the command '\foo' cannot contain more than one line,
but the end of the current line has been reached. You may have forgotten the
closing delimiter.
LaTeX will ignore '{'.
I got '\foo--NoValue--{}
! LaTeX3 Error: The verbatim command '\foo ' cannot be used inside an
(LaTeX3) argument.
! LaTeX3 Error: The verbatim command '\foo' cannot be used inside an argument.
For immediate help type H <return>.
...
l. ...\foo#
{}
The command '\foo ' takes a verbatim argument. It may not appear within the
The command '\foo' takes a verbatim argument. It may not appear within the
argument of another function. It received an illegal token '##'.
LaTeX will ignore ''.
I got '\foo--NoValue--{##}
Expand All @@ -87,20 +83,18 @@ I've got \foo--{}--
I've got \foo-
-{ }-
-
! LaTeX3 Error: The verbatim command '\foo ' cannot be used inside an
(LaTeX3) argument.
! LaTeX3 Error: The verbatim command '\foo' cannot be used inside an argument.
For immediate help type H <return>.
...
l. ...\foo#
The command '\foo ' takes a verbatim argument. It may not appear within the
The command '\foo' takes a verbatim argument. It may not appear within the
argument of another function. It received an illegal token '##'.
LaTeX will ignore ''.
! LaTeX3 Error: The verbatim command '\foo ' cannot be used inside an
(LaTeX3) argument.
! LaTeX3 Error: The verbatim command '\foo' cannot be used inside an argument.
For immediate help type H <return>.
...
l. ...\foo#
The command '\foo ' takes a verbatim argument. It may not appear within the
The command '\foo' takes a verbatim argument. It may not appear within the
argument of another function. It received an illegal token '##'.
LaTeX will ignore ''.
I've got \foo--NoValue----NoValue--
Expand Down
72 changes: 30 additions & 42 deletions l3packages/xparse/testfiles/xparse004.luatex.tlg
Expand Up @@ -24,86 +24,76 @@ TEST 2: Basic definitions R-type arguments
============================================================
TEST 3: r-type argument errors
============================================================
! LaTeX3 Error: Failed to find required argument starting with '(' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '('. LaTeX did
The current command '\foo' expects an argument starting with '('. LaTeX did
not find it, and will insert a default value to be processed.
(-NoValue-)(-NoValue-)(there)
! LaTeX3 Error: Failed to find required argument starting with '(' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '('. LaTeX did
The current command '\foo' expects an argument starting with '('. LaTeX did
not find it, and will insert a default value to be processed.
(nothing)(-NoValue-)(there)
! LaTeX3 Error: Failed to find required argument starting with '[' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '['. LaTeX did
The current command '\foo' expects an argument starting with '['. LaTeX did
not find it, and will insert a default value to be processed.
(stuff)(is)(-NoValue-)
! LaTeX3 Error: Failed to find required argument starting with '(' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '('. LaTeX did
The current command '\foo' expects an argument starting with '('. LaTeX did
not find it, and will insert a default value to be processed.
! LaTeX3 Error: Failed to find required argument starting with '(' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '('. LaTeX did
The current command '\foo' expects an argument starting with '('. LaTeX did
not find it, and will insert a default value to be processed.
(-NoValue-)(-NoValue-)
============================================================
============================================================
TEST 4: R-type argument errors
============================================================
! LaTeX3 Error: Failed to find required argument starting with '(' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '('. LaTeX did
The current command '\foo' expects an argument starting with '('. LaTeX did
not find it, and will insert a default value to be processed.
(-NoValue-)(drat)(there)
! LaTeX3 Error: Failed to find required argument starting with '(' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '('. LaTeX did
The current command '\foo' expects an argument starting with '('. LaTeX did
not find it, and will insert a default value to be processed.
(nothing)(drat)(there)
! LaTeX3 Error: Failed to find required argument starting with '[' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '['. LaTeX did
The current command '\foo' expects an argument starting with '['. LaTeX did
not find it, and will insert a default value to be processed.
(stuff)(is)(drat)
! LaTeX3 Error: Failed to find required argument starting with '(' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '('. LaTeX did
The current command '\foo' expects an argument starting with '('. LaTeX did
not find it, and will insert a default value to be processed.
! LaTeX3 Error: Failed to find required argument starting with '(' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '('. LaTeX did
The current command '\foo' expects an argument starting with '('. LaTeX did
not find it, and will insert a default value to be processed.
(drat)(drat)
============================================================
Expand Down Expand Up @@ -529,24 +519,22 @@ TEST 11: SplitList
============================================================
TEST 12: Test ## in argument specification
============================================================
! LaTeX3 Error: Failed to find required argument starting with '(' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '('. LaTeX did
The current command '\foo' expects an argument starting with '('. LaTeX did
not find it, and will insert a default value to be processed.
1|##|\BooleanFalse |{1##}{2##}|...|A|##|C|D
##|1|\BooleanFalse |{1##}{2##}|...|A|B|C|D
##|##|\BooleanTrue |{1##}{2##}|...|A|B|C|D
##|##|\BooleanFalse |{1##}{1}|...|A|B|C|D
1|2|\BooleanTrue |{3}{4}|...|A|B|C|D
! LaTeX3 Error: Failed to find required argument starting with '(' for command
(LaTeX3) '\foo '.
! LaTeX3 Error: Missing required argument for command '\foo'.
For immediate help type H <return>.
...
l. ... }
The current command '\foo ' expects an argument starting with '('. LaTeX did
The current command '\foo' expects an argument starting with '('. LaTeX did
not find it, and will insert a default value to be processed.
1|##|\BooleanFalse |{1##}{2##}|...|A|##|C|D
##|1|\BooleanFalse |{1##}{2##}|...|A|B|C|D
Expand All @@ -567,12 +555,12 @@ TEST 13: Defaults referring to other arguments
\A |{\B }{2}\C \A |{\B }{2}|{\B }{2}\C |\C
\A |\A |{1}{2}|{1}{2}\B |\B
\A |\A |{1}{2}|\B |\C
! LaTeX3 Error: Circular dependency in defaults of '\foo '.
! LaTeX3 Error: Defaults of command '\foo' have circular dependency.
For immediate help type H <return>.
...
l. ... }
The default values of two or more arguments of '\foo ' depend on each other in
a way that cannot be resolved.
The default values of two or more arguments of the command '\foo' depend on
each other in a way that cannot be resolved.
{1}{\A }\B {1}{\A }\B {1}{\A }\B {-NoValue-}{\A }\B -NoValue-|{1}{\A }\B {1}{\A }\B {1}{\A }\B {1}{\A }\B -NoValue--NoValue-|{1}{\A }|{1}{\A }\B |\B
-NoValue-|-NoValue-|{1}{2}||\B
\A |{\B }{\C }\D \A |{\B }{\C }|{\B }{\C }\D |\D
Expand All @@ -587,7 +575,7 @@ TEST 14: Test ## in expandable argument specification
============================================================
! Undefined control sequence.
<argument> \LaTeX3 error:
Failed to find required argument starting with '(' for command
Missing required argument for \foobar.
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
Expand All @@ -604,7 +592,7 @@ TEST 15: Refer to other args (expandable)
============================================================
! Undefined control sequence.
<argument> \LaTeX3 error:
Circular dependency in defaults of '\foobar '.
Defaults of \foobar have circular dependency.
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
Expand All @@ -613,7 +601,7 @@ spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
<argument> \LaTeX3 error:
Circular dependency in defaults of '\foobar '.
Defaults of \foobar have circular dependency.
l. ... }
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
Expand Down

0 comments on commit bb50b33

Please sign in to comment.