Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by h2774747.stratoserver.net (8.15.2/8.15.2/Debian-3) with ESMTP id wBO9Mg2K030343 for ; Mon, 24 Dec 2018 10:22:43 +0100 Received: from relay2.uni-heidelberg.de ([129.206.119.212]) by mx-ha.gmx.net (mxgmx015 [212.227.15.9]) with ESMTPS (Nemesis) id 1N9ewZ-1hP2ee1jU5-015Vgr for ; Mon, 24 Dec 2018 10:22:37 +0100 Received: from listserv.uni-heidelberg.de ([129.206.100.94]) by relay2.uni-heidelberg.de with ESMTP; 24 Dec 2018 10:22:38 +0100 Received: from listserv (localhost [127.0.0.1]) by listserv.uni-heidelberg.de (Postfix) with ESMTP id 0B1BA127EC0; Mon, 24 Dec 2018 10:22:35 +0100 (CET) Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 32154253 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 24 Dec 2018 10:22:35 +0100 Delivered-To: LATEX-L@listserv.uni-heidelberg.de Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (Postfix) with ESMTP id E5B93127E82 for ; Mon, 24 Dec 2018 10:22:34 +0100 (CET) X-IronPort-MID: 5731056 X-IronPort-RemoteIP: 209.85.128.46 X-IronPort-SenderGroup: UNKNOWNLIST X-IronPort-MailFlowPolicy: $ACCEPTED X-IronPort-Reputation: 2.8 IronPort-PHdr: =?us-ascii?q?9a23=3ATNCgOReJij+5mdRWKa/KAO4jlGMj4e+mFxMJ6p?= =?us-ascii?q?chl7NFe7ii+JKnBkHE+PFxlwaZAtfB5vZNmqzLtaGlWWEB7ZuFun0Yf9pAWk?= =?us-ascii?q?xNkt0YyionBsPNEkjnNLjydSVvHsNZWUdluW6hMEdVBO77YEfUo3u99iIbAE?= =?us-ascii?q?+5Pg0zO+emUpXKgZGR0Oa/s4bWfx0OgTO8Zb1oKxDjrwLKu9EWx5R4K6kx1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fanK4UrgzoD02W+fERc/OQJ6ghLuZ0W?= =?us-ascii?q?K1BJpTMypEDUuBCXeuaJ+FVPcQQCeVOMlglDMfSbG7Eckq0lezt0WprtgvZv?= =?us-ascii?q?qR4SAeuZ/5gZJ34PbejRF06iZ1AMSB+2SKVWd1mGwTWzYshuZ0pgpgyR3QtM?= =?us-ascii?q?owy+wdHttV6fRTVw48PpOJ1O12Bef5XQfZd8uIQlKrG4/0Ozw6Q9MvztNLWH?= =?us-ascii?q?5TQIn/3DbE2SfiQ6UYk7WaQoEy8+fc0nn9KsJ3xmzJkqUs3REgRYNUOGuqi7?= =?us-ascii?q?QalUCbDpPVk0ifi6ehdLgNlC/L+mCZyGOSvUZeGAduWKTBVHobawPYt9P8rk?= =?us-ascii?q?/FSravD/wgPG4jgYaaLbBWb9TykVhcbPLqOdCbfGfo3mnsW1CHwbSDaIescG?= =?us-ascii?q?IYnW3cBEUCjwEP7COGOAw5VULD6yrVCD1jE06qYlu5q7Ev7iPmCBZun0fWMR?= =?us-ascii?q?4pzbe+9x8LiObJUf4X16NCpSEg7jV5HVqw29jbEdXGqwcyGccUKd47/lpD0n?= =?us-ascii?q?rU8gJnOZn1ZaJlnVMGc0JopULh1wlfD4Jal8kso2g2xRAob6mflk5CPWD9v9?= =?us-ascii?q?i4KvjMJ2/+8Qr6IbbRwU3b2c2K970n7f05rxD8uVjsGBZ8tXpg1NZR3j2X4Z?= =?us-ascii?q?CAX29wGdrhF00w8RZ9vbTTZCIwspjV2XNbOq6xqjbe2tgtCbJ0mCblRM9WNe?= =?us-ascii?q?a/LCG3FsQbA8a0L+lwwwqsaQgCPeZd77I9JZngfPzAxa35ZL88zgLjtnxO5c?= =?us-ascii?q?VG6mzJ7zB1ELaa2pEfxfCe0RCbXi2mylym9N30y9gdOGMiW1GnwC2hP7Z/I6?= =?us-ascii?q?1/eYFRVDWrKsyzg8p73tvjByAe+1mkCFcLnsSufEjKYg=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CvAwAZpCBcgC6AVdFjHgEGBwaBZYI?= =?us-ascii?q?BbHAEMoN+lXIIJZkHA1QMAYRsAoJwGgYGNBIBAwEBAgEBAQEUAQEJDQkIJyU?= =?us-ascii?q?MhUoBAQEDAQEBIQ8BBQgBATIGBAsJAhgCAiYCAjQBBQEcBQENCAEBgx6Begg?= =?us-ascii?q?Di3yQCDyKKXCBL4J2AQEFgkOEVggJAQh5izSBVz+BOAyCMS6ICYJXoHNaBwK?= =?us-ascii?q?CJQSPOh6JewwFh1qTKoZYAgQCBAUCBQ8hgTyBdzMaND+CbIIbg22KUz8zAY9?= =?us-ascii?q?KAQE?= X-IronPort-AV: E=Sophos;i="5.56,391,1539640800"; d="scan'208";a="5731056" X-MGA-submission: =?us-ascii?q?MDHDM5SBDufXJiXzte76rdhPW/QOl0y+R3XEfi?= =?us-ascii?q?lCTyvHX3Njtmpbv0wDMfdsXrCHM7zAkm2o8IiVW0dv6tCdo0ucWhtdrh?= =?us-ascii?q?VlE0q2/TQCEZObMqzVmybUklnSO8nG9lTFOfq6RG66Lkp2VD3Ybc8r/s?= =?us-ascii?q?6JCG2RA+FsRBQ9OSvC9g2e1Q=3D=3D?= Received: from mail-wm1-f46.google.com ([209.85.128.46]) by relay.uni-heidelberg.de with ESMTP/TLS/AES128-GCM-SHA256; 24 Dec 2018 10:22:35 +0100 Received: by mail-wm1-f46.google.com with SMTP id y139so10655458wmc.5 for ; Mon, 24 Dec 2018 01:22:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=w5bnCmSOOX8hP46+FY1tZbi/jZFv76lz45HZvDZfce4=; b=VIj3HQpW3EM0c0CD3qO88Imy+GnsfuD6Gv+7ZoG+d4QnSeMvZOa2SzAeBozQMedXr8 qLgVDoR7dyOJIseJFeJtPRQLXsilNxqs0I/OWcQKBr7MRQrCeGtb/Zxa54KVpJmTLHLo Bqz9zsvZVeafO4kW+bZU54J7T/0y8Lk6qDKIYf6ff/CG7nMlRTuR0IMpgKi4H1atEDDF 5UryMBXe2C3NTIfoA+6XGjzb+ZqYavfKXiWlS4XqIuAWy1TuI8GcUSfdLfLMsCM+iKiF CR1fKQS59WocevekuB/qOCplPh/iNpzPag6o5UbfwGqmoYHVYICUYsorYp8s7K2xJV// Gbyw== X-Gm-Message-State: AA+aEWYADgDhN/NWoh8nWYj84TKB1UWtkpEznVZhU6l8BU03mBdQMKMl Cyb02bLdUcgxdWE3dXXLB823i+oGI9Y= X-Google-Smtp-Source: AFSGD/UKYPH9/TMvfblWMu2GvpknqXHg5C6lUfLtvjY3WA4nbq6b7qOUcvhH8ZOEDLCT0fD5eCOMVw== X-Received: by 2002:a1c:6508:: with SMTP id z8mr11795881wmb.28.1545643353675; Mon, 24 Dec 2018 01:22:33 -0800 (PST) Received: from [192.168.1.4] (54.230.7.51.dyn.plus.net. [51.7.230.54]) by smtp.gmail.com with ESMTPSA id j8sm44564177wmd.0.2018.12.24.01.22.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Dec 2018 01:22:33 -0800 (PST) References: <35e5f75d-508a-056f-45dd-c91c35083a29@gmail.com> User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Message-ID: <1c30f2f2-4443-5900-9392-2b3b489832b4@morningstar2.co.uk> Date: Mon, 24 Dec 2018 09:22:33 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: What does this function place into the input stream? To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <35e5f75d-508a-056f-45dd-c91c35083a29@gmail.com> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-Spam-Flag: NO X-UI-Filterresults: notjunk:1;V03:K0:g/qOfvH0lBc=:t/qQXNVRZhU0Xt40BJuz/hSuJP ld4aa8vrJfHiWaYkhT7uA0If6w6PFalFLSnSVFuhMFmQRGsj4WpOEUm8nKxvtnUkD5/g6XYuW ZJ2Ioi/NjTmw0q0zUAxEce0fhJYdGGgdHC9xEwpll7O+nFNnay0ewL1Izr8UgWUbsyNOduWBc lJ48Qe9b52q4zkGagDoLkPjgMBBS64oQUEIW2QWbm7JbCki9piDt8h106XiuMgmIDqJE0PPFu r6QIS6GM8U/DwzN9FuYZrBSNzOqvrgONS9H7Sq2WBWYWc1IzIUmZjs4OvcV/YNIZp3Q/UMzAn wKV81S7RSjis6KKdXAZFl3ZYiGrquS2aDk2y8tEsJpEU26llqSzWFavOAhi40KQaNgOHRucH5 1znbIRhaeQUCTzL9LOhd2yZ/WvGz3ptlPNjuyrCeVIAeP4xKNkeaCT6VSJAl2BsD3EuC5ttCw r1qNIHAulniRXShsRXvMhTQaJ0kAZlSq+TEikEVY+Iq2YNiIdjwBNx03xjZO9RqQ4NNfDn8Im AumDc2QwdCX8LORFmlc38G7lwvpw+Ot08ELEV4iCRQcl1lxlBhEB1JP76Cz5ko04y3PnI2ksc agIsOyWvVp4/gQfC3AXILBqCc6eUv8Go+vooEvF0WiBV13Ww41BIfTMnHDMTs7U3/He0wZIBw 6vQHEdvcAlpoGldTqbRInoyieExoZkZr5xko7Dy/4eGA/Jo9lGvp4awQSkOExTvLQe8WFS3z4 29OJObSyVddQynPd6YiyrKh4tQIpIYdhmnQKCRA8FWWLSsRdqJ/ADgmrkUGq3RfwW+nZ2xz0A eYZ2sifaJopOD9/oIKLN2YxCVbWa95NCvFNkoQOG5RHrlccb/iolJy+saXJXtfrYs4EXr0Bc6 irJ/SbaTdtAHHvq2j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pu7r9WETHPJKWca4LrNgTZrbWWZE8WCN5KxZ9qBhfTWBBY/76P73BVu4nUP81V3PqE 3W9VMo/PtaB/76/DBhTrA= X-UI-Loop:V01:wO5yimqhgrA=:s1QCr0FqWk1W55h6GxvwUtX16L67R7hX1vfonfxaFv4= X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Dhy3OqeHhK8=:2tPLqNpGhfUlX00Y/fSK/H 1xMB5R1/zP94WGab6vBbcpnmyt4lsK0fcIGcwAgTJFbDeeEvB/HG94R1HyxKy2JMJbjeyzPaz uIDc923SbGuSyj7iFAIFqf52awuuopkSxFPpqdf0lIweiMtaCCUUV5Gn+SVOSn9o5jK6VYZG9 +0mu2blcc0fZWTCvXincYAaE1nm6YJFZrvvhAkl/TieT0Y+yuUA4Uq+EYAtplxpQsti8DhUVf tVn4et5RRQ43rQt8f4gzVM9SL333cRsEQfDcb0BtiywRSr3hdWrggum0VE29NULnS9VBWpk4H U8M3PbXiuFEz3aeudsXCHOSdSNs6onluH7isnNPy/6tdAVQ/4nCYz39CRR/e5q4cviQsLKoOC 6t2Uq+YBWM4z3Wf9LJLfkUqzTsDo2x0O55LPOC4X9dHRlYJgHhFM6QMKtZdBv X-Scanned-By: MIMEDefang 2.78 on 81.169.212.23 Status: R X-Status: X-Keywords: X-UID: 8133 On 24/12/2018 08:13, Tisha Shusho wrote: > Hello List, > > I am trying to understand the expl3 conventions by looking at its source > files. Bear in mind that the code here is often optimised or is set up for bootstrapping, particularly if you look at the early stuff. > As I understand, after the first level of expansion it becomes: > > \prg_new_conditional:Npnn \token_if_macro:N #1 % Line 1 >   { p , T ,  F , TF }                          % Line 2 >   {                                            % Line 3 >     \exp_after:wN \__token_if_macro_p:w        % Line 4 >     \token_to_meaning:N #1 ma:                 % Line 5 >       \q_stop                                  % Line 6 >   }                                            % Line 7 > \cs_new:Npn \__token_if_macro_p:w              % Line 8 >   #1 ma #2 : #3 \q_stop                        % Line 9 >   {                                            % Line 10 >     \str_if_eq:nnTF { #2 } { cro }             % Line 11 >       { \prg_return_true: }                    % Line 12 >       { \prg_return_false: }                   % Line 13 >   } Yes: the x-type expansion is just dealing with the catcode-12 business. > The category codes of all characters in ma: (in line 5), > ma (in line 9), and : (in line 9) are 12. > Now let's suppose that the arguments are > \aaa whose meaning is "zzz", bbb, and x respectively. > So, after the second level of expansion, I think the > following piece of code is placed into the input stream: > > \prg_new_conditional:Npnn \token_if_macro:N \aaa % Line 1 >   { p , T ,  F , TF }                            % Line 2 >   {                                              % Line 3 >     \__token_if_macro_p:w                        % Line 4 >     zzzma:                                       % Line 5 >                                                  % Line 6 >   }                                              % Line 7 > \cs_new:Npn \__token_if_macro_p:w                % Line 8 >   zzzmabbb:x                                     % Line 9 >   {                                              % Line 10 >     \str_if_eq:nnTF { bbb } { cro }              % Line 11 >       { \prg_return_true: }                      % Line 12 >       { \prg_return_false: }                     % Line 13 >   } > > Shouldn't the token "\aaa" in Line 1 and zzz in > line 5 and 9 be replaced with "#1", because the function > \prg_new_conditional:Npnn expects a parameter to be there? > > Also, I am not quite sure about the expansion in Line 9. > Any help would be gratefully appreciated. You are trying to do two things at once :) In particular, you are thinking that #1, #2, #3, etc. have a fixed meaning 'within one macro'. They don't: at *each* step, we have to work out what they mean. TeX is a macro expansion language, so we need to step through the way it does. When you have input \token_if_macro:NTF \aaa it's replaced by the meaning of \token_if_macro:NTF with #1 replaced by \aaa. So we have \exp_after:wN \__token_if_macro_p:w \token_to_meaning:N \aaa ma: \q_stop Then we expand along \__token_if_macro_p:w zzzma: \q_stop and again do replacement, this time matching #1 and #2 for \__token_if_macro_p:w. That is a delimited argument so we have #1 = zzz #2 = [empty] #3 = [empty] which means we have \str_if_eq:nnTF { } { cro } { \prg_return_true: } { \prg_return_false: } Our test is false, and after that all gets expanded we hit \prg_return_false:. There's then some code to deal with the result, and it is only at that stage that the two 'payload' arguments become important. The code that absorbs them is 'hidden away' inside \prg_return_(true|false):. (Try \cs_show:N \prg_return_false:, for example.) This is a common TeX trick: we don't have to absorb all arguments 'up front'. They'll sit there in the input stream until we deal with them ... Joseph