(\set, \value): Allow - and _ in @set variable names.

This commit is contained in:
Karl Berry 1996-11-09 23:37:11 +00:00
parent 84a9fd68b7
commit 10011ce289

View file

@ -868,7 +868,9 @@ where each line of input produces a line of output.}
% didn't need it. Make sure the catcode of space is correct to avoid % didn't need it. Make sure the catcode of space is correct to avoid
% losing inside @example, for instance. % losing inside @example, for instance.
% %
\def\set{\begingroup\catcode` =10 \parsearg\setxxx} \def\set{\begingroup\catcode` =10
\catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
\parsearg\setxxx}
\def\setxxx#1{\setyyy#1 \endsetyyy} \def\setxxx#1{\setyyy#1 \endsetyyy}
\def\setyyy#1 #2\endsetyyy{% \def\setyyy#1 #2\endsetyyy{%
\def\temp{#2}% \def\temp{#2}%
@ -889,10 +891,16 @@ where each line of input produces a line of output.}
% @value{foo} gets the text saved in variable foo. % @value{foo} gets the text saved in variable foo.
% %
\def\value#1{\expandafter \def\value{\begingroup
\ifx\csname SET#1\endcsname\relax \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
{\{No value for ``#1''\}} \parsearg\valuexxx}
\else \csname SET#1\endcsname \fi} \def\valuexxx#1{%
\expandafter\ifx\csname SET#1\endcsname\relax
{\{No value for ``#1''\}}%
\else
\csname SET#1\endcsname
\fi
\endgroup}
% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
% with @set. % with @set.