void consume_hex_number(TokenizeContext &context) { int lookahead = 0; // consume the 0x part lookahead += 2; while (is_hexadecimal_digit(context.next(lookahead))) lookahead++; context.consume(tok_HexInteger, lookahead); }
void consume_hex_number(TokenizeContext &context) { int lookahead = 0; // consume the 0x part lookahead += 2; while (is_hexadecimal_digit(context.next(lookahead))) lookahead++; context.consume(TK_HEX_INTEGER, lookahead); }
void consume_color_literal(TokenizeContext &context) { int lookahead = 0; // consume # lookahead++; while (is_hexadecimal_digit(context.next(lookahead))) lookahead++; int hex_digits = lookahead - 1; // acceptable lengths are 3, 4, 6 or 8 characters (not including #) if (hex_digits == 3 || hex_digits == 4 || hex_digits == 6 || hex_digits == 8) context.consume(tok_Color, lookahead); else context.consume(tok_Unrecognized, lookahead); }