| 725 | FLOATING_POINT_PATTERN = fpPattern(); |
| 726 | |
| 727 | @GwtIncompatible // regular expressions |
| 728 | private static |
| 729 | java.util.regex.Pattern |
| 730 | fpPattern() { |
| 731 | /* |
| 732 | * We use # instead of * for possessive quantifiers. This lets us strip them out when building |
| 733 | * the regex for RE2 (which doesn't support them) but leave them in when building it for |
| 734 | * java.util.regex (where we want them in order to avoid catastrophic backtracking). |
| 735 | */ |
| 736 | String decimal = "(?:\\d+#(?:\\.\\d*#)?|\\.\\d+#)"; |
| 737 | String completeDec = decimal + "(?:[eE][+-]?\\d+#)?[fFdD]?"; |
| 738 | String hex = "(?:[0-9a-fA-F]+#(?:\\.[0-9a-fA-F]*#)?|\\.[0-9a-fA-F]+#)"; |
| 739 | String completeHex = "0[xX]" + hex + "[pP][+-]?\\d+#[fFdD]?"; |
| 740 | String fpPattern = "[+-]?(?:NaN|Infinity|" + completeDec + "|" + completeHex + ")"; |
| 741 | fpPattern = |
| 742 | fpPattern.replace( |
| 743 | "#", |
| 744 | "+" |
| 745 | ); |
| 746 | return |
| 747 | java.util.regex.Pattern |
| 748 | .compile(fpPattern); |
| 749 | } |
| 750 | |
| 751 | /** |
| 752 | * Parses the specified string as a double-precision floating point value. The ASCII character |