static double getInteger(CSSTokenizerInputStream& input, unsigned& offset) { unsigned intStartPos = offset; offset = input.skipWhilePredicate<isASCIIDigit>(offset); unsigned intEndPos = offset; return input.getDouble(intStartPos, intEndPos); }
static double getFraction(CSSTokenizerInputStream& input, unsigned& offset) { if (input.peek(offset) != '.' || !isASCIIDigit(input.peek(offset + 1))) return 0; unsigned startOffset = offset; offset = input.skipWhilePredicate<isASCIIDigit>(offset + 1); return input.getDouble(startOffset, offset); }
static double getExponent(CSSTokenizerInputStream& input, unsigned& offset, int& sign) { unsigned exponentStartPos = 0; unsigned exponentEndPos = 0; if ((input.peek(offset) == 'E' || input.peek(offset) == 'e')) { int offsetBeforeExponent = offset; ++offset; if (input.peek(offset) == '+') { ++offset; } else if (input.peek(offset) =='-') { sign = -1; ++offset; } exponentStartPos = offset; offset = input.skipWhilePredicate<isASCIIDigit>(offset); exponentEndPos = offset; if (exponentEndPos == exponentStartPos) offset = offsetBeforeExponent; } return input.getDouble(exponentStartPos, exponentEndPos); }