Skip to content
Snippets Groups Projects
Commit 6af218183aa5 authored by Alexander Ray's avatar Alexander Ray
Browse files

Parse constant expressions of the form "1<<12" (common in headers and enum values).

parent 3234afed406d
No related merge requests found
......@@ -778,6 +778,12 @@
if (isinstance(exprnode, pycparser.c_ast.UnaryOp) and
exprnode.op == '-'):
return -self._parse_constant(exprnode.expr)
#
if (isinstance(exprnode, pycparser.c_ast.BinaryOp) and
exprnode.op == '<<'):
left = self._parse_constant(exprnode.left)
right = self._parse_constant(exprnode.right)
return left << right
# load previously defined int constant
if (isinstance(exprnode, pycparser.c_ast.ID) and
exprnode.name in self._int_constants):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment