lexical_util/prebuilt_formats.rs
1//! Pre-built formats for each programming language,
2
3#![cfg(feature = "format")]
4
5use core::num;
6
7use crate::format::NumberFormatBuilder;
8
9// FIXME
10
11// Sample test code for each language used:
12//
13// Rust
14// ----
15//
16// Setup:
17// Save to `main.rs` and run `rustc main.rs -o main`.
18//
19// Code:
20// ```text
21// pub fn main() {
22// println!("{:?}", 3_.0f32);
23// println!("{:?}", "3_.0".parse::<f32>());
24// }
25// ```
26//
27// Python
28// ------
29//
30// Setup:
31// Run `python` to enter the interpreter.
32//
33// Code:
34// ```text
35// print(3_.0)
36// print(float("3_.0"))
37// ```
38//
39// C++
40// ---
41//
42// Setup:
43// Save to `main.cc` and run `g++ main.cc -o main -std=c++XX`,
44// where XX is one of the following values:
45// - 98
46// - 03
47// - 11
48// - 14
49// - 17
50//
51// Code:
52// ```text
53// #include <cstdlib>
54// #include <cstring>
55// #include <iostream>
56// #include <iterator>
57// #include <stdexcept>
58//
59// double parse(const char* string) {
60// char* end;
61// double result = strtod(string, &end);
62// auto endp = reinterpret_cast<const char*>(end);
63// if (std::distance(string, endp) != strlen(string)) {
64// throw std::invalid_argument("did not consume entire string.");
65// }
66// return result;
67// }
68//
69// int main() {
70// std::cout << 3'.0 << std::endl;
71// std::cout << parse("3'.0") << std::endl;
72// }
73// ```
74//
75// C
76// -
77//
78// Setup:
79// Save to `main.c` and run `gcc main.c -o main -std=cXX`,
80// where XX is one of the following values:
81// - 89
82// - 90
83// - 99
84// - 11
85// - 18
86//
87// Code:
88// ```text
89// #include <stdint.h>
90// #include <stdlib.h>
91// #include <string.h>
92// #include <stdio.h>
93//
94// size_t distance(const char* first, const char* last) {
95// uintptr_t x = (uintptr_t) first;
96// uintptr_t y = (uintptr_t) last;
97// return (size_t) (y - x);
98// }
99//
100// double parse(const char* string) {
101// char* end;
102// double result = strtod(string, &end);
103// if (distance(string, (const char*) end) != strlen(string)) {
104// abort();
105// }
106// return result;
107// }
108//
109// int main() {
110// printf("%f\n", 3'.);
111// printf("%f\n", parse("3'."));
112// }
113// ```
114//
115// Ruby
116// ----
117//
118// Setup:
119// Run `irb` to enter the interpreter.
120//
121// Code:
122// ```text
123// puts 3.0_1;
124// puts "3.0_1".to_f;
125// ```
126// Swift
127// -----
128//
129// Setup:
130// Run `swift` to enter the interpreter.
131//
132// Code:
133// ```text
134// print(3.0);
135// print(Float("3.0"));
136// ```
137// Golang
138// ------
139//
140// Setup:
141// Save to `main.go` and run `go run main.go`
142//
143// Code:
144// ```text
145// package main
146//
147// import (
148// "fmt"
149// "strconv"
150// )
151//
152// func main() {
153// fmt.Println(3.0)
154// fmt.Println(strconv.ParseFloat("3.0", 64))
155// }
156// ```
157//
158// Haskell
159// -------
160//
161// Setup:
162// Run `ghci` to enter the interpreter.
163//
164// Code:
165// ```text
166// :m Numeric
167// showFloat 3.0 ""
168// let x = "3.0"
169// read x :: Float
170// ```
171//
172// Javascript
173// ----------
174//
175// Setup:
176// Run `nodejs` (or `node`) to enter the interpreter.
177//
178// Code:
179// ```text
180// console.log(3.0)
181// console.log(parseFloat("3.0"))
182// ```
183//
184// Perl
185// ----
186//
187// Setup:
188// Run `perl -de1` to enter the interpret.
189//
190// Code:
191// ```text
192// print 3.01;
193// print '3.01' * 1;
194// ```
195//
196// PHP
197// ---
198//
199// Setup:
200// Run `php -a` to enter the interpret.
201//
202// Code:
203// ```text
204// printf("%f\n", 3.0);
205// printf("%f\n", floatval("3.0"));
206// ```
207//
208// Java
209// ----
210//
211// Setup:
212// Save to `main.java` and run `javac main.java`, then run `java Main`.
213//
214// Code:
215// ```text
216// class Main {
217// public static void main(String args[]) {
218// System.out.println(3.0);
219// System.out.println(Float.parseFloat("3.0"));
220// }
221// }
222// ```
223//
224// R
225// -
226//
227// Setup:
228// Run `R` to enter the interpret.
229//
230// Code:
231// ```text
232// print(3.0);
233// print(as.numeric("3.0"));
234// ```
235//
236// Kotlin
237// ------
238//
239// Setup:
240// Save file to `main.kt` and run `kotlinc main.kt -d main.jar`,
241// then run `java -jar main.jar`.
242//
243// Code:
244// ```text
245// fun main() {
246// println(3.0)
247// println("3.0".toDouble())
248// }
249// ```
250//
251// Julia
252// -----
253//
254// Setup:
255// Run `julia` to enter the interpret.
256//
257// Code:
258// ```text
259// print(3.0);
260// print(parse(Float64, "3.0"));
261// ```
262//
263// C#
264// --
265//
266// Note:
267// Mono accepts both integer and fraction decimal separators, Mono is
268// just buggy, see https://github.com/dotnet/csharplang/issues/55#issuecomment-574902516.
269//
270// Setup:
271// Run `csharp -langversion:X` to enter the interpret,
272// where XX is one of the following values:
273// - ISO-1
274// - ISO-2
275// - 3
276// - 4
277// - 5
278// - 6
279// - 7
280//
281// Code:
282// ```text
283// Console.WriteLine("{0}", 3.0);
284// Console.WriteLine("{0}", float.Parse("3.0"));
285// ```
286//
287// Kawa
288// ----
289//
290// Setup:
291// Run `kawa` to enter the interpreter.
292//
293// Code:
294// ```text
295// 3.0
296// (string->number "3.0")
297// ```
298//
299// Gambit-C
300// --------
301//
302// Setup:
303// Run `gsc` to enter the interpreter.
304//
305// Code:
306// ```text
307// 3.0
308// (string->number "3.0")
309// ```
310//
311// Guile
312// -----
313//
314// Setup:
315// Run `guile` to enter the interpreter.
316//
317// Code:
318// ```text
319// 3.0
320// (string->number "3.0")
321// ```
322//
323// Clojure
324// -------
325//
326// Setup:
327// Run `clojure` to enter the interpreter.
328//
329// Code:
330// ```text
331// 3.0
332// (Float/parseFloat "3.0")
333// ```
334//
335// Erlang
336// ------
337//
338// Setup:
339// Run `erl` to enter the interpreter.
340//
341// Code:
342// ```text
343// io:format("~p~n", [3.0]).
344// string:to_float("3.0").
345// ```
346//
347// Elm
348// ---
349//
350// Setup:
351// Run `elm repl` to enter the interpreter.
352//
353// Code:
354// ```text
355// 3.0
356// String.toFloat "3.0"
357// ```
358//
359// Scala
360// -----
361//
362// Setup:
363// Run `scala` to enter the interpreter.
364//
365// Code:
366// ```text
367// 3.0
368// "3.0".toFloat
369// ```
370//
371// Elixir
372// ------
373//
374// Setup:
375// Run `iex` to enter the interpreter.
376//
377// Code:
378// ```text
379// 3.0;
380// String.to_float("3.0");
381// ```
382//
383// FORTRAN
384// -------
385//
386// Setup:
387// Save to `main.f90` and run `gfortran -o main main.f90`
388//
389// Code:
390// ```text
391// program main
392// real :: x
393// character (len=30) :: word
394// word = "3."
395// read(word, *) x
396// print *, 3.
397// print *, x
398// end program main
399// ```
400//
401// D
402// -
403//
404// Setup:
405// Save to `main.d` and run `dmd -run main.d`
406//
407// Code:
408// ```text
409// import std.conv;
410// import std.stdio;
411//
412// void main()
413// {
414// writeln(3.0);
415// writeln(to!double("3.0"));
416// }
417// ```
418//
419// Coffeescript
420// ------------
421//
422// Setup:
423// Run `coffee` to enter the interpreter.
424//
425// Code:
426// ```text
427// 3.0;
428// parseFloat("3.0");
429// ```
430//
431// Cobol
432// -----
433//
434// Setup:
435// Save to `main.cbl` and run `cobc main.cbl` then `cobcrun main`.
436//
437// Code:
438// ```text
439// IDENTIFICATION DIVISION.
440// PROGRAM-ID. main.
441//
442// DATA DIVISION.
443// WORKING-STORAGE SECTION.
444// 01 R PIC X(20) VALUE "3.0".
445// 01 TOTAL USAGE IS COMP-2.
446//
447// PROCEDURE DIVISION.
448// COMPUTE TOTAL = FUNCTION NUMVAL(R).
449// Display 3.0.
450// Display TOTAL.
451// STOP RUN.
452// ```
453//
454// F#
455// --
456//
457// Setup:
458// Run `dotnet fsi` to enter the interpreter.
459//
460// Code:
461// ```text
462// printfn "%f" 3.0;;
463// let f = float "3.0";;
464// printfn "%f" f;;
465// ```
466//
467// Visual Basic
468// ------------
469//
470// Setup:
471// Save to `main.vb` and run `vbnc main.vb`.
472//
473// Code:
474// ```text
475// Imports System
476//
477// Module Module1
478// Sub Main()
479// Console.WriteLine(Format$(3.0, "0.0000000000000"))
480// Console.WriteLine(Format$(CDbl("3.0"), "0.0000000000000"))
481// End Sub
482// End Module
483// ```
484//
485// OCaml
486// -----
487//
488// Setup:
489// Save to `main.ml` and run `ocamlc -o main main.ml`.
490//
491// Code:
492// ```text
493// Printf.printf "%f\n" 3.0
494// let () =
495// let f = float_of_string "3.0" in
496// Printf.printf "%f\n" f
497// ```
498//
499// Objective-C
500// -----------
501//
502// Setup:
503// Save to `main.m` and run `gcc -o main -lobjc -lgnustep-base main.m
504// -fconstant-string-class=NSConstantString`.
505//
506// Code:
507// ```text
508// #import <Foundation/Foundation.h>
509// #import <stdio.h>
510//
511// int main(int argv, char* argc[])
512// {
513// printf("%f\n", 3.0);
514// NSString *s = @"3.0";
515// double f = [s doubleValue];
516// printf("%f\n", f);
517// }
518// ```
519//
520// ReasonML
521// --------
522//
523// Setup:
524// Run `rtop` to enter the interpreter.
525//
526// Code:
527// ```text
528// Printf.printf("%f\n", 3.0);
529// Printf.printf("%f\n", float_of_string("3.0"));
530// ```
531//
532// Zig
533// ---
534//
535// Setup:
536// Save to `main.zig` and run `zig build-exe main.zig`
537//
538// Code:
539// ```text
540// const std = @import("std");
541//
542// pub fn main() void {
543// const f: f64 = 3.0;
544// std.debug.warn("{}\n", f);
545// const x: f64 = std.fmt.parseFloat(f64, "3.0") catch unreachable;
546// std.debug.warn("{}\n", x);
547// }
548// ```
549//
550//
551// Octave (and Matlab)
552// -------------------
553//
554// Setup:
555// Run `octave` to enter the interpreter, or
556// run `octave --traditional` to enter the Matlab interpret.
557//
558// Code:
559// ```text
560// 3.0
561// str2double("3.0")
562// ```
563//
564// Sage
565// ----
566//
567// Setup:
568// Run `sage` to enter the interpreter.
569//
570// Code:
571// ```text
572// 3.0
573// float("3.0")
574// ```
575//
576// JSON
577// ----
578//
579// Setup:
580// Run `node` (or `nodejs`) to enter the JS interpreter.
581//
582// Code:
583// ```text
584// JSON.parse("3.0")
585// ```
586//
587// TOML
588// ----
589//
590// Setup:
591// Run `python` to enter the Python interpreter.
592//
593// Code:
594// ```text
595// import tomlkit
596// tomlkit.parse("a = 3.0")
597// ```
598//
599// XML
600// ---
601//
602// Setup:
603// Run `python` to enter the Python interpreter.
604//
605// Code:
606// ```text
607// from lxml import etree
608//
609// def validate_xml(xsd, xml):
610// '''Validate XML file against schema'''
611//
612// schema = etree.fromstring(xsd)
613// doc = etree.fromstring(xml)
614// xmlschema = etree.XMLSchema(schema)
615//
616// return xmlschema.validate(doc)
617//
618//
619// xsd = b'''<?xml version="1.0" encoding="UTF-8"?>
620// <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
621// <xs:element name="prize" type="xs:float"/>
622// </xs:schema>'''
623//
624// xml = b'''<?xml version="1.0" encoding="UTF-8"?>
625// <prize>3.0</prize>
626// '''
627//
628// validate_xml(xsd, xml)
629// ```
630//
631// SQLite
632// ------
633//
634// Setup:
635// Run `sqlite3 :memory:` to enter the sqlite3 interpreter
636// with an in-memory database.
637//
638// Code:
639// ```text
640// CREATE TABLE stocks (price real);
641// INSERT INTO stocks VALUES (3.0);
642// SELECT * FROM stocks;
643// ```
644//
645// PostgreSQL
646// ----------
647//
648// Setup:
649// Run `initdb -D db` to create a database data direction,
650// then run `pg_ctl -D db start` to start the server, then run
651// `createdb` to create a user database and `psql` to start the
652// interpreter.
653//
654// Code:
655// ```text
656// CREATE TABLE stocks (price real);
657// INSERT INTO stocks VALUES (3.0);
658// SELECT * FROM stocks;
659// ```
660//
661// MySQL
662// -----
663//
664// Setup:
665// Run `mysqld` to start the server, then run `mysql` to start the
666// interpreter.
667//
668// Code:
669// ```text
670// USE mysql;
671// CREATE TABLE stocks (price real);
672// INSERT INTO stocks VALUES (3.0);
673// SELECT * FROM stocks;
674// ```
675//
676// MongoDB
677// -------
678//
679// Setup:
680// Run `mongod --dbpath data/db` to start the server, then run
681// `mongo` to start the interpreter.
682//
683// Code:
684// ```text
685// use mydb
686// db.movie.insert({"name": 3.0})
687// db.movie.find()
688// ```
689
690// PRE-DEFINED CONSTANTS
691// ---------------------
692//
693// Sample Format Shorthand:
694// ------------------------
695//
696// The format shorthand lists the test cases, and if applicable,
697// the digit separator character. For example, the shorthand
698// `[134-_]` specifies it passes tests 1, 3, and 4, and uses
699// `'_'` as a digit-separator character. Meanwhile, `[0]` means it
700// passes test 0, and has no digit separator.
701
702// RUST LITERAL [4569ABFGHIJKMN-_]
703/// Number format for a [`Rust`] literal floating-point number.
704///
705/// [`Rust`]: https://www.rust-lang.org/
706#[rustfmt::skip]
707pub const RUST_LITERAL: u128 = NumberFormatBuilder::new()
708 .digit_separator(num::NonZeroU8::new(b'_'))
709 .required_digits(true)
710 .no_positive_mantissa_sign(true)
711 .no_special(true)
712 .internal_digit_separator(true)
713 .trailing_digit_separator(true)
714 .consecutive_digit_separator(true)
715 .build_strict();
716
717// RUST STRING [0134567MN]
718/// Number format to parse a [`Rust`] float from string.
719///
720/// [`Rust`]: https://www.rust-lang.org/
721#[rustfmt::skip]
722pub const RUST_STRING: u128 = NumberFormatBuilder::new().build_strict();
723
724/// Number format for a [`Python`] literal floating-point number.
725///
726/// [`Python`]: https://www.python.org/
727pub const PYTHON_LITERAL: u128 = PYTHON3_LITERAL;
728
729/// Number format to parse a [`Python`] float from string.
730///
731/// [`Python`]: https://www.python.org/
732pub const PYTHON_STRING: u128 = PYTHON3_STRING;
733
734/// Number format for a [`Python3`] literal floating-point number.
735///
736/// [`Python3`]: https://www.python.org/
737pub const PYTHON3_LITERAL: u128 = PYTHON36_LITERAL;
738
739// PYTHON3 STRING [0134567MN]
740/// Number format to parse a [`Python3`] float from string.
741///
742/// [`Python3`]: https://www.python.org/
743#[rustfmt::skip]
744pub const PYTHON3_STRING: u128 = NumberFormatBuilder::new().build_strict();
745
746// PYTHON3.6+ LITERAL [013456N-_]
747/// Number format for a [`Python3.6`] or higher literal floating-point number.
748///
749/// [`Python3.6`]: https://www.python.org/downloads/release/python-360/
750#[rustfmt::skip]
751pub const PYTHON36_LITERAL: u128 = NumberFormatBuilder::new()
752 .digit_separator(num::NonZeroU8::new(b'_'))
753 .no_special(true)
754 .no_integer_leading_zeros(true)
755 .internal_digit_separator(true)
756 .build_strict();
757
758// PYTHON3.5- LITERAL [013456N]
759/// Number format for a [`Python3.5`] or lower literal floating-point number.
760///
761/// [`Python3.5`]: https://www.python.org/downloads/release/python-350/
762#[rustfmt::skip]
763pub const PYTHON35_LITERAL: u128 = NumberFormatBuilder::new()
764 .no_special(true)
765 .no_integer_leading_zeros(true)
766 .build_strict();
767
768// PYTHON2 LITERAL [013456MN]
769/// Number format for a [`Python2`] literal floating-point number.
770///
771/// [`Python2`]: https://www.python.org/downloads/release/python-270/
772#[rustfmt::skip]
773pub const PYTHON2_LITERAL: u128 = NumberFormatBuilder::new()
774 .no_special(true)
775 .build_strict();
776
777// PYTHON2 STRING [0134567MN]
778/// Number format to parse a [`Python2`] float from string.
779///
780/// [`Python2`]: https://www.python.org/downloads/release/python-270/
781#[rustfmt::skip]
782pub const PYTHON2_STRING: u128 = NumberFormatBuilder::new().build_strict();
783
784/// Number format for a [`C++`] literal floating-point number.
785///
786/// [`C++`]: https://en.cppreference.com/w/
787pub const CXX_LITERAL: u128 = CXX20_LITERAL;
788
789/// Number format to parse a [`C++`] float from string.
790///
791/// [`C++`]: https://en.cppreference.com/w/
792pub const CXX_STRING: u128 = CXX20_STRING;
793
794/// Number format for a [`C++`] literal hexadecimal floating-point number.
795///
796/// [`C++`]: https://en.cppreference.com/w/
797#[cfg(feature = "power-of-two")]
798pub const CXX_HEX_LITERAL: u128 = CXX20_HEX_LITERAL;
799
800/// Number format to parse a [`C++`] hexadecimal float from string.
801///
802/// [`C++`]: https://en.cppreference.com/w/
803#[cfg(feature = "power-of-two")]
804pub const CXX_HEX_STRING: u128 = CXX20_HEX_STRING;
805
806// C++20 LITERAL [013456789ABMN-']
807/// Number format for a [`C++20`] literal floating-point number.
808///
809/// [`C++20`]: https://en.cppreference.com/w/cpp/20
810#[rustfmt::skip]
811pub const CXX20_LITERAL: u128 = NumberFormatBuilder::new()
812 .digit_separator(num::NonZeroU8::new(b'\''))
813 .case_sensitive_special(true)
814 .internal_digit_separator(true)
815 .build_strict();
816
817// C++20 STRING [0134567MN]
818/// Number format for a [`C++20`] string floating-point number.
819///
820/// [`C++20`]: https://en.cppreference.com/w/cpp/20
821#[rustfmt::skip]
822pub const CXX20_STRING: u128 = NumberFormatBuilder::new().build_strict();
823
824// C++20 HEX LITERAL [013456789ABMN-']
825/// Number format for a [`C++20`] literal hexadecimal floating-point number.
826///
827/// [`C++20`]: https://en.cppreference.com/w/cpp/20
828#[rustfmt::skip]
829#[cfg(feature = "power-of-two")]
830pub const CXX20_HEX_LITERAL: u128 = NumberFormatBuilder::new()
831 .required_exponent_notation(true)
832 .digit_separator(num::NonZeroU8::new(b'\''))
833 .mantissa_radix(16)
834 .exponent_base(num::NonZeroU8::new(2))
835 .exponent_radix(num::NonZeroU8::new(10))
836 .case_sensitive_special(true)
837 .internal_digit_separator(true)
838 .build_strict();
839
840// C++20 HEX STRING [0134567MN]
841/// Number format for a [`C++20`] string hexadecimal floating-point number.
842///
843/// [`C++20`]: https://en.cppreference.com/w/cpp/20
844#[rustfmt::skip]
845#[cfg(feature = "power-of-two")]
846pub const CXX20_HEX_STRING: u128 = NumberFormatBuilder::new()
847 .mantissa_radix(16)
848 .exponent_base(num::NonZeroU8::new(2))
849 .exponent_radix(num::NonZeroU8::new(10))
850 .build_strict();
851
852// C++17 LITERAL [013456789ABMN-']
853/// Number format for a [`C++17`] literal floating-point number.
854///
855/// [`C++17`]: https://en.cppreference.com/w/cpp/17
856#[rustfmt::skip]
857pub const CXX17_LITERAL: u128 = NumberFormatBuilder::new()
858 .digit_separator(num::NonZeroU8::new(b'\''))
859 .case_sensitive_special(true)
860 .internal_digit_separator(true)
861 .build_strict();
862
863// C++17 STRING [0134567MN]
864/// Number format for a [`C++17`] string floating-point number.
865///
866/// [`C++17`]: https://en.cppreference.com/w/cpp/17
867#[rustfmt::skip]
868pub const CXX17_STRING: u128 = NumberFormatBuilder::new().build_strict();
869
870// C++17 HEX LITERAL [013456789ABMN-']
871/// Number format for a [`C++17`] literal hexadecimal floating-point number.
872///
873/// [`C++17`]: https://en.cppreference.com/w/cpp/17
874#[rustfmt::skip]
875#[cfg(feature = "power-of-two")]
876pub const CXX17_HEX_LITERAL: u128 = NumberFormatBuilder::new()
877 .required_exponent_notation(true)
878 .digit_separator(num::NonZeroU8::new(b'\''))
879 .mantissa_radix(16)
880 .exponent_base(num::NonZeroU8::new(2))
881 .exponent_radix(num::NonZeroU8::new(10))
882 .case_sensitive_special(true)
883 .internal_digit_separator(true)
884 .build_strict();
885
886// C++17 HEX STRING [0134567MN]
887/// Number format for a [`C++17`] string hexadecimal floating-point number.
888///
889/// [`C++17`]: https://en.cppreference.com/w/cpp/17
890#[rustfmt::skip]
891#[cfg(feature = "power-of-two")]
892pub const CXX17_HEX_STRING: u128 = NumberFormatBuilder::new()
893 .mantissa_radix(16)
894 .exponent_base(num::NonZeroU8::new(2))
895 .exponent_radix(num::NonZeroU8::new(10))
896 .build_strict();
897
898// C++14 LITERAL [013456789ABMN-']
899/// Number format for a [`C++14`] literal floating-point number.
900///
901/// [`C++14`]: https://en.cppreference.com/w/cpp/14
902#[rustfmt::skip]
903pub const CXX14_LITERAL: u128 = NumberFormatBuilder::new()
904 .digit_separator(num::NonZeroU8::new(b'\''))
905 .case_sensitive_special(true)
906 .internal_digit_separator(true)
907 .build_strict();
908
909// C++14 STRING [0134567MN]
910/// Number format for a [`C++14`] string floating-point number.
911///
912/// [`C++14`]: https://en.cppreference.com/w/cpp/14
913#[rustfmt::skip]
914pub const CXX14_STRING: u128 = NumberFormatBuilder::new().build_strict();
915
916// C++14 HEX STRING [0134567MN]
917/// Number format for a [`C++14`] string hexadecimal floating-point number.
918///
919/// [`C++14`]: https://en.cppreference.com/w/cpp/14
920#[rustfmt::skip]
921#[cfg(feature = "power-of-two")]
922pub const CXX14_HEX_STRING: u128 = NumberFormatBuilder::new()
923 .mantissa_radix(16)
924 .exponent_base(num::NonZeroU8::new(2))
925 .exponent_radix(num::NonZeroU8::new(10))
926 .build_strict();
927
928// C++11 LITERAL [01345678MN]
929/// Number format for a [`C++11`] literal floating-point number.
930///
931/// [`C++11`]: https://en.cppreference.com/w/cpp/11
932#[rustfmt::skip]
933pub const CXX11_LITERAL: u128 = NumberFormatBuilder::new()
934 .case_sensitive_special(true)
935 .build_strict();
936
937// C++11 STRING [0134567MN]
938/// Number format for a [`C++11`] string floating-point number.
939///
940/// [`C++11`]: https://en.cppreference.com/w/cpp/11
941#[rustfmt::skip]
942pub const CXX11_STRING: u128 = NumberFormatBuilder::new().build_strict();
943
944// C++11 HEX STRING [0134567MN]
945/// Number format for a [`C++11`] string hexadecimal floating-point number.
946///
947/// [`C++11`]: https://en.cppreference.com/w/cpp/11
948#[rustfmt::skip]
949#[cfg(feature = "power-of-two")]
950pub const CXX11_HEX_STRING: u128 = NumberFormatBuilder::new()
951 .mantissa_radix(16)
952 .exponent_base(num::NonZeroU8::new(2))
953 .exponent_radix(num::NonZeroU8::new(10))
954 .build_strict();
955
956// C++03 LITERAL [01345678MN]
957/// Number format for a [`C++03`] literal floating-point number.
958///
959/// [`C++03`]: https://en.wikipedia.org/wiki/C%2B%2B03
960#[rustfmt::skip]
961pub const CXX03_LITERAL: u128 = NumberFormatBuilder::new()
962 .case_sensitive_special(true)
963 .build_strict();
964
965// C++03 STRING [0134567MN]
966/// Number format for a [`C++03`] string floating-point number.
967///
968/// [`C++03`]: https://en.wikipedia.org/wiki/C%2B%2B03
969#[rustfmt::skip]
970pub const CXX03_STRING: u128 = NumberFormatBuilder::new().build_strict();
971
972// C++98 LITERAL [01345678MN]
973/// Number format for a [`C++98`] literal floating-point number.
974///
975/// [`C++98`]: https://en.cppreference.com/w/
976#[rustfmt::skip]
977pub const CXX98_LITERAL: u128 = NumberFormatBuilder::new()
978 .case_sensitive_special(true)
979 .build_strict();
980
981// C++98 STRING [0134567MN]
982/// Number format for a [`C++98`] string floating-point number.
983///
984/// [`C++98`]: https://en.cppreference.com/w/
985#[rustfmt::skip]
986pub const CXX98_STRING: u128 = NumberFormatBuilder::new().build_strict();
987
988/// Number format for a [`C`] literal floating-point number.
989///
990/// [`C`]: https://en.cppreference.com/w/c
991pub const C_LITERAL: u128 = C18_LITERAL;
992
993/// Number format to parse a [`C`] float from string.
994///
995/// [`C`]: https://en.cppreference.com/w/c
996pub const C_STRING: u128 = C18_STRING;
997
998/// Number format for a [`C`] literal hexadecimal floating-point number.
999///
1000/// [`C`]: https://en.cppreference.com/w/c
1001#[cfg(feature = "power-of-two")]
1002pub const C_HEX_LITERAL: u128 = C18_HEX_LITERAL;
1003
1004/// Number format to parse a [`C`] hexadecimal float from string.
1005///
1006/// [`C`]: https://en.cppreference.com/w/c
1007#[cfg(feature = "power-of-two")]
1008pub const C_HEX_STRING: u128 = C18_HEX_STRING;
1009
1010// C18 LITERAL [01345678MN]
1011/// Number format for a [`C18`] literal floating-point number.
1012///
1013/// [`C18`]: https://en.cppreference.com/w/c/17
1014#[rustfmt::skip]
1015pub const C18_LITERAL: u128 = NumberFormatBuilder::new()
1016 .case_sensitive_special(true)
1017 .build_strict();
1018
1019// C18 STRING [0134567MN]
1020/// Number format for a [`C18`] string floating-point number.
1021///
1022/// [`C18`]: https://en.cppreference.com/w/c/17
1023#[rustfmt::skip]
1024pub const C18_STRING: u128 = NumberFormatBuilder::new().build_strict();
1025
1026// C18 HEX LITERAL [01345678MN]
1027/// Number format for a [`C18`] literal hexadecimal floating-point number.
1028///
1029/// [`C18`]: https://en.cppreference.com/w/c/17
1030#[rustfmt::skip]
1031#[cfg(feature = "power-of-two")]
1032pub const C18_HEX_LITERAL: u128 = NumberFormatBuilder::new()
1033 .case_sensitive_special(true)
1034 .required_exponent_notation(true)
1035 .mantissa_radix(16)
1036 .exponent_base(num::NonZeroU8::new(2))
1037 .exponent_radix(num::NonZeroU8::new(10))
1038 .build_strict();
1039
1040// C18 HEX STRING [0134567MN]
1041/// Number format for a [`C18`] string hexadecimal floating-point number.
1042///
1043/// [`C18`]: https://en.cppreference.com/w/c/17
1044#[rustfmt::skip]
1045#[cfg(feature = "power-of-two")]
1046pub const C18_HEX_STRING: u128 = NumberFormatBuilder::new()
1047 .mantissa_radix(16)
1048 .exponent_base(num::NonZeroU8::new(2))
1049 .exponent_radix(num::NonZeroU8::new(10))
1050 .build_strict();
1051
1052// C11 LITERAL [01345678MN]
1053/// Number format for a [`C11`] literal floating-point number.
1054///
1055/// [`C11`]: https://en.cppreference.com/w/c/11
1056#[rustfmt::skip]
1057pub const C11_LITERAL: u128 = NumberFormatBuilder::new()
1058 .case_sensitive_special(true)
1059 .build_strict();
1060
1061// C11 STRING [0134567MN]
1062/// Number format for a [`C11`] string floating-point number.
1063///
1064/// [`C11`]: https://en.cppreference.com/w/c/11
1065#[rustfmt::skip]
1066pub const C11_STRING: u128 = NumberFormatBuilder::new().build_strict();
1067
1068// C11 HEX LITERAL [01345678MN]
1069/// Number format for a [`C11`] literal hexadecimal floating-point number.
1070///
1071/// [`C11`]: https://en.cppreference.com/w/c/11
1072#[rustfmt::skip]
1073#[cfg(feature = "power-of-two")]
1074pub const C11_HEX_LITERAL: u128 = NumberFormatBuilder::new()
1075 .case_sensitive_special(true)
1076 .required_exponent_notation(true)
1077 .mantissa_radix(16)
1078 .exponent_base(num::NonZeroU8::new(2))
1079 .exponent_radix(num::NonZeroU8::new(10))
1080 .build_strict();
1081
1082// C11 HEX STRING [0134567MN]
1083/// Number format for a [`C11`] string hexadecimal floating-point number.
1084///
1085/// [`C11`]: https://en.cppreference.com/w/c/11
1086#[rustfmt::skip]
1087#[cfg(feature = "power-of-two")]
1088pub const C11_HEX_STRING: u128 = NumberFormatBuilder::new()
1089 .mantissa_radix(16)
1090 .exponent_base(num::NonZeroU8::new(2))
1091 .exponent_radix(num::NonZeroU8::new(10))
1092 .build_strict();
1093
1094// C99 LITERAL [01345678MN]
1095/// Number format for a [`C99`] literal floating-point number.
1096///
1097/// [`C99`]: https://en.cppreference.com/w/c/99
1098#[rustfmt::skip]
1099pub const C99_LITERAL: u128 = NumberFormatBuilder::new()
1100 .case_sensitive_special(true)
1101 .build_strict();
1102
1103// C99 STRING [0134567MN]
1104/// Number format for a [`C99`] string floating-point number.
1105///
1106/// [`C99`]: https://en.cppreference.com/w/c/99
1107#[rustfmt::skip]
1108pub const C99_STRING: u128 = NumberFormatBuilder::new().build_strict();
1109
1110// C99 HEX LITERAL [01345678MN]
1111/// Number format for a [`C99`] literal hexadecimal floating-point number.
1112///
1113/// [`C99`]: https://en.cppreference.com/w/c/99
1114#[rustfmt::skip]
1115#[cfg(feature = "power-of-two")]
1116pub const C99_HEX_LITERAL: u128 = NumberFormatBuilder::new()
1117 .case_sensitive_special(true)
1118 .required_exponent_notation(true)
1119 .mantissa_radix(16)
1120 .exponent_base(num::NonZeroU8::new(2))
1121 .exponent_radix(num::NonZeroU8::new(10))
1122 .build_strict();
1123
1124// C99 HEX STRING [0134567MN]
1125/// Number format for a [`C99`] string hexadecimal floating-point number.
1126///
1127/// [`C99`]: https://en.cppreference.com/w/c/99
1128#[rustfmt::skip]
1129#[cfg(feature = "power-of-two")]
1130pub const C99_HEX_STRING: u128 = NumberFormatBuilder::new()
1131 .mantissa_radix(16)
1132 .exponent_base(num::NonZeroU8::new(2))
1133 .exponent_radix(num::NonZeroU8::new(10))
1134 .build_strict();
1135
1136// C90 LITERAL [013456MN]
1137/// Number format for a [`C90`] literal floating-point number.
1138///
1139/// [`C90`]: https://en.cppreference.com/w/c
1140#[rustfmt::skip]
1141pub const C90_LITERAL: u128 = NumberFormatBuilder::new()
1142 .no_special(true)
1143 .build_strict();
1144
1145// C90 STRING [0134567MN]
1146/// Number format for a [`C90`] string floating-point number.
1147///
1148/// [`C90`]: https://en.cppreference.com/w/c
1149#[rustfmt::skip]
1150pub const C90_STRING: u128 = NumberFormatBuilder::new().build_strict();
1151
1152// C90 HEX STRING [0134567MN]
1153/// Number format for a [`C90`] string hexadecimal floating-point number.
1154///
1155/// [`C90`]: https://en.cppreference.com/w/c
1156#[rustfmt::skip]
1157#[cfg(feature = "power-of-two")]
1158pub const C90_HEX_STRING: u128 = NumberFormatBuilder::new()
1159 .mantissa_radix(16)
1160 .exponent_base(num::NonZeroU8::new(2))
1161 .exponent_radix(num::NonZeroU8::new(10))
1162 .build_strict();
1163
1164// C89 LITERAL [013456MN]
1165/// Number format for a [`C89`] literal floating-point number.
1166///
1167/// [`C89`]: https://en.cppreference.com/w/c
1168#[rustfmt::skip]
1169pub const C89_LITERAL: u128 = NumberFormatBuilder::new()
1170 .no_special(true)
1171 .build_strict();
1172
1173// C89 STRING [0134567MN]
1174/// Number format for a [`C89`] string floating-point number.
1175///
1176/// [`C89`]: https://en.cppreference.com/w/c
1177#[rustfmt::skip]
1178pub const C89_STRING: u128 = NumberFormatBuilder::new().build_strict();
1179
1180// C89 HEX STRING [0134567MN]
1181/// Number format for a [`C89`] string hexadecimal floating-point number.
1182///
1183/// [`C89`]: https://en.cppreference.com/w/c
1184#[rustfmt::skip]
1185#[cfg(feature = "power-of-two")]
1186pub const C89_HEX_STRING: u128 = NumberFormatBuilder::new()
1187 .mantissa_radix(16)
1188 .exponent_base(num::NonZeroU8::new(2))
1189 .exponent_radix(num::NonZeroU8::new(10))
1190 .build_strict();
1191
1192// RUBY LITERAL [345689AMN-_]
1193/// Number format for a [`Ruby`] literal floating-point number.
1194///
1195/// [`Ruby`]: https://www.ruby-lang.org/en/
1196#[rustfmt::skip]
1197pub const RUBY_LITERAL: u128 = NumberFormatBuilder::new()
1198 .digit_separator(num::NonZeroU8::new(b'_'))
1199 .required_exponent_sign(true)
1200 .required_digits(true)
1201 .no_special(true)
1202 .no_integer_leading_zeros(true)
1203 .no_float_leading_zeros(true)
1204 .internal_digit_separator(true)
1205 .build_strict();
1206
1207// RUBY OCTAL LITERAL [345689AN-_]
1208/// Number format for an octal [`Ruby`] literal floating-point number.
1209///
1210/// [`Ruby`]: https://www.ruby-lang.org/en/
1211#[rustfmt::skip]
1212#[cfg(feature = "power-of-two")]
1213pub const RUBY_OCTAL_LITERAL: u128 = NumberFormatBuilder::new()
1214 .digit_separator(num::NonZeroU8::new(b'_'))
1215 .mantissa_radix(8)
1216 .required_digits(true)
1217 .no_special(true)
1218 .internal_digit_separator(true)
1219 .build_strict();
1220
1221// RUBY STRING [01234569ABMN-_]
1222// Note: Amazingly, Ruby 1.8+ do not allow parsing special values.
1223/// Number format to parse a [`Ruby`] float from string.
1224///
1225/// [`Ruby`]: https://www.ruby-lang.org/en/
1226#[rustfmt::skip]
1227pub const RUBY_STRING: u128 = NumberFormatBuilder::new()
1228 .digit_separator(num::NonZeroU8::new(b'_'))
1229 .no_special(true)
1230 .internal_digit_separator(true)
1231 .build_strict();
1232
1233// SWIFT LITERAL [34569ABFGHIJKMN-_]
1234/// Number format for a [`Swift`] literal floating-point number.
1235///
1236/// [`Swift`]: https://developer.apple.com/swift/
1237#[rustfmt::skip]
1238pub const SWIFT_LITERAL: u128 = NumberFormatBuilder::new()
1239 .digit_separator(num::NonZeroU8::new(b'_'))
1240 .required_digits(true)
1241 .no_special(true)
1242 .internal_digit_separator(true)
1243 .trailing_digit_separator(true)
1244 .consecutive_digit_separator(true)
1245 .build_strict();
1246
1247// SWIFT STRING [134567MN]
1248/// Number format to parse a [`Swift`] float from string.
1249///
1250/// [`Swift`]: https://developer.apple.com/swift/
1251#[rustfmt::skip]
1252pub const SWIFT_STRING: u128 = NumberFormatBuilder::new()
1253 .required_fraction_digits(true)
1254 .build_strict();
1255
1256// GO LITERAL [13456MN]
1257/// Number format for a [`Golang`] literal floating-point number.
1258///
1259/// [`Golang`]: https://go.dev/
1260#[rustfmt::skip]
1261pub const GO_LITERAL: u128 = NumberFormatBuilder::new()
1262 .required_fraction_digits(true)
1263 .no_special(true)
1264 .build_strict();
1265
1266// GO STRING [134567MN]
1267/// Number format to parse a [`Golang`] float from string.
1268///
1269/// [`Golang`]: https://go.dev/
1270#[rustfmt::skip]
1271pub const GO_STRING: u128 = NumberFormatBuilder::new()
1272 .required_fraction_digits(true)
1273 .build_strict();
1274
1275// HASKELL LITERAL [456MN]
1276/// Number format for a [`Haskell`] literal floating-point number.
1277///
1278/// [`Haskell`]: https://www.haskell.org/
1279#[rustfmt::skip]
1280pub const HASKELL_LITERAL: u128 = NumberFormatBuilder::new()
1281 .required_digits(true)
1282 .no_positive_mantissa_sign(true)
1283 .no_special(true)
1284 .build_strict();
1285
1286// HASKELL STRING [45678MN]
1287/// Number format to parse a [`Haskell`] float from string.
1288///
1289/// [`Haskell`]: https://www.haskell.org/
1290#[rustfmt::skip]
1291pub const HASKELL_STRING: u128 = NumberFormatBuilder::new()
1292 .required_digits(true)
1293 .no_positive_mantissa_sign(true)
1294 .case_sensitive_special(true)
1295 .build_strict();
1296
1297// JAVASCRIPT LITERAL [01345678M]
1298/// Number format for a [`Javascript`] literal floating-point number.
1299///
1300/// [`Javascript`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript
1301#[rustfmt::skip]
1302pub const JAVASCRIPT_LITERAL: u128 = NumberFormatBuilder::new()
1303 .case_sensitive_special(true)
1304 .no_float_leading_zeros(true)
1305 .build_strict();
1306
1307// JAVASCRIPT STRING [012345678MN]
1308/// Number format to parse a [`Javascript`] float from string.
1309///
1310/// [`Javascript`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript
1311#[rustfmt::skip]
1312pub const JAVASCRIPT_STRING: u128 = NumberFormatBuilder::new()
1313 .required_exponent_digits(false)
1314 .case_sensitive_special(true)
1315 .build_strict();
1316
1317// PERL LITERAL [0134569ABDEFGHIJKMN-_]
1318/// Number format for a [`Perl`] literal floating-point number.
1319///
1320/// [`Perl`]: https://www.perl.org/
1321#[rustfmt::skip]
1322pub const PERL_LITERAL: u128 = NumberFormatBuilder::new()
1323 .digit_separator(num::NonZeroU8::new(b'_'))
1324 .no_special(true)
1325 .internal_digit_separator(true)
1326 .fraction_leading_digit_separator(true)
1327 .exponent_leading_digit_separator(true)
1328 .trailing_digit_separator(true)
1329 .consecutive_digit_separator(true)
1330 .build_strict();
1331
1332// PERL STRING [01234567MN]
1333/// Number format to parse a [`Perl`] float from string.
1334///
1335/// [`Perl`]: https://www.perl.org/
1336pub const PERL_STRING: u128 = PERMISSIVE;
1337
1338// PHP LITERAL [01345678MN]
1339/// Number format for a [`PHP`] literal floating-point number.
1340///
1341/// [`PHP`]: https://www.php.net/
1342#[rustfmt::skip]
1343pub const PHP_LITERAL: u128 = NumberFormatBuilder::new()
1344 .case_sensitive_special(true)
1345 .build_strict();
1346
1347// PHP STRING [0123456MN]
1348/// Number format to parse a [`PHP`] float from string.
1349///
1350/// [`PHP`]: https://www.php.net/
1351#[rustfmt::skip]
1352pub const PHP_STRING: u128 = NumberFormatBuilder::new()
1353 .required_exponent_digits(false)
1354 .no_special(true)
1355 .build_strict();
1356
1357// JAVA LITERAL [0134569ABIJKMN-_]
1358/// Number format for a [`Java`] literal floating-point number.
1359///
1360/// [`Java`]: https://www.java.com/en/
1361#[rustfmt::skip]
1362pub const JAVA_LITERAL: u128 = NumberFormatBuilder::new()
1363 .digit_separator(num::NonZeroU8::new(b'_'))
1364 .no_special(true)
1365 .internal_digit_separator(true)
1366 .consecutive_digit_separator(true)
1367 .build_strict();
1368
1369// JAVA STRING [01345678MN]
1370/// Number format to parse a [`Java`] float from string.
1371///
1372/// [`Java`]: https://www.java.com/en/
1373#[rustfmt::skip]
1374pub const JAVA_STRING: u128 = NumberFormatBuilder::new()
1375 .case_sensitive_special(true)
1376 .build_strict();
1377
1378// R LITERAL [01345678MN]
1379/// Number format for an [`R`] literal floating-point number.
1380///
1381/// [`R`]: https://www.r-project.org/
1382#[rustfmt::skip]
1383pub const R_LITERAL: u128 = NumberFormatBuilder::new()
1384 .case_sensitive_special(true)
1385 .build_strict();
1386
1387// R STRING [01234567MN]
1388/// Number format to parse an [`R`] float from string.
1389///
1390/// [`R`]: https://www.r-project.org/
1391pub const R_STRING: u128 = PERMISSIVE;
1392
1393// KOTLIN LITERAL [0134569ABIJKN-_]
1394/// Number format for a [`Kotlin`] literal floating-point number.
1395///
1396/// [`Kotlin`]: https://kotlinlang.org/
1397#[rustfmt::skip]
1398pub const KOTLIN_LITERAL: u128 = NumberFormatBuilder::new()
1399 .digit_separator(num::NonZeroU8::new(b'_'))
1400 .no_special(true)
1401 .no_integer_leading_zeros(true)
1402 .internal_digit_separator(true)
1403 .consecutive_digit_separator(true)
1404 .build_strict();
1405
1406// KOTLIN STRING [0134568MN]
1407/// Number format to parse a [`Kotlin`] float from string.
1408///
1409/// [`Kotlin`]: https://kotlinlang.org/
1410#[rustfmt::skip]
1411pub const KOTLIN_STRING: u128 = NumberFormatBuilder::new()
1412 .case_sensitive_special(true)
1413 .build_strict();
1414
1415// JULIA LITERAL [01345689AMN-_]
1416/// Number format for a [`Julia`] literal floating-point number.
1417///
1418/// [`Julia`]: https://julialang.org/
1419#[rustfmt::skip]
1420pub const JULIA_LITERAL: u128 = NumberFormatBuilder::new()
1421 .digit_separator(num::NonZeroU8::new(b'_'))
1422 .case_sensitive_special(true)
1423 .integer_internal_digit_separator(true)
1424 .fraction_internal_digit_separator(true)
1425 .build_strict();
1426
1427// JULIA STRING [01345678MN]
1428/// Number format to parse a [`Julia`] float from string.
1429///
1430/// [`Julia`]: https://julialang.org/
1431#[rustfmt::skip]
1432pub const JULIA_STRING: u128 = NumberFormatBuilder::new().build_strict();
1433
1434// JULIA HEX LITERAL [01345689AMN-_]
1435/// Number format for a [`Julia`] literal floating-point number.
1436///
1437/// [`Julia`]: https://julialang.org/
1438#[rustfmt::skip]
1439#[cfg(feature = "power-of-two")]
1440pub const JULIA_HEX_LITERAL: u128 = NumberFormatBuilder::new()
1441 .digit_separator(num::NonZeroU8::new(b'_'))
1442 .mantissa_radix(16)
1443 .exponent_base(num::NonZeroU8::new(2))
1444 .exponent_radix(num::NonZeroU8::new(10))
1445 .case_sensitive_special(true)
1446 .integer_internal_digit_separator(true)
1447 .fraction_internal_digit_separator(true)
1448 .build_strict();
1449
1450// JULIA HEX STRING [01345678MN]
1451/// Number format to parse a [`Julia`] float from string.
1452///
1453/// [`Julia`]: https://julialang.org/
1454#[rustfmt::skip]
1455#[cfg(feature = "power-of-two")]
1456pub const JULIA_HEX_STRING: u128 = NumberFormatBuilder::new()
1457 .mantissa_radix(16)
1458 .exponent_base(num::NonZeroU8::new(2))
1459 .exponent_radix(num::NonZeroU8::new(10))
1460 .build_strict();
1461
1462/// Number format for a [`C#`] literal floating-point number.
1463///
1464/// [`C#`]: https://learn.microsoft.com/en-us/dotnet/csharp/
1465pub const CSHARP_LITERAL: u128 = CSHARP7_LITERAL;
1466
1467/// Number format to parse a [`C#`] float from string.
1468///
1469/// [`C#`]: https://learn.microsoft.com/en-us/dotnet/csharp/
1470pub const CSHARP_STRING: u128 = CSHARP7_STRING;
1471
1472// CSHARP7 LITERAL [034569ABIJKMN-_]
1473/// Number format for a [`C#7`] literal floating-point number.
1474///
1475/// [`C#7`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-73
1476#[rustfmt::skip]
1477pub const CSHARP7_LITERAL: u128 = NumberFormatBuilder::new()
1478 .digit_separator(num::NonZeroU8::new(b'_'))
1479 .required_fraction_digits(true)
1480 .no_special(true)
1481 .internal_digit_separator(true)
1482 .consecutive_digit_separator(true)
1483 .build_strict();
1484
1485// CSHARP7 STRING [0134568MN]
1486/// Number format to parse a [`C#7`] float from string.
1487///
1488/// [`C#7`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-73
1489#[rustfmt::skip]
1490pub const CSHARP7_STRING: u128 = NumberFormatBuilder::new()
1491 .case_sensitive_special(true)
1492 .build_strict();
1493
1494// CSHARP6 LITERAL [03456MN]
1495/// Number format for a [`C#6`] literal floating-point number.
1496///
1497/// [`C#6`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-60
1498#[rustfmt::skip]
1499pub const CSHARP6_LITERAL: u128 = NumberFormatBuilder::new()
1500 .required_fraction_digits(true)
1501 .no_special(true)
1502 .build_strict();
1503
1504// CSHARP6 STRING [0134568MN]
1505/// Number format to parse a [`C#6`] float from string.
1506///
1507/// [`C#6`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-60
1508#[rustfmt::skip]
1509pub const CSHARP6_STRING: u128 = NumberFormatBuilder::new()
1510 .case_sensitive_special(true)
1511 .build_strict();
1512
1513// CSHARP5 LITERAL [03456MN]
1514/// Number format for a [`C#5`] literal floating-point number.
1515///
1516/// [`C#5`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-50
1517#[rustfmt::skip]
1518pub const CSHARP5_LITERAL: u128 = NumberFormatBuilder::new()
1519 .required_fraction_digits(true)
1520 .no_special(true)
1521 .build_strict();
1522
1523// CSHARP5 STRING [0134568MN]
1524/// Number format to parse a [`C#5`] float from string.
1525///
1526/// [`C#5`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-50
1527#[rustfmt::skip]
1528pub const CSHARP5_STRING: u128 = NumberFormatBuilder::new()
1529 .case_sensitive_special(true)
1530 .build_strict();
1531
1532// CSHARP4 LITERAL [03456MN]
1533/// Number format for a [`C#4`] literal floating-point number.
1534///
1535/// [`C#4`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-40
1536#[rustfmt::skip]
1537pub const CSHARP4_LITERAL: u128 = NumberFormatBuilder::new()
1538 .required_fraction_digits(true)
1539 .no_special(true)
1540 .build_strict();
1541
1542// CSHARP4 STRING [0134568MN]
1543/// Number format to parse a [`C#4`] float from string.
1544///
1545/// [`C#4`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-40
1546#[rustfmt::skip]
1547pub const CSHARP4_STRING: u128 = NumberFormatBuilder::new()
1548 .case_sensitive_special(true)
1549 .build_strict();
1550
1551// CSHARP3 LITERAL [03456MN]
1552/// Number format for a [`C#3`] literal floating-point number.
1553///
1554/// [`C#3`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-30
1555#[rustfmt::skip]
1556pub const CSHARP3_LITERAL: u128 = NumberFormatBuilder::new()
1557 .required_fraction_digits(true)
1558 .no_special(true)
1559 .build_strict();
1560
1561// CSHARP3 STRING [0134568MN]
1562/// Number format to parse a [`C#3`] float from string.
1563///
1564/// [`C#3`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-30
1565#[rustfmt::skip]
1566pub const CSHARP3_STRING: u128 = NumberFormatBuilder::new()
1567 .case_sensitive_special(true)
1568 .build_strict();
1569
1570// CSHARP2 LITERAL [03456MN]
1571/// Number format for a [`C#2`] literal floating-point number.
1572///
1573/// [`C#2`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-20
1574#[rustfmt::skip]
1575pub const CSHARP2_LITERAL: u128 = NumberFormatBuilder::new()
1576 .required_fraction_digits(true)
1577 .no_special(true)
1578 .build_strict();
1579
1580// CSHARP2 STRING [0134568MN]
1581/// Number format to parse a [`C#2`] float from string.
1582///
1583/// [`C#2`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-20
1584#[rustfmt::skip]
1585pub const CSHARP2_STRING: u128 = NumberFormatBuilder::new()
1586 .case_sensitive_special(true)
1587 .build_strict();
1588
1589// CSHARP1 LITERAL [03456MN]
1590/// Number format for a [`C#1`] literal floating-point number.
1591///
1592/// [`C#1`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-12-1
1593#[rustfmt::skip]
1594pub const CSHARP1_LITERAL: u128 = NumberFormatBuilder::new()
1595 .required_fraction_digits(true)
1596 .no_special(true)
1597 .build_strict();
1598
1599// CSHARP1 STRING [0134568MN]
1600/// Number format to parse a [`C#1`] float from string.
1601///
1602/// [`C#1`]: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-12-1
1603#[rustfmt::skip]
1604pub const CSHARP1_STRING: u128 = NumberFormatBuilder::new()
1605 .case_sensitive_special(true)
1606 .build_strict();
1607
1608// KAWA LITERAL [013456MN]
1609/// Number format for a [`Kawa`] literal floating-point number.
1610///
1611/// [`Kawa`]: https://www.gnu.org/software/kawa/
1612#[rustfmt::skip]
1613pub const KAWA_LITERAL: u128 = NumberFormatBuilder::new()
1614 .no_special(true)
1615 .build_strict();
1616
1617// KAWA STRING [013456MN]
1618/// Number format to parse a [`Kawa`] float from string.
1619///
1620/// [`Kawa`]: https://www.gnu.org/software/kawa/
1621#[rustfmt::skip]
1622pub const KAWA_STRING: u128 = NumberFormatBuilder::new()
1623 .no_special(true)
1624 .build_strict();
1625
1626// GAMBITC LITERAL [013456MN]
1627/// Number format for a [`Gambit-C`] literal floating-point number.
1628///
1629/// [`Gambit-C`]: https://gambitscheme.org/
1630#[rustfmt::skip]
1631pub const GAMBITC_LITERAL: u128 = NumberFormatBuilder::new()
1632 .no_special(true)
1633 .build_strict();
1634
1635// GAMBITC STRING [013456MN]
1636/// Number format to parse a [`Gambit-C`] float from string.
1637///
1638/// [`Gambit-C`]: https://gambitscheme.org/
1639#[rustfmt::skip]
1640pub const GAMBITC_STRING: u128 = NumberFormatBuilder::new()
1641 .no_special(true)
1642 .build_strict();
1643
1644// GUILE LITERAL [013456MN]
1645/// Number format for a [`Guile`] literal floating-point number.
1646///
1647/// [`Guile`]: https://www.gnu.org/software/guile/
1648#[rustfmt::skip]
1649pub const GUILE_LITERAL: u128 = NumberFormatBuilder::new()
1650 .no_special(true)
1651 .build_strict();
1652
1653// GUILE STRING [013456MN]
1654/// Number format to parse a [`Guile`] float from string.
1655///
1656/// [`Guile`]: https://www.gnu.org/software/guile/
1657#[rustfmt::skip]
1658pub const GUILE_STRING: u128 = NumberFormatBuilder::new()
1659 .no_special(true)
1660 .build_strict();
1661
1662// CLOJURE LITERAL [13456MN]
1663/// Number format for a [`Clojure`] literal floating-point number.
1664///
1665/// [`Clojure`]: https://clojure.org/
1666#[rustfmt::skip]
1667pub const CLOJURE_LITERAL: u128 = NumberFormatBuilder::new()
1668 .required_integer_digits(true)
1669 .no_special(true)
1670 .build_strict();
1671
1672// CLOJURE STRING [01345678MN]
1673/// Number format to parse a [`Clojure`] float from string.
1674///
1675/// [`Clojure`]: https://clojure.org/
1676#[rustfmt::skip]
1677pub const CLOJURE_STRING: u128 = NumberFormatBuilder::new()
1678 .case_sensitive_special(true)
1679 .build_strict();
1680
1681// ERLANG LITERAL [34578MN]
1682/// Number format for an [`Erlang`] literal floating-point number.
1683///
1684/// [`Erlang`]: https://www.erlang.org/
1685#[rustfmt::skip]
1686pub const ERLANG_LITERAL: u128 = NumberFormatBuilder::new()
1687 .required_digits(true)
1688 .no_exponent_without_fraction(true)
1689 .case_sensitive_special(true)
1690 .build_strict();
1691
1692// ERLANG STRING [345MN]
1693/// Number format to parse an [`Erlang`] float from string.
1694///
1695/// [`Erlang`]: https://www.erlang.org/
1696#[rustfmt::skip]
1697pub const ERLANG_STRING: u128 = NumberFormatBuilder::new()
1698 .required_digits(true)
1699 .no_exponent_without_fraction(true)
1700 .no_special(true)
1701 .build_strict();
1702
1703// ELM LITERAL [456]
1704/// Number format for an [`Elm`] literal floating-point number.
1705///
1706/// [`Elm`]: https://elm-lang.org/
1707#[rustfmt::skip]
1708pub const ELM_LITERAL: u128 = NumberFormatBuilder::new()
1709 .required_digits(true)
1710 .no_positive_mantissa_sign(true)
1711 .no_integer_leading_zeros(true)
1712 .no_float_leading_zeros(true)
1713 .no_special(true)
1714 .build_strict();
1715
1716// ELM STRING [01345678MN]
1717// Note: There is no valid representation of NaN, just Infinity.
1718/// Number format to parse an [`Elm`] float from string.
1719///
1720/// [`Elm`]: https://elm-lang.org/
1721#[rustfmt::skip]
1722pub const ELM_STRING: u128 = NumberFormatBuilder::new()
1723 .case_sensitive_special(true)
1724 .build_strict();
1725
1726// SCALA LITERAL [3456]
1727/// Number format for a [`Scala`] literal floating-point number.
1728///
1729/// [`Scala`]: https://www.scala-lang.org/
1730#[rustfmt::skip]
1731pub const SCALA_LITERAL: u128 = NumberFormatBuilder::new()
1732 .required_digits(true)
1733 .no_special(true)
1734 .no_integer_leading_zeros(true)
1735 .no_float_leading_zeros(true)
1736 .build_strict();
1737
1738// SCALA STRING [01345678MN]
1739/// Number format to parse a [`Scala`] float from string.
1740///
1741/// [`Scala`]: https://www.scala-lang.org/
1742#[rustfmt::skip]
1743pub const SCALA_STRING: u128 = NumberFormatBuilder::new()
1744 .case_sensitive_special(true)
1745 .build_strict();
1746
1747// ELIXIR LITERAL [3459ABMN-_]
1748/// Number format for an [`Elixir`] literal floating-point number.
1749///
1750/// [`Elixir`]: https://elixir-lang.org/
1751#[rustfmt::skip]
1752pub const ELIXIR_LITERAL: u128 = NumberFormatBuilder::new()
1753 .digit_separator(num::NonZeroU8::new(b'_'))
1754 .required_digits(true)
1755 .no_exponent_without_fraction(true)
1756 .no_special(true)
1757 .internal_digit_separator(true)
1758 .build_strict();
1759
1760// ELIXIR STRING [345MN]
1761/// Number format to parse an [`Elixir`] float from string.
1762///
1763/// [`Elixir`]: https://elixir-lang.org/
1764#[rustfmt::skip]
1765pub const ELIXIR_STRING: u128 = NumberFormatBuilder::new()
1766 .required_digits(true)
1767 .no_exponent_without_fraction(true)
1768 .no_special(true)
1769 .build_strict();
1770
1771// FORTRAN LITERAL [013456MN]
1772/// Number format for a [`FORTRAN`] literal floating-point number.
1773///
1774/// [`FORTRAN`]: https://fortran-lang.org/
1775#[rustfmt::skip]
1776pub const FORTRAN_LITERAL: u128 = NumberFormatBuilder::new()
1777 .no_special(true)
1778 .build_strict();
1779
1780// FORTRAN STRING [0134567MN]
1781/// Number format to parse a [`FORTRAN`] float from string.
1782///
1783/// [`FORTRAN`]: https://fortran-lang.org/
1784#[rustfmt::skip]
1785pub const FORTRAN_STRING: u128 = NumberFormatBuilder::new().build_strict();
1786
1787// D LITERAL [0134569ABFGHIJKN-_]
1788/// Number format for a [`D`] literal floating-point number.
1789///
1790/// [`D`]: https://dlang.org/
1791#[rustfmt::skip]
1792pub const D_LITERAL: u128 = NumberFormatBuilder::new()
1793 .digit_separator(num::NonZeroU8::new(b'_'))
1794 .no_special(true)
1795 .no_integer_leading_zeros(true)
1796 .internal_digit_separator(true)
1797 .trailing_digit_separator(true)
1798 .consecutive_digit_separator(true)
1799 .build_strict();
1800
1801// D STRING [01345679AFGMN-_]
1802/// Number format to parse a [`D`] float from string.
1803///
1804/// [`D`]: https://dlang.org/
1805#[rustfmt::skip]
1806pub const D_STRING: u128 = NumberFormatBuilder::new()
1807 .digit_separator(num::NonZeroU8::new(b'_'))
1808 .integer_internal_digit_separator(true)
1809 .fraction_internal_digit_separator(true)
1810 .integer_trailing_digit_separator(true)
1811 .fraction_trailing_digit_separator(true)
1812 .build_strict();
1813
1814// COFFEESCRIPT LITERAL [01345678]
1815/// Number format for a [`Coffeescript`] literal floating-point number.
1816///
1817/// [`Coffeescript`]: https://coffeescript.org/
1818#[rustfmt::skip]
1819pub const COFFEESCRIPT_LITERAL: u128 = NumberFormatBuilder::new()
1820 .case_sensitive_special(true)
1821 .no_integer_leading_zeros(true)
1822 .no_float_leading_zeros(true)
1823 .build_strict();
1824
1825// COFFEESCRIPT STRING [012345678MN]
1826/// Number format to parse a [`Coffeescript`] float from string.
1827///
1828/// [`Coffeescript`]: https://coffeescript.org/
1829#[rustfmt::skip]
1830pub const COFFEESCRIPT_STRING: u128 = NumberFormatBuilder::new()
1831 .case_sensitive_special(true)
1832 .build_strict();
1833
1834// COBOL LITERAL [0345MN]
1835/// Number format for a [`Cobol`] literal floating-point number.
1836///
1837/// [`Cobol`]: https://www.ibm.com/think/topics/cobol
1838#[rustfmt::skip]
1839pub const COBOL_LITERAL: u128 = NumberFormatBuilder::new()
1840 .required_fraction_digits(true)
1841 .no_exponent_without_fraction(true)
1842 .no_special(true)
1843 .build_strict();
1844
1845// COBOL STRING [012356MN]
1846/// Number format to parse a [`Cobol`] float from string.
1847///
1848/// [`Cobol`]: https://www.ibm.com/think/topics/cobol
1849#[rustfmt::skip]
1850pub const COBOL_STRING: u128 = NumberFormatBuilder::new()
1851 .required_exponent_sign(true)
1852 .no_special(true)
1853 .build_strict();
1854
1855// FSHARP LITERAL [13456789ABIJKMN-_]
1856/// Number format for a [`F#`] literal floating-point number.
1857///
1858/// [`F#`]: https://fsharp.org/
1859#[rustfmt::skip]
1860pub const FSHARP_LITERAL: u128 = NumberFormatBuilder::new()
1861 .digit_separator(num::NonZeroU8::new(b'_'))
1862 .required_integer_digits(true)
1863 .required_exponent_digits(true)
1864 .case_sensitive_special(true)
1865 .internal_digit_separator(true)
1866 .consecutive_digit_separator(true)
1867 .build_strict();
1868
1869// FSHARP STRING [013456789ABCDEFGHIJKLMN-_]
1870/// Number format to parse a [`F#`] float from string.
1871///
1872/// [`F#`]: https://fsharp.org/
1873#[rustfmt::skip]
1874pub const FSHARP_STRING: u128 = NumberFormatBuilder::new()
1875 .digit_separator(num::NonZeroU8::new(b'_'))
1876 .internal_digit_separator(true)
1877 .leading_digit_separator(true)
1878 .trailing_digit_separator(true)
1879 .consecutive_digit_separator(true)
1880 .special_digit_separator(true)
1881 .build_strict();
1882
1883// VB LITERAL [03456MN]
1884/// Number format for a [`Visual Basic`] literal floating-point number.
1885///
1886/// [`Visual Basic`]: https://learn.microsoft.com/en-us/dotnet/visual-basic/
1887#[rustfmt::skip]
1888pub const VB_LITERAL: u128 = NumberFormatBuilder::new()
1889 .required_fraction_digits(true)
1890 .no_special(true)
1891 .build_strict();
1892
1893// VB STRING [01345678MN]
1894/// Number format to parse a [`Visual Basic`] float from string.
1895///
1896/// [`Visual Basic`]: https://learn.microsoft.com/en-us/dotnet/visual-basic/
1897// Note: To my knowledge, Visual Basic cannot parse infinity.
1898#[rustfmt::skip]
1899pub const VB_STRING: u128 = NumberFormatBuilder::new()
1900 .case_sensitive_special(true)
1901 .build_strict();
1902
1903// OCAML LITERAL [1456789ABDFGHIJKMN-_]
1904/// Number format for an [`OCaml`] literal floating-point number.
1905///
1906/// [`OCaml`]: https://ocaml.org/
1907#[rustfmt::skip]
1908pub const OCAML_LITERAL: u128 = NumberFormatBuilder::new()
1909 .digit_separator(num::NonZeroU8::new(b'_'))
1910 .required_integer_digits(true)
1911 .required_exponent_digits(true)
1912 .no_positive_mantissa_sign(true)
1913 .case_sensitive_special(true)
1914 .internal_digit_separator(true)
1915 .fraction_leading_digit_separator(true)
1916 .trailing_digit_separator(true)
1917 .consecutive_digit_separator(true)
1918 .build_strict();
1919
1920// OCAML STRING [01345679ABCDEFGHIJKLMN-_]
1921/// Number format to parse an [`OCaml`] float from string.
1922///
1923/// [`OCaml`]: https://ocaml.org/
1924#[rustfmt::skip]
1925pub const OCAML_STRING: u128 = NumberFormatBuilder::new()
1926 .digit_separator(num::NonZeroU8::new(b'_'))
1927 .internal_digit_separator(true)
1928 .leading_digit_separator(true)
1929 .trailing_digit_separator(true)
1930 .consecutive_digit_separator(true)
1931 .special_digit_separator(true)
1932 .build_strict();
1933
1934// OBJECTIVEC LITERAL [013456MN]
1935/// Number format for an [`Objective-C`] literal floating-point number.
1936///
1937/// [`Objective-C`]: https://en.wikipedia.org/wiki/Objective-C
1938#[rustfmt::skip]
1939pub const OBJECTIVEC_LITERAL: u128 = NumberFormatBuilder::new()
1940 .no_special(true)
1941 .build_strict();
1942
1943// OBJECTIVEC STRING [013456MN]
1944/// Number format to parse an [`Objective-C`] float from string.
1945///
1946/// [`Objective-C`]: https://en.wikipedia.org/wiki/Objective-C
1947#[rustfmt::skip]
1948pub const OBJECTIVEC_STRING: u128 = NumberFormatBuilder::new()
1949 .no_special(true)
1950 .build_strict();
1951
1952// REASONML LITERAL [13456789ABDFGHIJKMN-_]
1953/// Number format for a [`ReasonML`] literal floating-point number.
1954///
1955/// [`ReasonML`]: https://reasonml.github.io/
1956#[rustfmt::skip]
1957pub const REASONML_LITERAL: u128 = NumberFormatBuilder::new()
1958 .digit_separator(num::NonZeroU8::new(b'_'))
1959 .required_integer_digits(true)
1960 .required_exponent_digits(true)
1961 .case_sensitive_special(true)
1962 .internal_digit_separator(true)
1963 .fraction_leading_digit_separator(true)
1964 .trailing_digit_separator(true)
1965 .consecutive_digit_separator(true)
1966 .build_strict();
1967
1968// REASONML STRING [01345679ABCDEFGHIJKLMN-_]
1969/// Number format to parse a [`ReasonML`] float from string.
1970///
1971/// [`ReasonML`]: https://reasonml.github.io/
1972#[rustfmt::skip]
1973pub const REASONML_STRING: u128 = NumberFormatBuilder::new()
1974 .digit_separator(num::NonZeroU8::new(b'_'))
1975 .internal_digit_separator(true)
1976 .leading_digit_separator(true)
1977 .trailing_digit_separator(true)
1978 .consecutive_digit_separator(true)
1979 .special_digit_separator(true)
1980 .build_strict();
1981
1982// OCTAVE LITERAL [013456789ABDFGHIJKMN-_]
1983// Note: Octave accepts both NaN and nan, Inf and inf.
1984/// Number format for an [`Octave`] literal floating-point number.
1985///
1986/// [`Octave`]: https://octave.org/
1987#[rustfmt::skip]
1988pub const OCTAVE_LITERAL: u128 = NumberFormatBuilder::new()
1989 .digit_separator(num::NonZeroU8::new(b'_'))
1990 .case_sensitive_special(true)
1991 .internal_digit_separator(true)
1992 .fraction_leading_digit_separator(true)
1993 .trailing_digit_separator(true)
1994 .consecutive_digit_separator(true)
1995 .build_strict();
1996
1997// OCTAVE STRING [01345679ABCDEFGHIJKMN-,]
1998/// Number format to parse an [`Octave`] float from string.
1999///
2000/// [`Octave`]: https://octave.org/
2001#[rustfmt::skip]
2002pub const OCTAVE_STRING: u128 = NumberFormatBuilder::new()
2003 .digit_separator(num::NonZeroU8::new(b','))
2004 .internal_digit_separator(true)
2005 .leading_digit_separator(true)
2006 .trailing_digit_separator(true)
2007 .consecutive_digit_separator(true)
2008 .build_strict();
2009
2010// MATLAB LITERAL [013456789ABDFGHIJKMN-_]
2011// Note: Matlab accepts both NaN and nan, Inf and inf.
2012/// Number format for an [`Matlab`] literal floating-point number.
2013///
2014/// [`Matlab`]: https://www.mathworks.com/products/matlab.html
2015#[rustfmt::skip]
2016pub const MATLAB_LITERAL: u128 = NumberFormatBuilder::new()
2017 .digit_separator(num::NonZeroU8::new(b'_'))
2018 .case_sensitive_special(true)
2019 .internal_digit_separator(true)
2020 .fraction_leading_digit_separator(true)
2021 .trailing_digit_separator(true)
2022 .consecutive_digit_separator(true)
2023 .build_strict();
2024
2025// MATLAB STRING [01345679ABCDEFGHIJKMN-,]
2026/// Number format to parse an [`Matlab`] float from string.
2027///
2028/// [`Matlab`]: https://www.mathworks.com/products/matlab.html
2029#[rustfmt::skip]
2030pub const MATLAB_STRING: u128 = NumberFormatBuilder::new()
2031 .digit_separator(num::NonZeroU8::new(b','))
2032 .internal_digit_separator(true)
2033 .leading_digit_separator(true)
2034 .trailing_digit_separator(true)
2035 .consecutive_digit_separator(true)
2036 .build_strict();
2037
2038// ZIG LITERAL [1456MN]
2039/// Number format for a [`Zig`] literal floating-point number.
2040///
2041/// [`Zig`]: https://ziglang.org/
2042#[rustfmt::skip]
2043pub const ZIG_LITERAL: u128 = NumberFormatBuilder::new()
2044 .required_integer_digits(true)
2045 .no_positive_mantissa_sign(true)
2046 .no_special(true)
2047 .build_strict();
2048
2049// ZIG STRING [01234567MN]
2050/// Number format to parse a [`Zig`] float from string.
2051///
2052/// [`Zig`]: https://ziglang.org/
2053pub const ZIG_STRING: u128 = PERMISSIVE;
2054
2055// SAGE LITERAL [012345678MN]
2056// Note: Both Infinity and infinity are accepted.
2057/// Number format for a [`Sage`] literal floating-point number.
2058///
2059/// [`Sage`]: https://www.sagemath.org/
2060#[rustfmt::skip]
2061pub const SAGE_LITERAL: u128 = NumberFormatBuilder::new()
2062 .case_sensitive_special(true)
2063 .build_strict();
2064
2065// SAGE STRING [01345679ABMN-_]
2066/// Number format to parse a [`Sage`] float from string.
2067///
2068/// [`Sage`]: https://www.sagemath.org/
2069#[rustfmt::skip]
2070pub const SAGE_STRING: u128 = NumberFormatBuilder::new()
2071 .digit_separator(num::NonZeroU8::new(b'_'))
2072 .internal_digit_separator(true)
2073 .build_strict();
2074
2075// JSON [456]
2076/// Number format for a [`JSON`][`JSON-REF`] literal floating-point number.
2077///
2078/// [`JSON-REF`]: https://www.json.org/json-en.html
2079#[rustfmt::skip]
2080pub const JSON: u128 = NumberFormatBuilder::new()
2081 .required_digits(true)
2082 .no_positive_mantissa_sign(true)
2083 .no_special(true)
2084 .no_integer_leading_zeros(true)
2085 .no_float_leading_zeros(true)
2086 .build_strict();
2087
2088// TOML [34569AB]
2089/// Number format for a [`TOML`][`TOML-REF`] literal floating-point number.
2090///
2091/// [`TOML-REF`]: https://toml.io/en/
2092#[rustfmt::skip]
2093pub const TOML: u128 = NumberFormatBuilder::new()
2094 .digit_separator(num::NonZeroU8::new(b'_'))
2095 .required_digits(false)
2096 .no_special(true)
2097 .no_integer_leading_zeros(true)
2098 .no_float_leading_zeros(true)
2099 .internal_digit_separator(true)
2100 .build_strict();
2101
2102// YAML (defined in-terms of JSON schema).
2103/// Number format for a [`YAML`][`YAML-REF`] literal floating-point number.
2104///
2105/// [`YAML-REF`]: https://yaml.org/
2106pub const YAML: u128 = JSON;
2107
2108// XML [01234578MN]
2109/// Number format for an [`XML`][`XML-REF`] literal floating-point number.
2110///
2111/// [`XML-REF`]: https://en.wikipedia.org/wiki/XML
2112#[rustfmt::skip]
2113pub const XML: u128 = NumberFormatBuilder::new()
2114 .required_exponent_digits(false)
2115 .case_sensitive_special(true)
2116 .build_strict();
2117
2118// SQLITE [013456MN]
2119/// Number format for a [`SQLite`] literal floating-point number.
2120///
2121/// [`SQLite`]: https://www.sqlite.org/
2122#[rustfmt::skip]
2123pub const SQLITE: u128 = NumberFormatBuilder::new()
2124 .no_special(true)
2125 .build_strict();
2126
2127// POSTGRESQL [013456MN]
2128/// Number format for a [`PostgreSQL`] literal floating-point number.
2129///
2130/// [`PostgreSQL`]: https://www.postgresql.org/
2131#[rustfmt::skip]
2132pub const POSTGRESQL: u128 = NumberFormatBuilder::new()
2133 .no_special(true)
2134 .build_strict();
2135
2136// MYSQL [013456MN]
2137/// Number format for a [`MySQL`] literal floating-point number.
2138///
2139/// [`MySQL`]: https://www.mysql.com/
2140#[rustfmt::skip]
2141pub const MYSQL: u128 = NumberFormatBuilder::new()
2142 .no_special(true)
2143 .build_strict();
2144
2145// MONGODB [01345678M]
2146/// Number format for a [`MongoDB`] literal floating-point number.
2147///
2148/// [`MongoDB`]: https://www.mongodb.com/
2149#[rustfmt::skip]
2150pub const MONGODB: u128 = NumberFormatBuilder::new()
2151 .case_sensitive_special(true)
2152 .no_float_leading_zeros(true)
2153 .build_strict();
2154
2155// HIDDEN DEFAULTS AND INTERFACES
2156
2157/// Number format when no flags are set.
2158#[doc(hidden)]
2159#[rustfmt::skip]
2160pub const PERMISSIVE: u128 = NumberFormatBuilder::new()
2161 .required_exponent_digits(false)
2162 .required_mantissa_digits(false)
2163 .build_strict();
2164
2165/// Number format when all digit separator flags are set.
2166#[doc(hidden)]
2167#[rustfmt::skip]
2168pub const IGNORE: u128 = NumberFormatBuilder::new()
2169 .digit_separator(num::NonZeroU8::new(b'_'))
2170 .digit_separator_flags(true)
2171 .required_exponent_digits(false)
2172 .required_mantissa_digits(false)
2173 .build_strict();