LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Proportional Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Message-ID: <[log in to unmask]>
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
From: Michiel Helvensteijn <[log in to unmask]>
Date: Sat, 9 Mar 2013 12:55:25 +0100
Content-Type: text/plain; charset=ISO-8859-1
MIME-Version: 1.0
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments: text/plain (47 lines)
Hi all,

I encountered a bug in the \prop_map_tokens:Nn function in l3candidates.dtx.

Here's a not-working minimal example:

    \cs_set:Nn \test_mapper:nn
        { (#1,~#2)~ }
    \prop_new:N \testprop
    \prop_put:Nnn \testprop {1} {v1}
    \prop_put:Nnn \testprop {222} {v2}
    \prop_put:Nnn \testprop {3} {v3}
    \prop_put:Nnn \testprop {4} {v4}
    \prop_map_tokens:Nn \testprop { \test_mapper:nn }

The output will be:

(1, v1)2

It only processes single-token keys correctly. At the first
multi-token key, everything except for its first two tokens are
processed directly, then the rest of the list is skipped.

Here's the fix for l3candidates.dtx:

\cs_new:Npn \@@_map_tokens:nwn #1 \q__prop #2 \q__prop #3
    \__quark_if_recursion_tail_break:nN {#2} \prop_map_break:
    \use:n {#1} {#2} {#3}
    \@@_map_tokens:nwn {#1}

It just changes the tail-break test from :NN to :nN and adds braces around #2.