chiark / gitweb /
Integers apparently may not have double, leading, or trailing underscores
authorJeff Ober <jober@ziprecruiter.com>
Fri, 10 Jan 2020 18:55:42 +0000 (13:55 -0500)
committerJeff Ober <jober@ziprecruiter.com>
Fri, 10 Jan 2020 18:55:42 +0000 (13:55 -0500)
lib/TOML/Tiny/Grammar.pm

index 784b53a70024e5c3639cd3bec42a165eb59df486..04711856c6fb425b9ad6b05b173003df5d57675b 100644 (file)
@@ -59,22 +59,16 @@ our $TOML = qr{
   (?<KeyValuePairDecl> (?&Key) (?&WS) = (?&WS) (?&Value) (?&WS) (?&NL))
 
   (?<KeyValuePairList>
-      (?&KeyValuePair) (?&WS) [,] (?&WS) (?&KeyValuePairList)?
+      (?&KeyValuePair) (?&WS) (?: [,] (?&WS) (?&KeyValuePairList) )?
     | (?&KeyValuePair)
   )
 
   (?<InlineTable>
-    (?s)
-
     {
-      (?&WS) (?&NLSeq)? (?&WS)
-
+      (?&WS)
       (?&KeyValuePairList)
-
-      (?&WS) (?&NLSeq)? (?&WS)
+      (?&WS)
     }
-
-    (?-s)
   )
 
   (?<TableDecl>
@@ -136,10 +130,16 @@ our $TOML = qr{
   #-----------------------------------------------------------------------------
   # Integer
   #-----------------------------------------------------------------------------
-  (?<Dec> [-+]? [_0-9]+)
-  (?<Hex> 0x[_0-9a-fA-F]+)
-  (?<Oct> 0o[_0-7]+)
-  (?<Bin> 0b[_01]+)
+  (?<DecChar> [0-9])
+  (?<HexChar> (?&DecChar) | [a-f A-F])
+  (?<OctChar> [0-7])
+  (?<BinChar> [01])
+
+  (?<Dec> [-+]? (?&DecChar) (?: (?&DecChar) | (?: _ (?&DecChar) ))*)
+  (?<Hex> 0x (?&HexChar) (?: (?&HexChar) | (?: [_] (?&HexChar) ))*)
+  (?<Oct> 0o (?&OctChar) (?: (?&OctChar) | (?: [_] (?&OctChar) ))*)
+  (?<Bin> 0b (?&BinChar) (?: (?&BinChar) | (?: [_] (?&BinChar) ))*)
+
   (?<Integer> (?&Hex) | (?&Oct) | (?&Bin) | (?&Dec))
 
   #-----------------------------------------------------------------------------