subscript
Version:
Modular expression parser & evaluator
12 lines (9 loc) • 308 B
JavaScript
/**
* Increment/decrement operators - parse half
*
* ++ -- (prefix and postfix)
*/
import { token, expr } from '../../parse.js';
const POSTFIX = 150;
token('++', POSTFIX, a => a ? ['++', a, null] : ['++', expr(POSTFIX - 1)]);
token('--', POSTFIX, a => a ? ['--', a, null] : ['--', expr(POSTFIX - 1)]);