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
> 

> 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).
> 

> +    # Enum members can start with a digit, because the generated C
> +    # code always prefixes it with the enum name
> +    if enum_member:
> +        membername = "_%s" %membername
> +    if not valid_name.match(membername):
> +        raise QAPIExprError(expr_info,

Python question: Would it be any simpler to write:

membername = '_' + membername

and if so, do I need to squash anything in?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to