From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoeOV-0001kP-Lh for qemu-devel@nongnu.org; Sat, 02 May 2015 16:52:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YoeOS-0000mi-Cq for qemu-devel@nongnu.org; Sat, 02 May 2015 16:52:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoeOS-0000me-5Y for qemu-devel@nongnu.org; Sat, 02 May 2015 16:52:12 -0400 Message-ID: <554538D0.1050406@redhat.com> Date: Sat, 02 May 2015 14:51:28 -0600 From: Eric Blake MIME-Version: 1.0 References: <1430312814-19706-1-git-send-email-eblake@redhat.com> <1430312814-19706-26-git-send-email-eblake@redhat.com> In-Reply-To: <1430312814-19706-26-git-send-email-eblake@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="g2aHpSrQFsBC4lB7B9V54pFUtDJdmxnoE" Subject: Re: [Qemu-devel] [PATCH v7 25/39] qapi: Require valid names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, berto@igalia.com, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --g2aHpSrQFsBC4lB7B9V54pFUtDJdmxnoE Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/29/2015 07:06 AM, Eric Blake wrote: > Previous commits demonstrated that the generator overlooked various > bad naming situations: > - types, commands, and events need a valid name > - enum members must be valid names, when combined with prefix > - union and alternate branches cannot be marked optional >=20 > regex, this patch just uses a broader combination that allows both > upstream and downstream names, as well as a small hack that > realizes that any enum name is merely a suffix to an already valid > name prefix (that is, any enum name is valid if prepending _ fits > the normal rules). >=20 > + # Enum members can start with a digit, because the generated C > + # code always prefixes it with the enum name > + if enum_member: > + membername =3D "_%s" %membername > + if not valid_name.match(membername): > + raise QAPIExprError(expr_info, Python question: Would it be any simpler to write: membername =3D '_' + membername and if so, do I need to squash anything in? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --g2aHpSrQFsBC4lB7B9V54pFUtDJdmxnoE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVRTjQAAoJEKeha0olJ0Nq2xUH+QGve7t1Tgsk0LgLW7y8MJV8 dXKoElI85hY9cwXfWW8Q6V1i6JYpRRCtE3ZGUnY680cn0Fgw6ZdnEicfO8RmDNr+ kDKqlw1H2fKudwUNPyn8axPvLZWefFoaDExv8wlokRhHUewuIadJbrFJ0EfiOg3C 4k2PK+qIk/p/L2HnxS69mCgLUPrSu4AKVb5nEprYAbwfDS24nL8xt7SWA054Nc8z zL6TqmrViDMtPLFI3fkeoeNeOyzX5lMM7DFU0nMLn4hKumuXZDuM8by44WjByok3 H1rdESn8HRmVoFDSYpygQUyPKVjI8niAMrMmglGXY0RJ8g1WlhmRBIG42oDje6g= =93zK -----END PGP SIGNATURE----- --g2aHpSrQFsBC4lB7B9V54pFUtDJdmxnoE--