My parser has found an expression of the form CONSTANT_INTEGE R
OPERATOR CONSTANT_INTEGE R. I want to fold this into a single
CONSTANT_INTEGE R.
The OPERATOR token has an intValue attribute, '+' == 0, '-'== 1, etc.
In C I'd put functions Add, Subtract, ... into an array and call
ArithmeticFunct ions[ intValue ] to perform the operation. Would I
index into a list of functions in Python, or would IF/ELIF/ELIF ... be
the way to go?
OPERATOR CONSTANT_INTEGE R. I want to fold this into a single
CONSTANT_INTEGE R.
The OPERATOR token has an intValue attribute, '+' == 0, '-'== 1, etc.
In C I'd put functions Add, Subtract, ... into an array and call
ArithmeticFunct ions[ intValue ] to perform the operation. Would I
index into a list of functions in Python, or would IF/ELIF/ELIF ... be
the way to go?
Comment