@@ -3,7 +3,6 @@ package toml
33import (
44 "fmt"
55 "math"
6- "os"
76 "strconv"
87 "strings"
98 "time"
@@ -17,7 +16,6 @@ type parser struct {
1716 context Key // Full key for the current hash in scope.
1817 currentKey string // Base key name for everything except hashes.
1918 pos Position // Current position in the TOML file.
20- tomlNext bool
2119
2220 ordered []Key // List of keys in the order that they appear in the TOML data.
2321
@@ -32,8 +30,6 @@ type keyInfo struct {
3230}
3331
3432func parse (data string ) (p * parser , err error ) {
35- _ , tomlNext := os .LookupEnv ("BURNTSUSHI_TOML_110" )
36-
3733 defer func () {
3834 if r := recover (); r != nil {
3935 if pErr , ok := r .(ParseError ); ok {
@@ -73,10 +69,9 @@ func parse(data string) (p *parser, err error) {
7369 p = & parser {
7470 keyInfo : make (map [string ]keyInfo ),
7571 mapping : make (map [string ]any ),
76- lx : lex (data , tomlNext ),
72+ lx : lex (data ),
7773 ordered : make ([]Key , 0 ),
7874 implicits : make (map [string ]struct {}),
79- tomlNext : tomlNext ,
8075 }
8176 for {
8277 item := p .next ()
@@ -350,17 +345,14 @@ func (p *parser) valueFloat(it item) (any, tomlType) {
350345var dtTypes = []struct {
351346 fmt string
352347 zone * time.Location
353- next bool
354348}{
355- {time .RFC3339Nano , time .Local , false },
356- {"2006-01-02T15:04:05.999999999" , internal .LocalDatetime , false },
357- {"2006-01-02" , internal .LocalDate , false },
358- {"15:04:05.999999999" , internal .LocalTime , false },
359-
360- // tomlNext
361- {"2006-01-02T15:04Z07:00" , time .Local , true },
362- {"2006-01-02T15:04" , internal .LocalDatetime , true },
363- {"15:04" , internal .LocalTime , true },
349+ {time .RFC3339Nano , time .Local },
350+ {"2006-01-02T15:04:05.999999999" , internal .LocalDatetime },
351+ {"2006-01-02" , internal .LocalDate },
352+ {"15:04:05.999999999" , internal .LocalTime },
353+ {"2006-01-02T15:04Z07:00" , time .Local },
354+ {"2006-01-02T15:04" , internal .LocalDatetime },
355+ {"15:04" , internal .LocalTime },
364356}
365357
366358func (p * parser ) valueDatetime (it item ) (any , tomlType ) {
@@ -371,9 +363,6 @@ func (p *parser) valueDatetime(it item) (any, tomlType) {
371363 err error
372364 )
373365 for _ , dt := range dtTypes {
374- if dt .next && ! p .tomlNext {
375- continue
376- }
377366 t , err = time .ParseInLocation (dt .fmt , it .val , dt .zone )
378367 if err == nil {
379368 if missingLeadingZero (it .val , dt .fmt ) {
@@ -807,10 +796,8 @@ func (p *parser) replaceEscapes(it item, str string) string {
807796 b .WriteByte (0x0d )
808797 skip = 1
809798 case 'e' :
810- if p .tomlNext {
811- b .WriteByte (0x1b )
812- skip = 1
813- }
799+ b .WriteByte (0x1b )
800+ skip = 1
814801 case '"' :
815802 b .WriteByte (0x22 )
816803 skip = 1
@@ -820,11 +807,9 @@ func (p *parser) replaceEscapes(it item, str string) string {
820807 // The lexer guarantees the correct number of characters are present;
821808 // don't need to check here.
822809 case 'x' :
823- if p .tomlNext {
824- escaped := p .asciiEscapeToUnicode (it , str [i + 2 :i + 4 ])
825- b .WriteRune (escaped )
826- skip = 3
827- }
810+ escaped := p .asciiEscapeToUnicode (it , str [i + 2 :i + 4 ])
811+ b .WriteRune (escaped )
812+ skip = 3
828813 case 'u' :
829814 escaped := p .asciiEscapeToUnicode (it , str [i + 2 :i + 6 ])
830815 b .WriteRune (escaped )
0 commit comments