Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by h1439878.stratoserver.net (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id t7TKfiUR004237 for ; Sat, 29 Aug 2015 22:41:45 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx006) with ESMTPS (Nemesis) id 0Ldcd0-1YnPqj0rWE-00ikRm for ; Sat, 29 Aug 2015 22:41:39 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t7TKdu8k018682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 29 Aug 2015 22:39:56 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t7TGJ7lu020412; Sat, 29 Aug 2015 22:39:56 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 12524816 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Sat, 29 Aug 2015 22:39:55 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t7TKdtMr029067 for ; Sat, 29 Aug 2015 22:39:55 +0200 Received: from smtp5.clear.net.nz (smtp5.clear.net.nz [203.97.33.68]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t7TKdmQM018637 for ; Sat, 29 Aug 2015 22:39:51 +0200 Received: from mxin1-orange.clear.net.nz (lb1-srcnat.clear.net.nz [203.97.32.236]) by smtp5.clear.net.nz (CLEAR Net Mail) with ESMTP id <0NTV00DH52Q7OE30@smtp5.clear.net.nz> for LATEX-L@listserv.uni-heidelberg.de; Sun, 30 Aug 2015 08:39:46 +1200 (NZST) Received: from 118-92-83-128.dsl.dyn.ihug.co.nz (HELO [127.0.0.1]) ([118.92.83.128]) by smtpin1.clear.net.nz with ESMTP; Sun, 30 Aug 2015 08:39:45 +1200 MIME-version: 1.0 Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit X-Antivirus: avast! (VPS 150827-1, 28/08/2015), Outbound message X-Antivirus-Status: Clean References: <55DBB7F6.1070307@clear.net.nz> <55DABA1D.3050706@morningstar2.co.uk> <55DCFDF7.7080305@clear.net.nz> <55DC05BF.1040505@morningstar2.co.uk> <55DC28E8.9090405@morningstar2.co.uk> <55DDFD0A.4000901@clear.net.nz> <55DDACCB.1070104@morningstar2.co.uk> <55DF523F.2050905@clear.net.nz> <55DF48BE.5030503@residenset.net> <55DF5276.7010500@morningstar2.co.uk> <55DF70B2.1090700@morningstar2.co.uk> <55E09AA8.6070100@residenset.net> <55E176DB.6000109@clear.net.nz> <87bndq2yr6.fsf@fencepost.gnu.org> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 Message-ID: <55E2188B.2050209@clear.net.nz> Date: Sun, 30 Aug 2015 08:39:39 +1200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: aparsloe Subject: Re: Catcode changes To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <87bndq2yr6.fsf@fencepost.gnu.org> 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-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:lf9uAQD0T9c=:wJfkLGl732Lm2lhoivnYxI+Yra at1P34Gry5rOzgRaqTx+0cuHFmsl8vH7am9DnwVilu9KVyrY0DiVcaWdFlz73WmmghZdTtYzg 5CLpGT8zDIAo7GtU4tLT6gsJT1xPSlwaFfA25lV1VudL8HVqIBDGx/yKXiT/C0z6HUAabomnU CPf0E45aTfk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2Rv/ cabTjEMq8ktHIrZlZ6sI/bwTIwngzKFpBKNDueoDdNMAG5Q+6sQCgjCuqAQynZESsKKH75Ys2 2bx+xSiBWzeb4DlAc60QnA5LOi0wFq07uXOhMrT3V9zRyhfjyLMLHROYwrsQe6RAApGtb17b+ pMw01gfNdsOR0+P6HblK+rFoZASS6Pc9nwQ612YexR33ma5q38LQaqTZBvXuqFSO9xXQ3Vc5l KGG57YrySsNc233DJDr/Fg3Iwz4Qln3vt7I/trngdsXiTQj6LK X-UI-Loop:V01:fVWuOelM86I=:r4Z5KV3exZAlE9N5JrIjbHGD07o702IQTQgEJ0hoZB8= X-UI-Out-Filterresults: notjunk:1;V01:K0:XnAK0ksdmCs=:c9Fbh/swrPbax51vwfb3Rf QKHbf7msATvFuskK7rqzqr4oKiIutTbnyBGetOKnhgUOpy25/DgAo9zhlcrBVdduNzG9j6kge P+clhjV7Z5+NNRAvQz/1LC+D8SKq3QSL0Xa9JWfo3doe+3IL8a5oTF50fmVSp9bgXZ/rLNKrj BFJsUr2hkEd7KjR8A2kaLLm4Tq7sbLpUVkZeCwbp22T4zhBZgQ8TRkr80jJq6W29NHROv4OxS GjPD3o3Owb+3pAiD+UugB/wEDU91G1yslNS+M37g1ut3z5oNkLbN1TlNiQMgs6ZXEPSQiEnO3 L5i5qtKGhFS5uEowJJZh1KcNYoXhq0QF7uzI45f0DalljjwTdQmLjHdtJqS7hW+IsG4IcHS61 X7B3j4bwb1FzHnV8dG8WBQDSBYn5h5t2fgoZDJiTQWJHyKCHhoMHBOezzMM+r6EWcHF+nJ1mo kN4MyIav0zaSF7j99/YjcMi/jwqwZwZOqIpczOOU/tMQAQei6B6v X-Scanned-By: MIMEDefang 2.71 on 85.214.41.38 Status: R X-Status: X-Keywords: X-UID: 7859 On 29/08/2015 10:08 p.m., David Kastrup wrote: > aparsloe writes: > >> On 29/08/2015 9:26 a.m., Bruno Le Floch wrote: >>> Joseph understood your point perfectly well. Xparse takes care of >>> matching nested parentheses, and does that expandably too. It would >>> be possible for Andrew to abuse xparse to grab his parenthesized >>> group, but I am not sure whether I want to advise this or not. It >>> would also be possible to simply copy the code, but finding out >>> where this is done in xparse's code is non-trivial. I could also >>> just provide code that does that, but it would take 30 minutes to >>> get completely right and clean (the code needs to carefully preserve >>> braces when grabbing delimited arguments, for instance). Using >>> \tl_set_rescan:Nnn seems reasonable given the above. >>> Bruno >> The suggestion that the documentation note the use of empty setups for >> \tl_set_rescan:Nnn seems to have sparked a wider discussion (much of >> it beyond me, but interesting as a spectator). The final area where >> I've used rescanning is in parsing nested commas for functions of >> multiple arguments. l3fp has max and min. It is easy to translate an >> expression involving possibly nested \max and \min to a form that l3fp >> can digest. All the hard parsing work is conducted out of sight in >> l3fp. But there are other functions, like greatest common divisor, >> \gcd, which have no corresponding l3fp member. To handle an expression >> like \gcd(15,24,33) I equate a comma list to the argument 15,24,33 >> then pop the items of the comma list into token list variables which >> can be converted to integers and fed to the gcd algorithm. But for a >> nested expression like >> >> \gcd(\max(7+\max(5,2),8),\min(24,29),10+5,\gcd(30,45,6)) >> >> the argument of the outer \gcd can't be equated to a comma list >> without mangling the mathematical syntax. I've treated this by >> rescanning ( and ) to group begin and end in the argument token list, >> then equating a comma list to the rescanned argument. The individual >> items of the comma list are now the correct ones. The token lists >> resulting on popping items from the comma list are then rescanned with >> an empty setup to get everything back to "normal", converted to >> integers and fed to the gcd algorithm. >> >> To me the way rescanning cuts through the complexity makes it seem (as >> they say in medicine of an effective drug) like a magic bullet. > At one point of time I wrote some stuff in order to read the Lisp-like > PL files written by tfm2pl. To avoid any O(n^2) behavior, the bulk of > the reading was done in one large \edef where ( had active character > syntax and ) had group closing syntax if I remember correctly. Maybe > some of the trickery used in \lispdef and friends might be > inspirational, so I'll just append the code here. Mind: this is not > production code and I don't think I ever got to using it or anything. > But it did accomplish the parsing. > > Maybe it does not actually help since you _have_ to set up weird > catcodes before starting and that may be not compatible with your > requirements. > Thank you David. It is always helpful (and perhaps a little daunting) to see what others have done. Andrew --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus