- // Numeric literal. Search for the end of it, but don't care about [+-]exponent
- // at the end, as the results of "numeric [+-] numeric" and "numeric" are
- // identical to our state machine.
- $end += strspn( $s, '0123456789ABCDEFabcdefXx.', $end );
- while( $s[$end - 1] === '.' ) {
- // Special case: When a numeric ends with a dot, we have to check the
- // literal for proper syntax
- $decimal = strspn( $s, '0123456789', $pos, $end - $pos - 1 );
- if( $decimal === $end - $pos - 1 ) {
- break;
- } else {
- $end--;
+ $end += strspn( $s, '0123456789', $end );
+ $decimal = strspn( $s, '.', $end );
+ if ($decimal) {
+ if ( $decimal > 2 ) {
+ return self::parseError($s, $end, 'The number has too many decimal points' );