xcbgen-parser: support switch-case
authorChristian Linhart <chris@demorecorder.com>
Tue, 19 Aug 2014 13:55:33 +0000 (15:55 +0200)
committerPeter Harris <pharris@opentext.com>
Mon, 25 Aug 2014 23:39:31 +0000 (19:39 -0400)
commit127d34ac4fc42ecf005f9f2ef02a0e4b74ad1cb3
tree2654a00489be34b9b25e50a5eb676ab5b6051bf7
parent4987a5c6bcb971d851a71ec3b3d9783a4cbc7554
xcbgen-parser: support switch-case

"case" is implemented as a variation of "bitcase" as follows:

The old class "BitCaseType" became the abstract class
"CaseOrBitcaseType" with two derived classes
"CaseType" and "BitcaseType".
(Therefore BitcaseType keeps the old semantic which may
be important for some generators)

There are two additional flags in class Type:
* is_case
* is_case_or_bitcase
The latter is for convenience because case and bitcase
have to be treated the same way in many cases.

The list of cases and bitcases in a SwitchType object
is still called "bitcases".
Reasons:
* Renaming that list would break generators based on the parser.
* Creating an extra list for cases would make other code more
  complicated because you usually want to iterate over all
  case and bitcase members of a switch.

Reviewed-by: Ran Benita <ran234@gmail.com>
xcbgen/expr.py
xcbgen/xtypes.py