mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-29 13:49:10 +08:00
59 lines
38 KiB
Go
59 lines
38 KiB
Go
//
|
|
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
|
//
|
|
// This is a commercial product and requires a license to operate.
|
|
// A trial license can be obtained at https://unidoc.io
|
|
//
|
|
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
|
//
|
|
// Use of this source code is governed by the UniDoc End User License Agreement
|
|
// terms that can be accessed at https://unidoc.io/eula/
|
|
|
|
// Package format provides support for parsing and evaluating
|
|
// spreadsheetml/Excel number formats.
|
|
//
|
|
// Internally spreadsheets store numbers and dates values as a text
|
|
// representation of a floating point number (e.g. 1.2345). This number is then
|
|
// displayed in Excel or another spreadsheet viewer differently depending on the
|
|
// number fornat of the cell style applied to the cell.
|
|
//
|
|
// As an example, the same value of 1.2345 can be displayed as:
|
|
// - "1" with format "0"
|
|
// - "1.2" with format "0.0"
|
|
// - "1.23" with format "0.00"
|
|
// - "1.235" with format "0.000"
|
|
// - "123%" with format "0%"
|
|
// - "1 23/100" with fornat "0 0/100"
|
|
// - "1.23E+00" with format "0.00E+00"
|
|
// - "29:37:41s" with format `[h]:mm:ss"s"`
|
|
package format ;import (_dfb "bytes";_fdef "fmt";_eegg "github.com/unidoc/unioffice";_bbfb "io";_daae "math";_gff "strconv";_decb "strings";_fg "time";);
|
|
|
|
// Format is a parsed number format.
|
|
type Format struct{Whole []Token ;Fractional []Token ;Exponent []Token ;IsExponential bool ;_ggd bool ;_bafe bool ;_dde bool ;_gac bool ;_gad bool ;_cbc bool ;_ebdg int64 ;_fae int ;};type Lexer struct{_gag Format ;_cgf []Format ;};
|
|
|
|
// Number is used to format a number with a format string. If the format
|
|
// string is empty, then General number formatting is used which attempts to mimic
|
|
// Excel's general formatting.
|
|
func Number (v float64 ,f string )string {if f ==""||f =="\u0047e\u006e\u0065\u0072\u0061\u006c"||f =="\u0040"{return NumberGeneric (v );};_gacb :=Parse (f );if len (_gacb )==1{return _fcfc (v ,_gacb [0],false );}else if len (_gacb )> 1&&v < 0{return _fcfc (v ,_gacb [1],true );}else if len (_gacb )> 2&&v ==0{return _fcfc (v ,_gacb [2],false );};return _fcfc (v ,_gacb [0],false );};func _fda (_bfc ,_ged float64 ,_dgg Format )[]byte {if len (_dgg .Fractional )==0{return nil ;};_ebg :=_gff .AppendFloat (nil ,_bfc ,'f',-1,64);if len (_ebg )> 2{_ebg =_ebg [2:];}else {_ebg =nil ;};_gffa :=make ([]byte ,0,len (_ebg ));_gffa =append (_gffa ,'.');_dbf :=0;_ddea :for _aba :=0;_aba < len (_dgg .Fractional );_aba ++{_dfd :=_aba ;_dcd :=_dgg .Fractional [_aba ];switch _dcd .Type {case FmtTypeDigit :if _dfd < len (_ebg ){_gffa =append (_gffa ,_ebg [_dfd ]);_dbf ++;}else {_gffa =append (_gffa ,'0');};case FmtTypeDigitOpt :if _dfd >=0{_gffa =append (_gffa ,_ebg [_dfd ]);_dbf ++;}else {break _ddea ;};case FmtTypeLiteral :_gffa =append (_gffa ,_dcd .Literal );default:_eegg .Log ("\u0075\u006e\u0073\u0075\u0070\u0070o\u0072\u0074\u0065\u0064\u0020\u0074\u0079\u0070\u0065\u0020\u0069\u006e\u0020f\u0072\u0061\u0063\u0074\u0069\u006f\u006ea\u006c\u0020\u0025\u0076",_dcd );};};return _gffa ;};func _cdbf (_cbd []byte )[]byte {for _cded :=len (_cbd )-1;_cded > 0;_cded --{if _cbd [_cded ]=='9'+1{_cbd [_cded ]='0';if _cbd [_cded -1]=='.'{_cded --;};_cbd [_cded -1]++;};};if _cbd [0]=='9'+1{_cbd [0]='0';copy (_cbd [1:],_cbd [0:]);_cbd [0]='1';};return _cbd ;};
|
|
|
|
// Token is a format token in the Excel format string.
|
|
type Token struct{Type FmtType ;Literal byte ;DateTime string ;};
|
|
|
|
// Value formats a value as a number or string depending on if it appears to be
|
|
// a number or string.
|
|
func Value (v string ,f string )string {if IsNumber (v ){_ffcb ,_ :=_gff .ParseFloat (v ,64);return Number (_ffcb ,f );};return String (v ,f );};const _bgc int =-1;func _ef (_gdb ,_gbbf float64 ,_cdb Format )[]byte {if len (_cdb .Whole )==0{return nil ;};_cfd :=_fg .Date (1899,12,30,0,0,0,0,_fg .UTC );_fdb :=_cfd .Add (_fg .Duration (_gbbf *float64 (24*_fg .Hour )));_fdb =_bbg (_fdb );_fage :=_gff .AppendFloat (nil ,_gdb ,'f',-1,64);_adc :=make ([]byte ,0,len (_fage ));_gcfe :=0;_gg :=1;_fded :for _cee :=len (_cdb .Whole )-1;_cee >=0;_cee --{_cfa :=len (_fage )-1-_gcfe ;_aaf :=_cdb .Whole [_cee ];switch _aaf .Type {case FmtTypeDigit :if _cfa >=0{_adc =append (_adc ,_fage [_cfa ]);_gcfe ++;_gg =_cee ;}else {_adc =append (_adc ,'0');};case FmtTypeDigitOpt :if _cfa >=0{_adc =append (_adc ,_fage [_cfa ]);_gcfe ++;_gg =_cee ;}else {for _egc :=_cee ;_egc >=0;_egc --{_egbd :=_cdb .Whole [_egc ];if _egbd .Type ==FmtTypeLiteral {_adc =append (_adc ,_egbd .Literal );};};break _fded ;};case FmtTypeDollar :for _bfde :=_gcfe ;_bfde < len (_fage );_bfde ++{_adc =append (_adc ,_fage [len (_fage )-1-_bfde ]);_gcfe ++;};_adc =append (_adc ,'$');case FmtTypeComma :if !_cdb ._gac {_adc =append (_adc ,',');};case FmtTypeLiteral :_adc =append (_adc ,_aaf .Literal );case FmtTypeDate :_adc =append (_adc ,_aafb (_aacg (_fdb ,_aaf .DateTime ))...);case FmtTypeTime :_adc =append (_adc ,_aafb (_aea (_fdb ,_gbbf ,_aaf .DateTime ))...);default:_eegg .Log ("\u0075\u006e\u0073\u0075p\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0074\u0079\u0070e\u0020i\u006e\u0020\u0077\u0068\u006f\u006c\u0065 \u0025\u0076",_aaf );};};_gcad :=_aafb (_adc );if _gcfe < len (_fage )&&(_gcfe !=0||_cdb ._cbc ){_ede :=len (_fage )-_gcfe ;_bgg :=make ([]byte ,len (_gcad )+_ede );copy (_bgg ,_gcad [0:_gg ]);copy (_bgg [_gg :],_fage [0:]);copy (_bgg [_gg +_ede :],_gcad [_gg :]);_gcad =_bgg ;};if _cdb ._gac {_gae :=_dfb .Buffer {};_afe :=0;for _ge :=len (_gcad )-1;_ge >=0;_ge --{if !(_gcad [_ge ]>='0'&&_gcad [_ge ]<='9'){_afe ++;}else {break ;};};for _dfcb :=0;_dfcb < len (_gcad );_dfcb ++{_beae :=(len (_gcad )-_dfcb -_afe );if _beae %3==0&&_beae !=0&&_dfcb !=0{_gae .WriteByte (',');};_gae .WriteByte (_gcad [_dfcb ]);};_gcad =_gae .Bytes ();};return _gcad ;};const _bdg ="\u0046\u006d\u0074\u0054\u0079\u0070\u0065\u004c\u0069\u0074\u0065\u0072a\u006c\u0046\u006d\u0074\u0054\u0079\u0070\u0065\u0044\u0069\u0067\u0069\u0074\u0046\u006d\u0074\u0054y\u0070\u0065\u0044i\u0067\u0069\u0074\u004f\u0070\u0074\u0046\u006d\u0074\u0054\u0079\u0070\u0065\u0043o\u006d\u006d\u0061\u0046\u006d\u0074\u0054\u0079\u0070\u0065\u0044\u0065\u0063\u0069\u006da\u006c\u0046\u006d\u0074\u0054\u0079\u0070\u0065Pe\u0072\u0063e\u006e\u0074\u0046\u006d\u0074\u0054\u0079\u0070e\u0044\u006f\u006c\u006c\u0061\u0072\u0046\u006d\u0074Ty\u0070\u0065\u0044i\u0067\u0069\u0074\u004f\u0070\u0074\u0054\u0068\u006f\u0075\u0073\u0061n\u0064\u0073\u0046\u006d\u0074\u0054\u0079\u0070\u0065\u0055n\u0064\u0065\u0072\u0073c\u006f\u0072\u0065\u0046\u006d\u0074T\u0079\u0070\u0065\u0044\u0061\u0074\u0065\u0046\u006d\u0074\u0054y\u0070e\u0054\u0069\u006d\u0065\u0046\u006d\u0074\u0054\u0079\u0070\u0065\u0046\u0072\u0061\u0063t\u0069\u006f\u006e\u0046\u006dt\u0054\u0079\u0070\u0065\u0054e\u0078\u0074";func Parse (s string )[]Format {_acdg :=Lexer {};_acdg .Lex (_decb .NewReader (s ));_acdg ._cgf =append (_acdg ._cgf ,_acdg ._gag );return _acdg ._cgf ;};var _baf =[...]uint8 {0,14,26,41,53,67,81,94,118,135,146,157,172,183};
|
|
|
|
// NumberGeneric formats the number with the generic format which attemps to
|
|
// mimic Excel's general formatting.
|
|
func NumberGeneric (v float64 )string {if _daae .Abs (v )>=_abec ||_daae .Abs (v )<=_aggf &&v !=0{return _egb (v );};_ccea :=make ([]byte ,0,15);_ccea =_gff .AppendFloat (_ccea ,v ,'f',-1,64);if len (_ccea )> 11{_bfa :=_ccea [11]-'0';if _bfa >=5&&_bfa <=9{_ccea [10]++;_ccea =_ccea [0:11];_ccea =_cdbf (_ccea );};_ccea =_ccea [0:11];}else if len (_ccea )==11{if _ccea [len (_ccea )-1]=='9'{_ccea [len (_ccea )-1]++;_ccea =_cdbf (_ccea );};};_ccea =_cegf (_ccea );return string (_ccea );};func _egb (_bbf float64 )string {_fcda :=_gff .FormatFloat (_bbf ,'E',-1,64);_cad :=_gff .FormatFloat (_bbf ,'E',5,64);if len (_fcda )< len (_cad ){return _gff .FormatFloat (_bbf ,'E',2,64);};return _cad ;};
|
|
|
|
// FmtType is the type of a format token.
|
|
//go:generate stringer -type=FmtType
|
|
type FmtType byte ;func _aafb (_gge []byte )[]byte {for _fbdf :=0;_fbdf < len (_gge )/2;_fbdf ++{_cacb :=len (_gge )-1-_fbdf ;_gge [_fbdf ],_gge [_cacb ]=_gge [_cacb ],_gge [_fbdf ];};return _gge ;};func _aacg (_dee _fg .Time ,_bcd string )[]byte {_af :=[]byte {};_gef :=0;for _acdb :=0;_acdb < len (_bcd );_acdb ++{var _fcff string ;if _bcd [_acdb ]=='/'{_fcff =string (_bcd [_gef :_acdb ]);_gef =_acdb +1;}else if _acdb ==len (_bcd )-1{_fcff =string (_bcd [_gef :_acdb +1]);}else {continue ;};switch _fcff {case "\u0079\u0079":_af =_dee .AppendFormat (_af ,"\u0030\u0036");case "\u0079\u0079\u0079\u0079":_af =_dee .AppendFormat (_af ,"\u0032\u0030\u0030\u0036");case "\u006d":_af =_dee .AppendFormat (_af ,"\u0031");case "\u006d\u006d":_af =_dee .AppendFormat (_af ,"\u0030\u0031");case "\u006d\u006d\u006d":_af =_dee .AppendFormat (_af ,"\u004a\u0061\u006e");case "\u006d\u006d\u006d\u006d":_af =_dee .AppendFormat (_af ,"\u004aa\u006e\u0075\u0061\u0072\u0079");case "\u006d\u006d\u006dm\u006d":switch _dee .Month (){case _fg .January ,_fg .July ,_fg .June :_af =append (_af ,'J');case _fg .February :_af =append (_af ,'M');case _fg .March ,_fg .May :_af =append (_af ,'M');case _fg .April ,_fg .August :_af =append (_af ,'A');case _fg .September :_af =append (_af ,'S');case _fg .October :_af =append (_af ,'O');case _fg .November :_af =append (_af ,'N');case _fg .December :_af =append (_af ,'D');};case "\u0064":_af =_dee .AppendFormat (_af ,"\u0032");case "\u0064\u0064":_af =_dee .AppendFormat (_af ,"\u0030\u0032");case "\u0064\u0064\u0064":_af =_dee .AppendFormat (_af ,"\u004d\u006f\u006e");case "\u0064\u0064\u0064\u0064":_af =_dee .AppendFormat (_af ,"\u004d\u006f\u006e\u0064\u0061\u0079");default:_eegg .Log ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0064\u0061\u0074\u0065\u0020\u0066\u006f\u0072\u006d\u0061t\u0020\u0025\u0073",_fcff );};if _bcd [_acdb ]=='/'{_af =append (_af ,'/');};};return _af ;};const _fbcb int =34;func (_faeb FmtType )String ()string {if _faeb >=FmtType (len (_baf )-1){return _fdef .Sprintf ("F\u006d\u0074\u0054\u0079\u0070\u0065\u0028\u0025\u0064\u0029",_faeb );};return _bdg [_baf [_faeb ]:_baf [_faeb +1]];};const _aac int =34;
|
|
|
|
// AddToken adds a format token to the format.
|
|
func (_gfg *Format )AddToken (t FmtType ,l []byte ){if _gfg ._gad {_gfg ._gad =false ;return ;};switch t {case FmtTypeDecimal :_gfg ._cbc =true ;case FmtTypeUnderscore :_gfg ._gad =true ;case FmtTypeText :_gfg .Whole =append (_gfg .Whole ,Token {Type :t });case FmtTypeDate ,FmtTypeTime :_gfg .Whole =append (_gfg .Whole ,Token {Type :t ,DateTime :string (l )});case FmtTypePercent :_gfg ._bafe =true ;t =FmtTypeLiteral ;l =[]byte {'%'};fallthrough;case FmtTypeDigitOpt :fallthrough;case FmtTypeLiteral ,FmtTypeDigit ,FmtTypeDollar ,FmtTypeComma :if l ==nil {l =[]byte {0};};for _ ,_dgd :=range l {if _gfg .IsExponential {_gfg .Exponent =append (_gfg .Exponent ,Token {Type :t ,Literal :_dgd });}else if !_gfg ._cbc {_gfg .Whole =append (_gfg .Whole ,Token {Type :t ,Literal :_dgd });}else {_gfg .Fractional =append (_gfg .Fractional ,Token {Type :t ,Literal :_dgd });};};case FmtTypeDigitOptThousands :_gfg ._gac =true ;case FmtTypeFraction :_cea :=_decb .Split (string (l ),"\u002f");if len (_cea )==2{_gfg ._ggd =true ;_gfg ._ebdg ,_ =_gff .ParseInt (_cea [1],10,64);for _ ,_age :=range _cea [1]{if _age =='?'||_age =='0'{_gfg ._fae ++;};};};default:_eegg .Log ("\u0075\u006e\u0073u\u0070\u0070\u006f\u0072t\u0065\u0064\u0020\u0070\u0068\u0020\u0074y\u0070\u0065\u0020\u0069\u006e\u0020\u0070\u0061\u0072\u0073\u0065\u0020\u0025\u0076",t );};};func _bbg (_fbdg _fg .Time )_fg .Time {_fbdg =_fbdg .UTC ();return _fg .Date (_fbdg .Year (),_fbdg .Month (),_fbdg .Day (),_fbdg .Hour (),_fbdg .Minute (),_fbdg .Second (),_fbdg .Nanosecond (),_fg .Local );};const _adb int =34;const _gfgd int =0;const (FmtTypeLiteral FmtType =iota ;FmtTypeDigit ;FmtTypeDigitOpt ;FmtTypeComma ;FmtTypeDecimal ;FmtTypePercent ;FmtTypeDollar ;FmtTypeDigitOptThousands ;FmtTypeUnderscore ;FmtTypeDate ;FmtTypeTime ;FmtTypeFraction ;FmtTypeText ;);func _aea (_agbb _fg .Time ,_gf float64 ,_bgcd string )[]byte {_cdg :=[]byte {};_beed :=0;for _feg :=0;_feg < len (_bgcd );_feg ++{var _ege string ;if _bgcd [_feg ]==':'{_ege =string (_bgcd [_beed :_feg ]);_beed =_feg +1;}else if _feg ==len (_bgcd )-1{_ege =string (_bgcd [_beed :_feg +1]);}else {continue ;};switch _ege {case "\u0064":_cdg =_agbb .AppendFormat (_cdg ,"\u0032");case "\u0068":_cdg =_agbb .AppendFormat (_cdg ,"\u0033");case "\u0068\u0068":_cdg =_agbb .AppendFormat (_cdg ,"\u0031\u0035");case "\u006d":_cdg =_agbb .AppendFormat (_cdg ,"\u0034");case "\u006d\u006d":_cdg =_agbb .AppendFormat (_cdg ,"\u0030\u0034");case "\u0073":_cdg =_agbb .Round (_fg .Second ).AppendFormat (_cdg ,"\u0035");case "\u0073\u002e\u0030":_cdg =_agbb .Round (_fg .Second /10).AppendFormat (_cdg ,"\u0035\u002e\u0030");case "\u0073\u002e\u0030\u0030":_cdg =_agbb .Round (_fg .Second /100).AppendFormat (_cdg ,"\u0035\u002e\u0030\u0030");case "\u0073\u002e\u00300\u0030":_cdg =_agbb .Round (_fg .Second /1000).AppendFormat (_cdg ,"\u0035\u002e\u00300\u0030");case "\u0073\u0073":_cdg =_agbb .Round (_fg .Second ).AppendFormat (_cdg ,"\u0030\u0035");case "\u0073\u0073\u002e\u0030":_cdg =_agbb .Round (_fg .Second /10).AppendFormat (_cdg ,"\u0030\u0035\u002e\u0030");case "\u0073\u0073\u002e0\u0030":_cdg =_agbb .Round (_fg .Second /100).AppendFormat (_cdg ,"\u0030\u0035\u002e0\u0030");case "\u0073\u0073\u002e\u0030\u0030\u0030":_cdg =_agbb .Round (_fg .Second /1000).AppendFormat (_cdg ,"\u0030\u0035\u002e\u0030\u0030\u0030");case "\u0041\u004d\u002fP\u004d":_cdg =_agbb .AppendFormat (_cdg ,"\u0050\u004d");case "\u005b\u0068\u005d":_cdg =_gff .AppendInt (_cdg ,int64 (_gf *24),10);case "\u005b\u006d\u005d":_cdg =_gff .AppendInt (_cdg ,int64 (_gf *24*60),10);case "\u005b\u0073\u005d":_cdg =_gff .AppendInt (_cdg ,int64 (_gf *24*60*60),10);case "":default:_eegg .Log ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0074\u0069\u006d\u0065\u0020\u0066\u006f\u0072\u006d\u0061t\u0020\u0025\u0073",_ege );};if _bgcd [_feg ]==':'{_cdg =append (_cdg ,':');};};return _cdg ;};const _agg int =0;const _bg int =0;func IsNumber (data string )(_cge bool ){_adec ,_fdc ,_ffg :=0,0,len (data );_dbg :=len (data );_dfe ,_df ,_abdeb :=0,0,0;_ =_df ;_ =_abdeb ;_ =_dfe ;{_adec =_agg ;_dfe =0;_df =0;_abdeb =0;};{if _fdc ==_ffg {goto _fgbf ;};switch _adec {case 0:goto _eaa ;case 1:goto _aeab ;case 2:goto _bcf ;case 3:goto _feca ;case 4:goto _bcb ;case 5:goto _effe ;case 6:goto _cgd ;case 7:goto _bfd ;};goto _cbf ;_ccd :_df =_fdc ;_fdc --;{_cge =false ;};goto _db ;_gdd :_df =_fdc ;_fdc --;{_cge =_df ==len (data );};goto _db ;_fa :_df =_fdc ;_fdc --;{_cge =_df ==len (data );};goto _db ;_afeg :switch _abdeb {case 2:{_fdc =(_df )-1;_cge =_df ==len (data );};case 3:{_fdc =(_df )-1;_cge =false ;};};goto _db ;_db :_dfe =0;if _fdc ++;_fdc ==_ffg {goto _bb ;};_eaa :_dfe =_fdc ;switch data [_fdc ]{case 43:goto _abc ;case 45:goto _abc ;};if 48<=data [_fdc ]&&data [_fdc ]<=57{goto _feea ;};goto _ddd ;_ddd :if _fdc ++;_fdc ==_ffg {goto _gfge ;};_aeab :goto _ddd ;_abc :if _fdc ++;_fdc ==_ffg {goto _gcc ;};_bcf :if 48<=data [_fdc ]&&data [_fdc ]<=57{goto _feea ;};goto _ddd ;_feea :if _fdc ++;_fdc ==_ffg {goto _dge ;};_feca :if data [_fdc ]==46{goto _fab ;};if 48<=data [_fdc ]&&data [_fdc ]<=57{goto _feea ;};goto _ddd ;_fab :if _fdc ++;_fdc ==_ffg {goto _cbgc ;};_bcb :if 48<=data [_fdc ]&&data [_fdc ]<=57{goto _fde ;};goto _ddd ;_fde :if _fdc ++;_fdc ==_ffg {goto _eb ;};_effe :if data [_fdc ]==69{goto _gbc ;};if 48<=data [_fdc ]&&data [_fdc ]<=57{goto _fde ;};goto _ddd ;_gbc :if _fdc ++;_fdc ==_ffg {goto _cfac ;};_cgd :switch data [_fdc ]{case 43:goto _adbc ;case 45:goto _adbc ;};goto _ddd ;_adbc :_df =_fdc +1;_abdeb =3;goto _bad ;_fbfa :_df =_fdc +1;_abdeb =2;goto _bad ;_bad :if _fdc ++;_fdc ==_ffg {goto _deg ;};_bfd :if 48<=data [_fdc ]&&data [_fdc ]<=57{goto _fbfa ;};goto _ddd ;_cbf :_bb :_adec =0;goto _fgbf ;_gfge :_adec =1;goto _fgbf ;_gcc :_adec =2;goto _fgbf ;_dge :_adec =3;goto _fgbf ;_cbgc :_adec =4;goto _fgbf ;_eb :_adec =5;goto _fgbf ;_cfac :_adec =6;goto _fgbf ;_deg :_adec =7;goto _fgbf ;_fgbf :{};if _fdc ==_dbg {switch _adec {case 1:goto _ccd ;case 2:goto _ccd ;case 3:goto _gdd ;case 4:goto _ccd ;case 5:goto _fa ;case 6:goto _ccd ;case 7:goto _afeg ;};};};if _adec ==_bgc {return false ;};return ;};func _fcfc (_d float64 ,_bag Format ,_bdb bool )string {if _bag ._dde {return NumberGeneric (_d );};_ccf :=make ([]byte ,0,20);_ade :=_daae .Signbit (_d );_gcd :=_daae .Abs (_d );_feeg :=int64 (0);_gfa :=int64 (0);if _bag .IsExponential {for _gcd >=10{_gfa ++;_gcd /=10;};for _gcd < 1{_gfa --;_gcd *=10;};}else if _bag ._bafe {_gcd *=100;}else if _bag ._ggd {if _bag ._ebdg ==0{_cfc :=_daae .Pow (10,float64 (_bag ._fae ));_aeea ,_adf :=1.0,1.0;_ =_aeea ;for _ada :=1.0;_ada < _cfc ;_ada ++{_ ,_dga :=_daae .Modf (_gcd *float64 (_ada ));if _dga < _adf {_adf =_dga ;_aeea =_ada ;if _dga ==0{break ;};};};_bag ._ebdg =int64 (_aeea );};_feeg =int64 (_gcd *float64 (_bag ._ebdg )+0.5);if len (_bag .Whole )> 0&&_feeg > _bag ._ebdg {_feeg =int64 (_gcd *float64 (_bag ._ebdg ))%_bag ._ebdg ;_gcd -=float64 (_feeg )/float64 (_bag ._ebdg );}else {_gcd -=float64 (_feeg )/float64 (_bag ._ebdg );if _daae .Abs (_gcd )< 1{_fabb :=true ;for _ ,_acc :=range _bag .Whole {if _acc .Type ==FmtTypeDigitOpt {continue ;};if _acc .Type ==FmtTypeLiteral &&_acc .Literal ==' '{continue ;};_fabb =false ;};if _fabb {_bag .Whole =nil ;};};};};_bge :=1;for _ ,_eff :=range _bag .Fractional {if _eff .Type ==FmtTypeDigit ||_eff .Type ==FmtTypeDigitOpt {_bge ++;};};_gcd +=5*_daae .Pow10 (-_bge );_dabf ,_ce :=_daae .Modf (_gcd );_ccf =append (_ccf ,_ef (_dabf ,_d ,_bag )...);_ccf =append (_ccf ,_fda (_ce ,_d ,_bag )...);_ccf =append (_ccf ,_gbd (_gfa ,_bag )...);if _bag ._ggd {_ccf =_gff .AppendInt (_ccf ,_feeg ,10);_ccf =append (_ccf ,'/');_ccf =_gff .AppendInt (_ccf ,_bag ._ebdg ,10);};if !_bdb &&_ade {return "\u002d"+string (_ccf );};return string (_ccf );};func (_agbd *Lexer )nextFmt (){_agbd ._cgf =append (_agbd ._cgf ,_agbd ._gag );_agbd ._gag =Format {}};const _abec =1e11;func (_fbbe *Lexer )Lex (r _bbfb .Reader ){_daa ,_eeb ,_f :=0,0,0;_cafc :=-1;_cag ,_fgbc ,_agb :=0,0,0;_ =_fgbc ;_ =_agb ;_fcf :=1;_ =_fcf ;_fdaa :=make ([]byte ,4096);_aab :=false ;for !_aab {_ca :=0;if _cag > 0{_ca =_eeb -_cag ;};_eeb =0;_cce ,_beaf :=r .Read (_fdaa [_ca :]);if _cce ==0||_beaf !=nil {_aab =true ;};_f =_cce +_ca ;if _f < len (_fdaa ){_cafc =_f ;};{_daa =_aac ;_cag =0;_fgbc =0;_agb =0;};{if _eeb ==_f {goto _gbf ;};switch _daa {case 34:goto _acd ;case 35:goto _gbe ;case 0:goto _dda ;case 36:goto _gcb ;case 37:goto _fge ;case 1:goto _ded ;case 2:goto _ac ;case 38:goto _gec ;case 3:goto _eeg ;case 4:goto _ddf ;case 39:goto _geg ;case 5:goto _efg ;case 6:goto _gbed ;case 7:goto _gbb ;case 8:goto _gcbg ;case 40:goto _efac ;case 9:goto _fed ;case 41:goto _cbcf ;case 10:goto _bdbc ;case 42:goto _cegg ;case 11:goto _de ;case 43:goto _abb ;case 44:goto _ffce ;case 45:goto _dc ;case 12:goto _efff ;case 46:goto _cdbg ;case 13:goto _bgb ;case 14:goto _aeaf ;case 15:goto _dae ;case 16:goto _ebde ;case 47:goto _egd ;case 17:goto _cb ;case 48:goto _dag ;case 18:goto _gged ;case 19:goto _fbg ;case 20:goto _ga ;case 49:goto _fe ;case 50:goto _gba ;case 21:goto _da ;case 22:goto _acgf ;case 23:goto _c ;case 24:goto _faac ;case 25:goto _gb ;case 51:goto _bdbe ;case 26:goto _fdge ;case 52:goto _cbff ;case 53:goto _badf ;case 54:goto _afa ;case 55:goto _fcdf ;case 56:goto _dfc ;case 57:goto _cfg ;case 27:goto _aace ;case 28:goto _ffca ;case 29:goto _cac ;case 30:goto _afb ;case 31:goto _dfbg ;case 58:goto _be ;case 32:goto _aee ;case 59:goto _bdfc ;case 33:goto _ceg ;case 60:goto _adbf ;case 61:goto _geffc ;case 62:goto _gded ;};goto _fecb ;_gde :switch _agb {case 2:{_eeb =(_fgbc )-1;_fbbe ._gag .AddToken (FmtTypeDigit ,nil );};case 3:{_eeb =(_fgbc )-1;_fbbe ._gag .AddToken (FmtTypeDigitOpt ,nil );};case 5:{_eeb =(_fgbc )-1;};case 8:{_eeb =(_fgbc )-1;_fbbe ._gag .AddToken (FmtTypePercent ,nil );};case 13:{_eeb =(_fgbc )-1;_fbbe ._gag .AddToken (FmtTypeFraction ,_fdaa [_cag :_fgbc ]);};case 14:{_eeb =(_fgbc )-1;_fbbe ._gag .AddToken (FmtTypeDate ,_fdaa [_cag :_fgbc ]);};case 15:{_eeb =(_fgbc )-1;_fbbe ._gag .AddToken (FmtTypeTime ,_fdaa [_cag :_fgbc ]);};case 16:{_eeb =(_fgbc )-1;_fbbe ._gag .AddToken (FmtTypeTime ,_fdaa [_cag :_fgbc ]);};case 18:{_eeb =(_fgbc )-1;};case 20:{_eeb =(_fgbc )-1;_fbbe ._gag .AddToken (FmtTypeLiteral ,_fdaa [_cag :_fgbc ]);};case 21:{_eeb =(_fgbc )-1;_fbbe ._gag .AddToken (FmtTypeLiteral ,_fdaa [_cag +1:_fgbc -1]);};};goto _acb ;_gc :_eeb =(_fgbc )-1;{_fbbe ._gag .AddToken (FmtTypeFraction ,_fdaa [_cag :_fgbc ]);};goto _acb ;_ece :_eeb =(_fgbc )-1;{_fbbe ._gag .AddToken (FmtTypeDigitOpt ,nil );};goto _acb ;_bce :_fgbc =_eeb +1;{_fbbe ._gag .AddToken (FmtTypeDigitOptThousands ,nil );};goto _acb ;_gadc :_eeb =(_fgbc )-1;{_fbbe ._gag .AddToken (FmtTypePercent ,nil );};goto _acb ;_bffa :_eeb =(_fgbc )-1;{_fbbe ._gag .AddToken (FmtTypeDate ,_fdaa [_cag :_fgbc ]);};goto _acb ;_feeb :_eeb =(_fgbc )-1;{_fbbe ._gag .AddToken (FmtTypeDigit ,nil );};goto _acb ;_bbfa :_eeb =(_fgbc )-1;{_fbbe ._gag .AddToken (FmtTypeTime ,_fdaa [_cag :_fgbc ]);};goto _acb ;_e :_eeb =(_fgbc )-1;{_fbbe ._gag .AddToken (FmtTypeLiteral ,_fdaa [_cag :_fgbc ]);};goto _acb ;_dbbe :_fgbc =_eeb +1;{_fbbe ._gag ._dde =true ;};goto _acb ;_bdba :_fgbc =_eeb +1;{_fbbe ._gag .AddToken (FmtTypeLiteral ,_fdaa [_cag :_fgbc ]);};goto _acb ;_ccdfg :_fgbc =_eeb +1;{_fbbe ._gag .AddToken (FmtTypeDollar ,nil );};goto _acb ;_dgf :_fgbc =_eeb +1;{_fbbe ._gag .AddToken (FmtTypeComma ,nil );};goto _acb ;_fcde :_fgbc =_eeb +1;{_fbbe ._gag .AddToken (FmtTypeDecimal ,nil );};goto _acb ;_cef :_fgbc =_eeb +1;{_fbbe .nextFmt ();};goto _acb ;_fgd :_fgbc =_eeb +1;{_fbbe ._gag .AddToken (FmtTypeText ,nil );};goto _acb ;_cbg :_fgbc =_eeb +1;{_fbbe ._gag .AddToken (FmtTypeUnderscore ,nil );};goto _acb ;_fgc :_fgbc =_eeb ;_eeb --;{_fbbe ._gag .AddToken (FmtTypeLiteral ,_fdaa [_cag :_fgbc ]);};goto _acb ;_aada :_fgbc =_eeb ;_eeb --;{_fbbe ._gag .AddToken (FmtTypeLiteral ,_fdaa [_cag +1:_fgbc -1]);};goto _acb ;_ddc :_fgbc =_eeb ;_eeb --;{_fbbe ._gag .AddToken (FmtTypeDigitOpt ,nil );};goto _acb ;_gee :_fgbc =_eeb ;_eeb --;{_fbbe ._gag .AddToken (FmtTypeFraction ,_fdaa [_cag :_fgbc ]);};goto _acb ;_gfgf :_fgbc =_eeb ;_eeb --;{_fbbe ._gag .AddToken (FmtTypePercent ,nil );};goto _acb ;_efd :_fgbc =_eeb ;_eeb --;{_fbbe ._gag .AddToken (FmtTypeDate ,_fdaa [_cag :_fgbc ]);};goto _acb ;_ee :_fgbc =_eeb ;_eeb --;{_fbbe ._gag .AddToken (FmtTypeDigit ,nil );};goto _acb ;_ab :_fgbc =_eeb ;_eeb --;{_fbbe ._gag .AddToken (FmtTypeTime ,_fdaa [_cag :_fgbc ]);};goto _acb ;_gfaa :_fgbc =_eeb ;_eeb --;{};goto _acb ;_face :_fgbc =_eeb +1;{_fbbe ._gag .IsExponential =true ;};goto _acb ;_aed :_fgbc =_eeb +1;{_fbbe ._gag .AddToken (FmtTypeLiteral ,_fdaa [_cag +1:_fgbc ]);};goto _acb ;_acb :_cag =0;if _eeb ++;_eeb ==_f {goto _cgc ;};_acd :_cag =_eeb ;switch _fdaa [_eeb ]{case 34:goto _bgf ;case 35:goto _agbf ;case 36:goto _ccdfg ;case 37:goto _fad ;case 44:goto _dgf ;case 46:goto _fcde ;case 47:goto _fcdc ;case 48:goto _dg ;case 58:goto _dcb ;case 59:goto _cef ;case 63:goto _dff ;case 64:goto _fgd ;case 65:goto _fbga ;case 69:goto _cga ;case 71:goto _dgfc ;case 91:goto _aacf ;case 92:goto _ffc ;case 95:goto _cbg ;case 100:goto _fcdc ;case 104:goto _dcb ;case 109:goto _bed ;case 115:goto _ffa ;case 121:goto _dab ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _aagd ;};goto _bdba ;_bgf :_fgbc =_eeb +1;_agb =20;goto _eac ;_eac :if _eeb ++;_eeb ==_f {goto _dbbf ;};_gbe :if _fdaa [_eeb ]==34{goto _effa ;};goto _bec ;_bec :if _eeb ++;_eeb ==_f {goto _cdf ;};_dda :if _fdaa [_eeb ]==34{goto _effa ;};goto _bec ;_effa :_fgbc =_eeb +1;_agb =21;goto _gaaa ;_gaaa :if _eeb ++;_eeb ==_f {goto _aae ;};_gcb :if _fdaa [_eeb ]==34{goto _bec ;};goto _aada ;_agbf :_fgbc =_eeb +1;_agb =3;goto _adbb ;_adbb :if _eeb ++;_eeb ==_f {goto _deda ;};_fge :switch _fdaa [_eeb ]{case 35:goto _fabd ;case 37:goto _fabd ;case 44:goto _egg ;case 47:goto _aabc ;case 48:goto _fabd ;case 63:goto _fabd ;};goto _ddc ;_fabd :if _eeb ++;_eeb ==_f {goto _cba ;};_ded :switch _fdaa [_eeb ]{case 35:goto _fabd ;case 37:goto _fabd ;case 47:goto _aabc ;case 48:goto _fabd ;case 63:goto _fabd ;};goto _gde ;_aabc :if _eeb ++;_eeb ==_f {goto _fbd ;};_ac :switch _fdaa [_eeb ]{case 35:goto _ccg ;case 37:goto _gdac ;case 48:goto _bbc ;case 63:goto _ccg ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _baaf ;};goto _gde ;_ccg :_fgbc =_eeb +1;goto _ba ;_ba :if _eeb ++;_eeb ==_f {goto _fgb ;};_gec :switch _fdaa [_eeb ]{case 35:goto _ccg ;case 37:goto _ccg ;case 44:goto _ccg ;case 46:goto _ccg ;case 48:goto _ccg ;case 63:goto _ccg ;case 65:goto _abg ;};goto _gee ;_abg :if _eeb ++;_eeb ==_f {goto _cbe ;};_eeg :switch _fdaa [_eeb ]{case 47:goto _fcc ;case 77:goto _dedb ;};goto _gc ;_fcc :if _eeb ++;_eeb ==_f {goto _gddg ;};_ddf :if _fdaa [_eeb ]==80{goto _acf ;};goto _gc ;_acf :_fgbc =_eeb +1;goto _faa ;_faa :if _eeb ++;_eeb ==_f {goto _dcf ;};_geg :if _fdaa [_eeb ]==65{goto _abg ;};goto _gee ;_dedb :if _eeb ++;_eeb ==_f {goto _dfa ;};_efg :if _fdaa [_eeb ]==47{goto _ced ;};goto _gc ;_ced :if _eeb ++;_eeb ==_f {goto _cdd ;};_gbed :if _fdaa [_eeb ]==80{goto _a ;};goto _gc ;_a :if _eeb ++;_eeb ==_f {goto _dec ;};_gbb :if _fdaa [_eeb ]==77{goto _acf ;};goto _gc ;_gdac :if _eeb ++;_eeb ==_f {goto _abde ;};_gcbg :switch _fdaa [_eeb ]{case 35:goto _faea ;case 37:goto _adg ;case 63:goto _faea ;};if 48<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _bc ;};goto _gde ;_faea :_fgbc =_eeb +1;goto _accd ;_accd :if _eeb ++;_eeb ==_f {goto _fac ;};_efac :switch _fdaa [_eeb ]{case 35:goto _ccg ;case 37:goto _gcdd ;case 44:goto _ccg ;case 46:goto _ccg ;case 48:goto _ccg ;case 63:goto _ccg ;case 65:goto _abg ;};goto _gee ;_gcdd :if _eeb ++;_eeb ==_f {goto _fc ;};_fed :switch _fdaa [_eeb ]{case 35:goto _caf ;case 44:goto _caf ;case 46:goto _caf ;case 48:goto _caf ;case 63:goto _caf ;};goto _gc ;_caf :_fgbc =_eeb +1;goto _bee ;_bee :if _eeb ++;_eeb ==_f {goto _dbb ;};_cbcf :switch _fdaa [_eeb ]{case 35:goto _caf ;case 44:goto _caf ;case 46:goto _caf ;case 48:goto _caf ;case 63:goto _caf ;case 65:goto _abg ;};goto _gee ;_adg :if _eeb ++;_eeb ==_f {goto _aad ;};_bdbc :if _fdaa [_eeb ]==37{goto _adg ;};if 48<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _bc ;};goto _gde ;_bc :_fgbc =_eeb +1;_agb =13;goto _ffac ;_ffac :if _eeb ++;_eeb ==_f {goto _fag ;};_cegg :switch _fdaa [_eeb ]{case 35:goto _ccg ;case 37:goto _fd ;case 44:goto _ccg ;case 46:goto _ccg ;case 48:goto _fede ;case 63:goto _ccg ;case 65:goto _abg ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _bc ;};goto _gee ;_fd :if _eeb ++;_eeb ==_f {goto _ebe ;};_de :switch _fdaa [_eeb ]{case 35:goto _caf ;case 37:goto _adg ;case 44:goto _caf ;case 46:goto _caf ;case 63:goto _caf ;};if 48<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _bc ;};goto _gc ;_fede :_fgbc =_eeb +1;goto _ecf ;_ecf :if _eeb ++;_eeb ==_f {goto _cff ;};_abb :switch _fdaa [_eeb ]{case 35:goto _ccg ;case 37:goto _fede ;case 44:goto _ccg ;case 46:goto _ccg ;case 48:goto _fede ;case 63:goto _ccg ;case 65:goto _abg ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _bc ;};goto _gee ;_bbc :_fgbc =_eeb +1;goto _dfg ;_dfg :if _eeb ++;_eeb ==_f {goto _ccb ;};_ffce :switch _fdaa [_eeb ]{case 35:goto _ccg ;case 37:goto _fede ;case 44:goto _ccg ;case 46:goto _ccg ;case 48:goto _bbc ;case 63:goto _ccg ;case 65:goto _abg ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _baaf ;};goto _gee ;_baaf :_fgbc =_eeb +1;goto _ccdf ;_ccdf :if _eeb ++;_eeb ==_f {goto _fbb ;};_dc :switch _fdaa [_eeb ]{case 35:goto _ccg ;case 37:goto _bc ;case 44:goto _ccg ;case 46:goto _ccg ;case 48:goto _bbc ;case 63:goto _ccg ;case 65:goto _abg ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _baaf ;};goto _gee ;_egg :if _eeb ++;_eeb ==_f {goto _fb ;};_efff :if _fdaa [_eeb ]==35{goto _bce ;};goto _ece ;_fad :_fgbc =_eeb +1;_agb =8;goto _ace ;_ace :if _eeb ++;_eeb ==_f {goto _dcag ;};_cdbg :switch _fdaa [_eeb ]{case 35:goto _ag ;case 37:goto _fdeg ;case 48:goto _agd ;case 63:goto _ag ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _ae ;};goto _gfgf ;_ag :if _eeb ++;_eeb ==_f {goto _fee ;};_bgb :switch _fdaa [_eeb ]{case 35:goto _ag ;case 47:goto _aabc ;case 48:goto _ag ;case 63:goto _ag ;};goto _gadc ;_fdeg :if _eeb ++;_eeb ==_f {goto _cc ;};_aeaf :if _fdaa [_eeb ]==37{goto _fdeg ;};if 48<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _ae ;};goto _gde ;_ae :if _eeb ++;_eeb ==_f {goto _cd ;};_dae :switch _fdaa [_eeb ]{case 37:goto _fdeg ;case 47:goto _aabc ;};if 48<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _ae ;};goto _gde ;_agd :if _eeb ++;_eeb ==_f {goto _beec ;};_ebde :switch _fdaa [_eeb ]{case 35:goto _ag ;case 37:goto _fdeg ;case 47:goto _aabc ;case 48:goto _agd ;case 63:goto _ag ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _ae ;};goto _gadc ;_fcdc :_fgbc =_eeb +1;goto _fgcd ;_fgcd :if _eeb ++;_eeb ==_f {goto _gfc ;};_egd :switch _fdaa [_eeb ]{case 47:goto _fcdc ;case 100:goto _fcdc ;case 109:goto _fcdc ;case 121:goto _gcf ;};goto _efd ;_gcf :if _eeb ++;_eeb ==_f {goto _ega ;};_cb :if _fdaa [_eeb ]==121{goto _fcdc ;};goto _bffa ;_dg :_fgbc =_eeb +1;_agb =2;goto _abd ;_abd :if _eeb ++;_eeb ==_f {goto _cbac ;};_dag :switch _fdaa [_eeb ]{case 35:goto _fabd ;case 37:goto _eda ;case 47:goto _aabc ;case 48:goto _fecc ;case 63:goto _fabd ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _ea ;};goto _ee ;_eda :if _eeb ++;_eeb ==_f {goto _agbe ;};_gged :switch _fdaa [_eeb ]{case 35:goto _fabd ;case 37:goto _eda ;case 47:goto _aabc ;case 48:goto _eda ;case 63:goto _fabd ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _ae ;};goto _feeb ;_fecc :if _eeb ++;_eeb ==_f {goto _gecf ;};_fbg :switch _fdaa [_eeb ]{case 35:goto _fabd ;case 37:goto _eda ;case 47:goto _aabc ;case 48:goto _fecc ;case 63:goto _fabd ;};if 49<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _ea ;};goto _feeb ;_ea :if _eeb ++;_eeb ==_f {goto _bcbf ;};_ga :switch _fdaa [_eeb ]{case 37:goto _ae ;case 47:goto _aabc ;};if 48<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _ea ;};goto _gde ;_aagd :_fgbc =_eeb +1;_agb =20;goto _fga ;_fga :if _eeb ++;_eeb ==_f {goto _gcbf ;};_fe :switch _fdaa [_eeb ]{case 37:goto _ae ;case 47:goto _aabc ;};if 48<=_fdaa [_eeb ]&&_fdaa [_eeb ]<=57{goto _ea ;};goto _fgc ;_dcb :_fgbc =_eeb +1;_agb =15;goto _gbda ;_gbda :if _eeb ++;_eeb ==_f {goto _cbgf ;};_gba :switch _fdaa [_eeb ]{case 58:goto _dcb ;case 65:goto _bdbg ;case 104:goto _dcb ;case 109:goto _dcb ;case 115:goto _ffa ;};goto _ab ;_bdbg :if _eeb ++;_eeb ==_f {goto _beaeb ;};_da :switch _fdaa [_eeb ]{case 47:goto _dd ;case 77:goto _gaf ;};goto _gde ;_dd :if _eeb ++;_eeb ==_f {goto _adag ;};_acgf :if _fdaa [_eeb ]==80{goto _dcb ;};goto _gde ;_gaf :if _eeb ++;_eeb ==_f {goto _bfe ;};_c :if _fdaa [_eeb ]==47{goto _edf ;};goto _gde ;_edf :if _eeb ++;_eeb ==_f {goto _gea ;};_faac :if _fdaa [_eeb ]==80{goto _bd ;};goto _gde ;_bd :if _eeb ++;_eeb ==_f {goto _ff ;};_gb :if _fdaa [_eeb ]==77{goto _dcb ;};goto _gde ;_ffa :_fgbc =_eeb +1;_agb =15;goto _bga ;_bga :if _eeb ++;_eeb ==_f {goto _efad ;};_bdbe :switch _fdaa [_eeb ]{case 46:goto _egf ;case 58:goto _dcb ;case 65:goto _bdbg ;case 104:goto _dcb ;case 109:goto _dcb ;case 115:goto _ffa ;};goto _ab ;_egf :if _eeb ++;_eeb ==_f {goto _cgg ;};_fdge :if _fdaa [_eeb ]==48{goto _aag ;};goto _bbfa ;_aag :_fgbc =_eeb +1;_agb =15;goto _dbd ;_dbd :if _eeb ++;_eeb ==_f {goto _bef ;};_cbff :switch _fdaa [_eeb ]{case 48:goto _eaf ;case 58:goto _dcb ;case 65:goto _bdbg ;case 104:goto _dcb ;case 109:goto _dcb ;case 115:goto _ffa ;};goto _ab ;_eaf :_fgbc =_eeb +1;_agb =15;goto _bdga ;_bdga :if _eeb ++;_eeb ==_f {goto _ad ;};_badf :switch _fdaa [_eeb ]{case 48:goto _dcb ;case 58:goto _dcb ;case 65:goto _bdbg ;case 104:goto _dcb ;case 109:goto _dcb ;case 115:goto _ffa ;};goto _ab ;_dff :_fgbc =_eeb +1;_agb =5;goto _gga ;_gga :if _eeb ++;_eeb ==_f {goto _b ;};_afa :switch _fdaa [_eeb ]{case 35:goto _fabd ;case 37:goto _fabd ;case 47:goto _aabc ;case 48:goto _fabd ;case 63:goto _fabd ;};goto _gfaa ;_fbga :_fgbc =_eeb +1;_agb =20;goto _dac ;_dac :if _eeb ++;_eeb ==_f {goto _fdg ;};_fcdf :switch _fdaa [_eeb ]{case 47:goto _dd ;case 77:goto _gaf ;};goto _fgc ;_cga :if _eeb ++;_eeb ==_f {goto _eacb ;};_dfc :switch _fdaa [_eeb ]{case 43:goto _face ;case 45:goto _face ;};goto _fgc ;_dgfc :_fgbc =_eeb +1;goto _aa ;_aa :if _eeb ++;_eeb ==_f {goto _bfb ;};_cfg :if _fdaa [_eeb ]==101{goto _fec ;};goto _fgc ;_fec :if _eeb ++;_eeb ==_f {goto _fbdd ;};_aace :if _fdaa [_eeb ]==110{goto _dgac ;};goto _e ;_dgac :if _eeb ++;_eeb ==_f {goto _bff ;};_ffca :if _fdaa [_eeb ]==101{goto _geff ;};goto _e ;_geff :if _eeb ++;_eeb ==_f {goto _bda ;};_cac :if _fdaa [_eeb ]==114{goto _gagd ;};goto _e ;_gagd :if _eeb ++;_eeb ==_f {goto _cfdf ;};_afb :if _fdaa [_eeb ]==97{goto _acg ;};goto _e ;_acg :if _eeb ++;_eeb ==_f {goto _caa ;};_dfbg :if _fdaa [_eeb ]==108{goto _dbbe ;};goto _e ;_aacf :_fgbc =_eeb +1;_agb =20;goto _ccab ;_ccab :if _eeb ++;_eeb ==_f {goto _bba ;};_be :switch _fdaa [_eeb ]{case 104:goto _ggee ;case 109:goto _ggee ;case 115:goto _ggee ;};goto _beba ;_beba :if _eeb ++;_eeb ==_f {goto _fbc ;};_aee :if _fdaa [_eeb ]==93{goto _fff ;};goto _beba ;_fff :_fgbc =_eeb +1;_agb =18;goto _gfb ;_ebgg :_fgbc =_eeb +1;_agb =16;goto _gfb ;_gfb :if _eeb ++;_eeb ==_f {goto _dca ;};_bdfc :if _fdaa [_eeb ]==93{goto _fff ;};goto _beba ;_ggee :if _eeb ++;_eeb ==_f {goto _baa ;};_ceg :if _fdaa [_eeb ]==93{goto _ebgg ;};goto _beba ;_ffc :if _eeb ++;_eeb ==_f {goto _fdee ;};_adbf :goto _aed ;_bed :_fgbc =_eeb +1;_agb =14;goto _aca ;_aca :if _eeb ++;_eeb ==_f {goto _cdc ;};_geffc :switch _fdaa [_eeb ]{case 47:goto _fcdc ;case 58:goto _dcb ;case 65:goto _bdbg ;case 100:goto _fcdc ;case 104:goto _dcb ;case 109:goto _bed ;case 115:goto _ffa ;case 121:goto _gcf ;};goto _efd ;_dab :if _eeb ++;_eeb ==_f {goto _add ;};_gded :if _fdaa [_eeb ]==121{goto _fcdc ;};goto _fgc ;_fecb :_cgc :_daa =34;goto _gbf ;_dbbf :_daa =35;goto _gbf ;_cdf :_daa =0;goto _gbf ;_aae :_daa =36;goto _gbf ;_deda :_daa =37;goto _gbf ;_cba :_daa =1;goto _gbf ;_fbd :_daa =2;goto _gbf ;_fgb :_daa =38;goto _gbf ;_cbe :_daa =3;goto _gbf ;_gddg :_daa =4;goto _gbf ;_dcf :_daa =39;goto _gbf ;_dfa :_daa =5;goto _gbf ;_cdd :_daa =6;goto _gbf ;_dec :_daa =7;goto _gbf ;_abde :_daa =8;goto _gbf ;_fac :_daa =40;goto _gbf ;_fc :_daa =9;goto _gbf ;_dbb :_daa =41;goto _gbf ;_aad :_daa =10;goto _gbf ;_fag :_daa =42;goto _gbf ;_ebe :_daa =11;goto _gbf ;_cff :_daa =43;goto _gbf ;_ccb :_daa =44;goto _gbf ;_fbb :_daa =45;goto _gbf ;_fb :_daa =12;goto _gbf ;_dcag :_daa =46;goto _gbf ;_fee :_daa =13;goto _gbf ;_cc :_daa =14;goto _gbf ;_cd :_daa =15;goto _gbf ;_beec :_daa =16;goto _gbf ;_gfc :_daa =47;goto _gbf ;_ega :_daa =17;goto _gbf ;_cbac :_daa =48;goto _gbf ;_agbe :_daa =18;goto _gbf ;_gecf :_daa =19;goto _gbf ;_bcbf :_daa =20;goto _gbf ;_gcbf :_daa =49;goto _gbf ;_cbgf :_daa =50;goto _gbf ;_beaeb :_daa =21;goto _gbf ;_adag :_daa =22;goto _gbf ;_bfe :_daa =23;goto _gbf ;_gea :_daa =24;goto _gbf ;_ff :_daa =25;goto _gbf ;_efad :_daa =51;goto _gbf ;_cgg :_daa =26;goto _gbf ;_bef :_daa =52;goto _gbf ;_ad :_daa =53;goto _gbf ;_b :_daa =54;goto _gbf ;_fdg :_daa =55;goto _gbf ;_eacb :_daa =56;goto _gbf ;_bfb :_daa =57;goto _gbf ;_fbdd :_daa =27;goto _gbf ;_bff :_daa =28;goto _gbf ;_bda :_daa =29;goto _gbf ;_cfdf :_daa =30;goto _gbf ;_caa :_daa =31;goto _gbf ;_bba :_daa =58;goto _gbf ;_fbc :_daa =32;goto _gbf ;_dca :_daa =59;goto _gbf ;_baa :_daa =33;goto _gbf ;_fdee :_daa =60;goto _gbf ;_cdc :_daa =61;goto _gbf ;_add :_daa =62;goto _gbf ;_gbf :{};if _eeb ==_cafc {switch _daa {case 35:goto _fgc ;case 0:goto _gde ;case 36:goto _aada ;case 37:goto _ddc ;case 1:goto _gde ;case 2:goto _gde ;case 38:goto _gee ;case 3:goto _gc ;case 4:goto _gc ;case 39:goto _gee ;case 5:goto _gc ;case 6:goto _gc ;case 7:goto _gc ;case 8:goto _gde ;case 40:goto _gee ;case 9:goto _gc ;case 41:goto _gee ;case 10:goto _gde ;case 42:goto _gee ;case 11:goto _gc ;case 43:goto _gee ;case 44:goto _gee ;case 45:goto _gee ;case 12:goto _ece ;case 46:goto _gfgf ;case 13:goto _gadc ;case 14:goto _gde ;case 15:goto _gde ;case 16:goto _gadc ;case 47:goto _efd ;case 17:goto _bffa ;case 48:goto _ee ;case 18:goto _feeb ;case 19:goto _feeb ;case 20:goto _gde ;case 49:goto _fgc ;case 50:goto _ab ;case 21:goto _gde ;case 22:goto _gde ;case 23:goto _gde ;case 24:goto _gde ;case 25:goto _gde ;case 51:goto _ab ;case 26:goto _bbfa ;case 52:goto _ab ;case 53:goto _ab ;case 54:goto _gfaa ;case 55:goto _fgc ;case 56:goto _fgc ;case 57:goto _fgc ;case 27:goto _e ;case 28:goto _e ;case 29:goto _e ;case 30:goto _e ;case 31:goto _e ;case 58:goto _fgc ;case 32:goto _gde ;case 59:goto _gde ;case 33:goto _e ;case 60:goto _fgc ;case 61:goto _efd ;case 62:goto _fgc ;};};};if _cag > 0{copy (_fdaa [0:],_fdaa [_cag :]);};};_ =_cafc ;if _daa ==_bgc {_eegg .Log ("\u0066o\u0072m\u0061\u0074\u0020\u0070\u0061r\u0073\u0065 \u0065\u0072\u0072\u006f\u0072");};};func _cegf (_acaa []byte )[]byte {_gfd :=len (_acaa );_eg :=false ;_cca :=false ;for _gca :=len (_acaa )-1;_gca >=0;_gca --{if _acaa [_gca ]=='0'&&!_cca &&!_eg {_gfd =_gca ;}else if _acaa [_gca ]=='.'{_eg =true ;}else {_cca =true ;};};if _eg &&_cca {if _acaa [_gfd -1]=='.'{_gfd --;};return _acaa [0:_gfd ];};return _acaa ;};
|
|
|
|
// String returns the string formatted according to the type. In format strings
|
|
// this is the fourth item, where '@' is used as a placeholder for text.
|
|
func String (v string ,f string )string {_cg :=Parse (f );var _gda Format ;if len (_cg )==1{_gda =_cg [0];}else if len (_cg )==4{_gda =_cg [3];};_ebd :=false ;for _ ,_bcfb :=range _gda .Whole {if _bcfb .Type ==FmtTypeText {_ebd =true ;};};if !_ebd {return v ;};_dggf :=_dfb .Buffer {};for _ ,_cf :=range _gda .Whole {switch _cf .Type {case FmtTypeLiteral :_dggf .WriteByte (_cf .Literal );case FmtTypeText :_dggf .WriteString (v );};};return _dggf .String ();};const _aggf =1e-10;func _gbd (_g int64 ,_bf Format )[]byte {if !_bf .IsExponential ||len (_bf .Exponent )==0{return nil ;};_bbe :=_gff .AppendInt (nil ,_badd (_g ),10);_gaa :=make ([]byte ,0,len (_bbe )+2);_gaa =append (_gaa ,'E');if _g >=0{_gaa =append (_gaa ,'+');}else {_gaa =append (_gaa ,'-');_g *=-1;};_abe :=0;_efa :for _gbg :=len (_bf .Exponent )-1;_gbg >=0;_gbg --{_gace :=len (_bbe )-1-_abe ;_aeee :=_bf .Exponent [_gbg ];switch _aeee .Type {case FmtTypeDigit :if _gace >=0{_gaa =append (_gaa ,_bbe [_gace ]);_abe ++;}else {_gaa =append (_gaa ,'0');};case FmtTypeDigitOpt :if _gace >=0{_gaa =append (_gaa ,_bbe [_gace ]);_abe ++;}else {for _bea :=_gbg ;_bea >=0;_bea --{_ed :=_bf .Exponent [_bea ];if _ed .Type ==FmtTypeLiteral {_gaa =append (_gaa ,_ed .Literal );};};break _efa ;};case FmtTypeLiteral :_gaa =append (_gaa ,_aeee .Literal );default:_eegg .Log ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0074\u0079\u0070\u0065\u0020\u0069\u006e\u0020\u0065\u0078p\u0020\u0025\u0076",_aeee );};};if _abe < len (_bbe ){_gaa =append (_gaa ,_bbe [len (_bbe )-_abe -1:_abe -1]...);};_aafb (_gaa [2:]);return _gaa ;};func _badd (_befg int64 )int64 {if _befg < 0{return -_befg ;};return _befg ;};const _bbb int =-1; |