Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id p4SHZYpH028234 for ; Sat, 28 May 2011 19:35:35 +0200 Received: (qmail 7062 invoked by alias); 28 May 2011 17:35:29 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 28 May 2011 17:35:28 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx073) with SMTP; 28 May 2011 19:35:28 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p4SHXTv9008441 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 28 May 2011 19:33:29 +0200 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p4RM17Hg002144; Sat, 28 May 2011 19:33:28 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1212935 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Sat, 28 May 2011 19:33:28 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p4SHXS4G017011 for ; Sat, 28 May 2011 19:33:28 +0200 Received: from mail-gy0-f177.google.com (mail-gy0-f177.google.com [209.85.160.177]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p4SHXMlQ008410 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Sat, 28 May 2011 19:33:27 +0200 Received: by gyh20 with SMTP id 20so1665448gyh.22 for ; Sat, 28 May 2011 10:33:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.170.66 with SMTP id o42mr2203618yhl.109.1306604002481; Sat, 28 May 2011 10:33:22 -0700 (PDT) Received: by 10.147.39.17 with HTTP; Sat, 28 May 2011 10:33:22 -0700 (PDT) References: <4DE12DD9.9000805@morningstar2.co.uk> Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Whitelist: Message-ID: Date: Sat, 28 May 2011 13:33:22 -0400 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Bruno Le Floch Subject: Re: xparse, "while" argument type To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <4DE12DD9.9000805@morningstar2.co.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (eXpurgate); Detail=5D7Q89H36p4yCuwxJv6KY0FCZRnwZ+13Gv1223zzWdOdBAOka29h/MWyfsFFfKX09pQbd flrub0Slp+Z//eZdwj0OIROHaGTjiMiAl7lyd355mCYC+mMV9vWuUdqj4/pJg7qZwM5Crw7huCAS 8S270C4RA7ifsY+LX0g3JOD50usrfQHfAek5kAQKN0hWAjJ/e5Jqn+epHk5f0wIEkUsyw==V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 6771 On 5/28/11, Joseph Wright wrote: > On 28/05/2011 18:08, Bruno Le Floch wrote: >> Hello all, >> >> on the TeX.stackexchange Q&A website [1], was asked the following >> question: how do I get with xparse a macro with three optional >> arguments: >> (without the <>). This can be achieved by providing a new argument >> type, which collects tokens as long as they obey a user-defined >> condition. Namely, >> >> \DeclareDocumentCommand{\X} >> { >> W { \token_if_eq_meaning:NNTF * } >> W { \token_if_eq_meaning:NNTF ' } >> W { \token_if_digit:NTF } >> } >> { \tl_show:n { #1 | #2 | #3 | #4 } } >> >> would declare \X to first grab tokens as long as they are equal in >> meaning to *, then grab tokens as long as they are equal in meaning to >> ', and finally grab digit tokens. >> >> Do you think that it would be useful to add yet another argument type >> for that? (In the code I have now, I decided that the argument >> grabbing would stop at the first { or space or }, or implicit such >> token.) > > I have to say my initial reaction is 'not keen'. While xparse is a > 'glue' layer between LaTeX2e and LaTeX3, and may not make it to a LaTeX3 > format, I think we don't want to encourage irregular input if we can > avoid it. Do we _really_ want to suggest that this may even be > considered as a good idea for a new format? > > On the other hand, I guess it does fall within the 'parsing' remit of > xparse, and may be something that is occasionally useful. I'd like to > see a real use case, I guess. I have to say that I'm not fully keen either. The reason I'm asking here is that I don't want to put some code out there which shows how to add extra arguments types to xparse: as discussed earlier, this would lead to clashes between packages, and is a bad idea. I don't really have a use case (and I don't think that the OP's example is a real use case). Perhaps for people who like syntax like "\input foo " instead of "\input{foo}"? Or to grab the next word (or whatever)... Regards, Bruno