mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-25 13:48:53 +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 (_d "bytes";_b "fmt";_aa "github.com/unidoc/unioffice/common/logger";_g "io";_gg "math";_e "strconv";_a "strings";_c "time";);func _bcbd (_eaf _c .Time ,_aee float64 ,_cga string )[]byte {_agb :=[]byte {};_gcg :=0;for _aff :=0;_aff < len (_cga );_aff ++{var _dbf string ;if _cga [_aff ]==':'{_dbf =string (_cga [_gcg :_aff ]);_gcg =_aff +1;}else if _aff ==len (_cga )-1{_dbf =string (_cga [_gcg :_aff +1]);}else {continue ;};switch _dbf {case "\u0064":_agb =_eaf .AppendFormat (_agb ,"\u0032");case "\u0068":_agb =_eaf .AppendFormat (_agb ,"\u0033");case "\u0068\u0068":_agb =_eaf .AppendFormat (_agb ,"\u0031\u0035");case "\u006d":_agb =_eaf .AppendFormat (_agb ,"\u0034");case "\u006d\u006d":_agb =_eaf .AppendFormat (_agb ,"\u0030\u0034");case "\u0073":_agb =_eaf .Round (_c .Second ).AppendFormat (_agb ,"\u0035");case "\u0073\u002e\u0030":_agb =_eaf .Round (_c .Second /10).AppendFormat (_agb ,"\u0035\u002e\u0030");case "\u0073\u002e\u0030\u0030":_agb =_eaf .Round (_c .Second /100).AppendFormat (_agb ,"\u0035\u002e\u0030\u0030");case "\u0073\u002e\u00300\u0030":_agb =_eaf .Round (_c .Second /1000).AppendFormat (_agb ,"\u0035\u002e\u00300\u0030");case "\u0073\u0073":_agb =_eaf .Round (_c .Second ).AppendFormat (_agb ,"\u0030\u0035");case "\u0073\u0073\u002e\u0030":_agb =_eaf .Round (_c .Second /10).AppendFormat (_agb ,"\u0030\u0035\u002e\u0030");case "\u0073\u0073\u002e0\u0030":_agb =_eaf .Round (_c .Second /100).AppendFormat (_agb ,"\u0030\u0035\u002e0\u0030");case "\u0073\u0073\u002e\u0030\u0030\u0030":_agb =_eaf .Round (_c .Second /1000).AppendFormat (_agb ,"\u0030\u0035\u002e\u0030\u0030\u0030");case "\u0041\u004d\u002fP\u004d":_agb =_eaf .AppendFormat (_agb ,"\u0050\u004d");case "\u005b\u0068\u005d":_agb =_e .AppendInt (_agb ,int64 (_aee *24),10);case "\u005b\u006d\u005d":_agb =_e .AppendInt (_agb ,int64 (_aee *24*60),10);case "\u005b\u0073\u005d":_agb =_e .AppendInt (_agb ,int64 (_aee *24*60*60),10);case "":default:_aa .Log .Debug ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0074\u0069\u006d\u0065\u0020\u0066\u006f\u0072\u006d\u0061t\u0020\u0025\u0073",_dbf );};if _cga [_aff ]==':'{_agb =append (_agb ,':');};};return _agb ;};func _ace (_aeg ,_ea float64 ,_edc Format )[]byte {if len (_edc .Whole )==0{return nil ;};_fe :=_c .Date (1899,12,30,0,0,0,0,_c .UTC );_aag :=_fe .Add (_c .Duration (_ea *float64 (24*_c .Hour )));_aag =_fbcd (_aag );_eef :=_e .AppendFloat (nil ,_aeg ,'f',-1,64);_ede :=make ([]byte ,0,len (_eef ));_bag :=0;_ad :=1;_fca :for _ggcb :=len (_edc .Whole )-1;_ggcb >=0;_ggcb --{_fa :=len (_eef )-1-_bag ;_bcc :=_edc .Whole [_ggcb ];switch _bcc .Type {case FmtTypeDigit :if _fa >=0{_ede =append (_ede ,_eef [_fa ]);_bag ++;_ad =_ggcb ;}else {_ede =append (_ede ,'0');};case FmtTypeDigitOpt :if _fa >=0{_ede =append (_ede ,_eef [_fa ]);_bag ++;_ad =_ggcb ;}else {for _faf :=_ggcb ;_faf >=0;_faf --{_fg :=_edc .Whole [_faf ];if _fg .Type ==FmtTypeLiteral {_ede =append (_ede ,_fg .Literal );};};break _fca ;};case FmtTypeDollar :for _gb :=_bag ;_gb < len (_eef );_gb ++{_ede =append (_ede ,_eef [len (_eef )-1-_gb ]);_bag ++;};_ede =append (_ede ,'$');case FmtTypeComma :if !_edc ._eb {_ede =append (_ede ,',');};case FmtTypeLiteral :_ede =append (_ede ,_bcc .Literal );case FmtTypeDate :_ede =append (_ede ,_gca (_bdc (_aag ,_bcc .DateTime ))...);case FmtTypeTime :_ede =append (_ede ,_gca (_bcbd (_aag ,_ea ,_bcc .DateTime ))...);default:_aa .Log .Debug ("\u0075\u006e\u0073\u0075p\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0074\u0079\u0070e\u0020i\u006e\u0020\u0077\u0068\u006f\u006c\u0065 \u0025\u0076",_bcc );};};_ccc :=_gca (_ede );if _bag < len (_eef )&&(_bag !=0||_edc ._ee ){_gdfc :=len (_eef )-_bag ;_gdb :=make ([]byte ,len (_ccc )+_gdfc );copy (_gdb ,_ccc [0:_ad ]);copy (_gdb [_ad :],_eef [0:]);copy (_gdb [_ad +_gdfc :],_ccc [_ad :]);_ccc =_gdb ;};if _edc ._eb {_fd :=_d .Buffer {};_ffe :=0;for _bea :=len (_ccc )-1;_bea >=0;_bea --{if !(_ccc [_bea ]>='0'&&_ccc [_bea ]<='9'){_ffe ++;}else {break ;};};for _ccg :=0;_ccg < len (_ccc );_ccg ++{_dbb :=(len (_ccc )-_ccg -_ffe );if _dbb %3==0&&_dbb !=0&&_ccg !=0{_fd .WriteByte (',');};_fd .WriteByte (_ccc [_ccg ]);};_ccc =_fd .Bytes ();};return _ccc ;};func _feda (_fgcd []byte )[]byte {_abe :=len (_fgcd );_ccf :=false ;_bcb :=false ;for _gda :=len (_fgcd )-1;_gda >=0;_gda --{if _fgcd [_gda ]=='0'&&!_bcb &&!_ccf {_abe =_gda ;}else if _fgcd [_gda ]=='.'{_ccf =true ;}else {_bcb =true ;};};if _ccf &&_bcb {if _fgcd [_abe -1]=='.'{_abe --;};return _fgcd [0:_abe ];};return _fgcd ;};const _gfa int =0;func (_de FmtType )String ()string {if _de >=FmtType (len (_ba )-1){return _b .Sprintf ("F\u006d\u0074\u0054\u0079\u0070\u0065\u0028\u0025\u0064\u0029",_de );};return _be [_ba [_de ]:_ba [_de +1]];};
|
|
|
|
// NumberGeneric formats the number with the generic format which attemps to
|
|
// mimic Excel's general formatting.
|
|
func NumberGeneric (v float64 )string {if _gg .Abs (v )>=_gd ||_gg .Abs (v )<=_bd &&v !=0{return _efe (v );};_cfe :=make ([]byte ,0,15);_cfe =_e .AppendFloat (_cfe ,v ,'f',-1,64);if len (_cfe )> 11{_eed :=_cfe [11]-'0';if _eed >=5&&_eed <=9{_cfe [10]++;_cfe =_cfe [0:11];_cfe =_dff (_cfe );};_cfe =_cfe [0:11];}else if len (_cfe )==11{if _cfe [len (_cfe )-1]=='9'{_cfe [len (_cfe )-1]++;_cfe =_dff (_cfe );};};_cfe =_feda (_cfe );return string (_cfe );};func _gca (_ebf []byte )[]byte {for _bg :=0;_bg < len (_ebf )/2;_bg ++{_dgd :=len (_ebf )-1-_bg ;_ebf [_bg ],_ebf [_dgd ]=_ebf [_dgd ],_ebf [_bg ];};return _ebf ;};const _eage int =-1;
|
|
|
|
// 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 );};_ec :=Parse (f );if len (_ec )==1{return _ae (v ,_ec [0],false );}else if len (_ec )> 1&&v < 0{return _ae (v ,_ec [1],true );}else if len (_ec )> 2&&v ==0{return _ae (v ,_ec [2],false );};return _ae (v ,_ec [0],false );};func _bdc (_eag _c .Time ,_edb string )[]byte {_cde :=[]byte {};_eee :=0;for _ggg :=0;_ggg < len (_edb );_ggg ++{var _edca string ;if _edb [_ggg ]=='/'{_edca =string (_edb [_eee :_ggg ]);_eee =_ggg +1;}else if _ggg ==len (_edb )-1{_edca =string (_edb [_eee :_ggg +1]);}else {continue ;};switch _edca {case "\u0079\u0079":_cde =_eag .AppendFormat (_cde ,"\u0030\u0036");case "\u0079\u0079\u0079\u0079":_cde =_eag .AppendFormat (_cde ,"\u0032\u0030\u0030\u0036");case "\u006d":_cde =_eag .AppendFormat (_cde ,"\u0031");case "\u006d\u006d":_cde =_eag .AppendFormat (_cde ,"\u0030\u0031");case "\u006d\u006d\u006d":_cde =_eag .AppendFormat (_cde ,"\u004a\u0061\u006e");case "\u006d\u006d\u006d\u006d":_cde =_eag .AppendFormat (_cde ,"\u004aa\u006e\u0075\u0061\u0072\u0079");case "\u006d\u006d\u006dm\u006d":switch _eag .Month (){case _c .January ,_c .July ,_c .June :_cde =append (_cde ,'J');case _c .February :_cde =append (_cde ,'M');case _c .March ,_c .May :_cde =append (_cde ,'M');case _c .April ,_c .August :_cde =append (_cde ,'A');case _c .September :_cde =append (_cde ,'S');case _c .October :_cde =append (_cde ,'O');case _c .November :_cde =append (_cde ,'N');case _c .December :_cde =append (_cde ,'D');};case "\u0064":_cde =_eag .AppendFormat (_cde ,"\u0032");case "\u0064\u0064":_cde =_eag .AppendFormat (_cde ,"\u0030\u0032");case "\u0064\u0064\u0064":_cde =_eag .AppendFormat (_cde ,"\u004d\u006f\u006e");case "\u0064\u0064\u0064\u0064":_cde =_eag .AppendFormat (_cde ,"\u004d\u006f\u006e\u0064\u0061\u0079");default:_aa .Log .Debug ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0064\u0061\u0074\u0065\u0020\u0066\u006f\u0072\u006d\u0061t\u0020\u0025\u0073",_edca );};if _edb [_ggg ]=='/'{_cde =append (_cde ,'/');};};return _cde ;};const _eaef int =34;func _ffd (_aaf int64 ,_cf Format )[]byte {if !_cf .IsExponential ||len (_cf .Exponent )==0{return nil ;};_bada :=_e .AppendInt (nil ,_ccgd (_aaf ),10);_dgdf :=make ([]byte ,0,len (_bada )+2);_dgdf =append (_dgdf ,'E');if _aaf >=0{_dgdf =append (_dgdf ,'+');}else {_dgdf =append (_dgdf ,'-');_aaf *=-1;};_eba :=0;_bgg :for _ag :=len (_cf .Exponent )-1;_ag >=0;_ag --{_fbg :=len (_bada )-1-_eba ;_dcd :=_cf .Exponent [_ag ];switch _dcd .Type {case FmtTypeDigit :if _fbg >=0{_dgdf =append (_dgdf ,_bada [_fbg ]);_eba ++;}else {_dgdf =append (_dgdf ,'0');};case FmtTypeDigitOpt :if _fbg >=0{_dgdf =append (_dgdf ,_bada [_fbg ]);_eba ++;}else {for _dcda :=_ag ;_dcda >=0;_dcda --{_ebfd :=_cf .Exponent [_dcda ];if _ebfd .Type ==FmtTypeLiteral {_dgdf =append (_dgdf ,_ebfd .Literal );};};break _bgg ;};case FmtTypeLiteral :_dgdf =append (_dgdf ,_dcd .Literal );default:_aa .Log .Debug ("\u0075\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064 \u0074\u0079\u0070\u0065\u0020\u0069\u006e\u0020\u0065\u0078p\u0020\u0025\u0076",_dcd );};};if _eba < len (_bada ){_dgdf =append (_dgdf ,_bada [len (_bada )-_eba -1:_eba -1]...);};_gca (_dgdf [2:]);return _dgdf ;};func _ccgd (_dd int64 )int64 {if _dd < 0{return -_dd ;};return _dd ;};
|
|
|
|
// FmtType is the type of a format token.
|
|
//go:generate stringer -type=FmtType
|
|
type FmtType byte ;const _fdc int =-1;const _eab int =34;
|
|
|
|
// Format is a parsed number format.
|
|
type Format struct{Whole []Token ;Fractional []Token ;Exponent []Token ;IsExponential bool ;_db bool ;_ff bool ;_ggc bool ;_eb bool ;_ef bool ;_ee bool ;_gdf int64 ;_ac int ;};
|
|
|
|
// AddToken adds a format token to the format.
|
|
func (_bf *Format )AddToken (t FmtType ,l []byte ){if _bf ._ef {_bf ._ef =false ;return ;};switch t {case FmtTypeDecimal :_bf ._ee =true ;case FmtTypeUnderscore :_bf ._ef =true ;case FmtTypeText :_bf .Whole =append (_bf .Whole ,Token {Type :t });case FmtTypeDate ,FmtTypeTime :_bf .Whole =append (_bf .Whole ,Token {Type :t ,DateTime :string (l )});case FmtTypePercent :_bf ._ff =true ;t =FmtTypeLiteral ;l =[]byte {'%'};fallthrough;case FmtTypeDigitOpt :fallthrough;case FmtTypeLiteral ,FmtTypeDigit ,FmtTypeDollar ,FmtTypeComma :if l ==nil {l =[]byte {0};};for _ ,_dg :=range l {if _bf .IsExponential {_bf .Exponent =append (_bf .Exponent ,Token {Type :t ,Literal :_dg });}else if !_bf ._ee {_bf .Whole =append (_bf .Whole ,Token {Type :t ,Literal :_dg });}else {_bf .Fractional =append (_bf .Fractional ,Token {Type :t ,Literal :_dg });};};case FmtTypeDigitOptThousands :_bf ._eb =true ;case FmtTypeFraction :_deb :=_a .Split (string (l ),"\u002f");if len (_deb )==2{_bf ._db =true ;_bf ._gdf ,_ =_e .ParseInt (_deb [1],10,64);for _ ,_gf :=range _deb [1]{if _gf =='?'||_gf =='0'{_bf ._ac ++;};};};default:_aa .Log .Debug ("\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 );};};const _gd =1e11;const _ebfc int =0;
|
|
|
|
// 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 {_ece :=Parse (f );var _gc Format ;if len (_ece )==1{_gc =_ece [0];}else if len (_ece )==4{_gc =_ece [3];};_bec :=false ;for _ ,_ed :=range _gc .Whole {if _ed .Type ==FmtTypeText {_bec =true ;};};if !_bec {return v ;};_ffc :=_d .Buffer {};for _ ,_ga :=range _gc .Whole {switch _ga .Type {case FmtTypeLiteral :_ffc .WriteByte (_ga .Literal );case FmtTypeText :_ffc .WriteString (v );};};return _ffc .String ();};type Lexer struct{_gbe Format ;_cge []Format ;};const _eggb int =34;func _fbcd (_bge _c .Time )_c .Time {_bge =_bge .UTC ();return _c .Date (_bge .Year (),_bge .Month (),_bge .Day (),_bge .Hour (),_bge .Minute (),_bge .Second (),_bge .Nanosecond (),_c .Local );};func _ae (_dc float64 ,_fc Format ,_bgc bool )string {if _fc ._ggc {return NumberGeneric (_dc );};_ebe :=make ([]byte ,0,20);_cd :=_gg .Signbit (_dc );_ggcc :=_gg .Abs (_dc );_acf :=int64 (0);_efd :=int64 (0);if _fc .IsExponential {for _ggcc >=10{_efd ++;_ggcc /=10;};for _ggcc < 1{_efd --;_ggcc *=10;};}else if _fc ._ff {_ggcc *=100;}else if _fc ._db {if _fc ._gdf ==0{_cb :=_gg .Pow (10,float64 (_fc ._ac ));_eg ,_ca :=1.0,1.0;_ =_eg ;for _gcb :=1.0;_gcb < _cb ;_gcb ++{_ ,_abb :=_gg .Modf (_ggcc *float64 (_gcb ));if _abb < _ca {_ca =_abb ;_eg =_gcb ;if _abb ==0{break ;};};};_fc ._gdf =int64 (_eg );};_acf =int64 (_ggcc *float64 (_fc ._gdf )+0.5);if len (_fc .Whole )> 0&&_acf > _fc ._gdf {_acf =int64 (_ggcc *float64 (_fc ._gdf ))%_fc ._gdf ;_ggcc -=float64 (_acf )/float64 (_fc ._gdf );}else {_ggcc -=float64 (_acf )/float64 (_fc ._gdf );if _gg .Abs (_ggcc )< 1{_abd :=true ;for _ ,_cc :=range _fc .Whole {if _cc .Type ==FmtTypeDigitOpt {continue ;};if _cc .Type ==FmtTypeLiteral &&_cc .Literal ==' '{continue ;};_abd =false ;};if _abd {_fc .Whole =nil ;};};};};_bdb :=1;for _ ,_cbf :=range _fc .Fractional {if _cbf .Type ==FmtTypeDigit ||_cbf .Type ==FmtTypeDigitOpt {_bdb ++;};};_ggcc +=5*_gg .Pow10 (-_bdb );_bgcb ,_caf :=_gg .Modf (_ggcc );_ebe =append (_ebe ,_ace (_bgcb ,_dc ,_fc )...);_ebe =append (_ebe ,_dca (_caf ,_dc ,_fc )...);_ebe =append (_ebe ,_ffd (_efd ,_fc )...);if _fc ._db {_ebe =_e .AppendInt (_ebe ,_acf ,10);_ebe =append (_ebe ,'/');_ebe =_e .AppendInt (_ebe ,_fc ._gdf ,10);};if !_bgc &&_cd {return "\u002d"+string (_ebe );};return string (_ebe );};const _bd =1e-10;func _dff (_eae []byte )[]byte {for _afc :=len (_eae )-1;_afc > 0;_afc --{if _eae [_afc ]=='9'+1{_eae [_afc ]='0';if _eae [_afc -1]=='.'{_afc --;};_eae [_afc -1]++;};};if _eae [0]=='9'+1{_eae [0]='0';copy (_eae [1:],_eae [0:]);_eae [0]='1';};return _eae ;};
|
|
|
|
// 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 ){_da ,_ :=_e .ParseFloat (v ,64);return Number (_da ,f );};return String (v ,f );};const _bda int =0;const (FmtTypeLiteral FmtType =iota ;FmtTypeDigit ;FmtTypeDigitOpt ;FmtTypeComma ;FmtTypeDecimal ;FmtTypePercent ;FmtTypeDollar ;FmtTypeDigitOptThousands ;FmtTypeUnderscore ;FmtTypeDate ;FmtTypeTime ;FmtTypeFraction ;FmtTypeText ;);const _be ="\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 (_adf *Lexer )Lex (r _g .Reader ){_cfc ,_ebb ,_eead :=0,0,0;_aefg :=-1;_ecg ,_bgcd ,_dcb :=0,0,0;_ =_bgcd ;_ =_dcb ;_aed :=1;_ =_aed ;_cfg :=make ([]byte ,4096);_dfa :=false ;for !_dfa {_fgca :=0;if _ecg > 0{_fgca =_ebb -_ecg ;};_ebb =0;_aca ,_egb :=r .Read (_cfg [_fgca :]);if _aca ==0||_egb !=nil {_dfa =true ;};_eead =_aca +_fgca ;if _eead < len (_cfg ){_aefg =_eead ;};{_cfc =_eaef ;_ecg =0;_bgcd =0;_dcb =0;};{if _ebb ==_eead {goto _abgg ;};switch _cfc {case 34:goto _cec ;case 35:goto _ceeg ;case 0:goto _gbc ;case 36:goto _edf ;case 37:goto _gfb ;case 1:goto _aeb ;case 2:goto _edbd ;case 38:goto _dgaf ;case 3:goto _egcb ;case 4:goto _agf ;case 39:goto _aaac ;case 5:goto _abff ;case 6:goto _daa ;case 7:goto _fac ;case 8:goto _ade ;case 40:goto _adb ;case 9:goto _cad ;case 41:goto _dbfc ;case 10:goto _gfec ;case 42:goto _eeg ;case 11:goto _eeda ;case 43:goto _ggf ;case 44:goto _fgb ;case 45:goto _dffe ;case 12:goto _bbc ;case 46:goto _fdg ;case 13:goto _geg ;case 14:goto _edgc ;case 15:goto _aab ;case 16:goto _ecgc ;case 47:goto _fgff ;case 17:goto _bfdd ;case 48:goto _bcff ;case 18:goto _eeeb ;case 19:goto _gaa ;case 20:goto _gaeb ;case 49:goto _gfaf ;case 50:goto _gbgc ;case 21:goto _fgbc ;case 22:goto _dgab ;case 23:goto _fafd ;case 24:goto _dcg ;case 25:goto _bagd ;case 51:goto _effeb ;case 26:goto _afd ;case 52:goto _bedd ;case 53:goto _fafb ;case 54:goto _fege ;case 55:goto _fcaa ;case 56:goto _afcd ;case 57:goto _acg ;case 27:goto _gea ;case 28:goto _gdad ;case 29:goto _cece ;case 30:goto _beba ;case 31:goto _dag ;case 58:goto _ebc ;case 32:goto _ddb ;case 59:goto _adg ;case 33:goto _cacb ;case 60:goto _cgfa ;case 61:goto _ggca ;case 62:goto _aedg ;};goto _dgb ;_abg :switch _dcb {case 2:{_ebb =(_bgcd )-1;_adf ._gbe .AddToken (FmtTypeDigit ,nil );};case 3:{_ebb =(_bgcd )-1;_adf ._gbe .AddToken (FmtTypeDigitOpt ,nil );};case 5:{_ebb =(_bgcd )-1;};case 8:{_ebb =(_bgcd )-1;_adf ._gbe .AddToken (FmtTypePercent ,nil );};case 13:{_ebb =(_bgcd )-1;_adf ._gbe .AddToken (FmtTypeFraction ,_cfg [_ecg :_bgcd ]);};case 14:{_ebb =(_bgcd )-1;_adf ._gbe .AddToken (FmtTypeDate ,_cfg [_ecg :_bgcd ]);};case 15:{_ebb =(_bgcd )-1;_adf ._gbe .AddToken (FmtTypeTime ,_cfg [_ecg :_bgcd ]);};case 16:{_ebb =(_bgcd )-1;_adf ._gbe .AddToken (FmtTypeTime ,_cfg [_ecg :_bgcd ]);};case 18:{_ebb =(_bgcd )-1;};case 20:{_ebb =(_bgcd )-1;_adf ._gbe .AddToken (FmtTypeLiteral ,_cfg [_ecg :_bgcd ]);};case 21:{_ebb =(_bgcd )-1;_adf ._gbe .AddToken (FmtTypeLiteral ,_cfg [_ecg +1:_bgcd -1]);};};goto _gdfa ;_bdbc :_ebb =(_bgcd )-1;{_adf ._gbe .AddToken (FmtTypeFraction ,_cfg [_ecg :_bgcd ]);};goto _gdfa ;_dga :_ebb =(_bgcd )-1;{_adf ._gbe .AddToken (FmtTypeDigitOpt ,nil );};goto _gdfa ;_dfc :_bgcd =_ebb +1;{_adf ._gbe .AddToken (FmtTypeDigitOptThousands ,nil );};goto _gdfa ;_edg :_ebb =(_bgcd )-1;{_adf ._gbe .AddToken (FmtTypePercent ,nil );};goto _gdfa ;_gde :_ebb =(_bgcd )-1;{_adf ._gbe .AddToken (FmtTypeDate ,_cfg [_ecg :_bgcd ]);};goto _gdfa ;_bdbg :_ebb =(_bgcd )-1;{_adf ._gbe .AddToken (FmtTypeDigit ,nil );};goto _gdfa ;_aaa :_ebb =(_bgcd )-1;{_adf ._gbe .AddToken (FmtTypeTime ,_cfg [_ecg :_bgcd ]);};goto _gdfa ;_fbe :_ebb =(_bgcd )-1;{_adf ._gbe .AddToken (FmtTypeLiteral ,_cfg [_ecg :_bgcd ]);};goto _gdfa ;_fdb :_bgcd =_ebb +1;{_adf ._gbe ._ggc =true ;};goto _gdfa ;_ce :_bgcd =_ebb +1;{_adf ._gbe .AddToken (FmtTypeLiteral ,_cfg [_ecg :_bgcd ]);};goto _gdfa ;_ccbg :_bgcd =_ebb +1;{_adf ._gbe .AddToken (FmtTypeDollar ,nil );};goto _gdfa ;_dfd :_bgcd =_ebb +1;{_adf ._gbe .AddToken (FmtTypeComma ,nil );};goto _gdfa ;_effg :_bgcd =_ebb +1;{_adf ._gbe .AddToken (FmtTypeDecimal ,nil );};goto _gdfa ;_efdg :_bgcd =_ebb +1;{_adf .nextFmt ();};goto _gdfa ;_gdc :_bgcd =_ebb +1;{_adf ._gbe .AddToken (FmtTypeText ,nil );};goto _gdfa ;_cef :_bgcd =_ebb +1;{_adf ._gbe .AddToken (FmtTypeUnderscore ,nil );};goto _gdfa ;_eac :_bgcd =_ebb ;_ebb --;{_adf ._gbe .AddToken (FmtTypeLiteral ,_cfg [_ecg :_bgcd ]);};goto _gdfa ;_ebeg :_bgcd =_ebb ;_ebb --;{_adf ._gbe .AddToken (FmtTypeLiteral ,_cfg [_ecg +1:_bgcd -1]);};goto _gdfa ;_bbb :_bgcd =_ebb ;_ebb --;{_adf ._gbe .AddToken (FmtTypeDigitOpt ,nil );};goto _gdfa ;_daf :_bgcd =_ebb ;_ebb --;{_adf ._gbe .AddToken (FmtTypeFraction ,_cfg [_ecg :_bgcd ]);};goto _gdfa ;_aagc :_bgcd =_ebb ;_ebb --;{_adf ._gbe .AddToken (FmtTypePercent ,nil );};goto _gdfa ;_dfae :_bgcd =_ebb ;_ebb --;{_adf ._gbe .AddToken (FmtTypeDate ,_cfg [_ecg :_bgcd ]);};goto _gdfa ;_bce :_bgcd =_ebb ;_ebb --;{_adf ._gbe .AddToken (FmtTypeDigit ,nil );};goto _gdfa ;_gae :_bgcd =_ebb ;_ebb --;{_adf ._gbe .AddToken (FmtTypeTime ,_cfg [_ecg :_bgcd ]);};goto _gdfa ;_dbba :_bgcd =_ebb ;_ebb --;{};goto _gdfa ;_edcc :_bgcd =_ebb +1;{_adf ._gbe .IsExponential =true ;};goto _gdfa ;_cee :_bgcd =_ebb +1;{_adf ._gbe .AddToken (FmtTypeLiteral ,_cfg [_ecg +1:_bgcd ]);};goto _gdfa ;_gdfa :_ecg =0;if _ebb ++;_ebb ==_eead {goto _fgfc ;};_cec :_ecg =_ebb ;switch _cfg [_ebb ]{case 34:goto _fdf ;case 35:goto _bde ;case 36:goto _ccbg ;case 37:goto _aac ;case 44:goto _dfd ;case 46:goto _effg ;case 47:goto _add ;case 48:goto _cce ;case 58:goto _edcad ;case 59:goto _efdg ;case 63:goto _eafa ;case 64:goto _gdc ;case 65:goto _dgg ;case 69:goto _edd ;case 71:goto _abbc ;case 91:goto _cacd ;case 92:goto _gbd ;case 95:goto _cef ;case 100:goto _add ;case 104:goto _edcad ;case 109:goto _bggg ;case 115:goto _bfe ;case 121:goto _dab ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _dceg ;};goto _ce ;_fdf :_bgcd =_ebb +1;_dcb =20;goto _bdfa ;_bdfa :if _ebb ++;_ebb ==_eead {goto _bdfe ;};_ceeg :if _cfg [_ebb ]==34{goto _adfa ;};goto _dfaf ;_dfaf :if _ebb ++;_ebb ==_eead {goto _gfg ;};_gbc :if _cfg [_ebb ]==34{goto _adfa ;};goto _dfaf ;_adfa :_bgcd =_ebb +1;_dcb =21;goto _bed ;_bed :if _ebb ++;_ebb ==_eead {goto _bddf ;};_edf :if _cfg [_ebb ]==34{goto _dfaf ;};goto _ebeg ;_bde :_bgcd =_ebb +1;_dcb =3;goto _dce ;_dce :if _ebb ++;_ebb ==_eead {goto _agg ;};_gfb :switch _cfg [_ebb ]{case 35:goto _fda ;case 37:goto _fda ;case 44:goto _fcag ;case 47:goto _feg ;case 48:goto _fda ;case 63:goto _fda ;};goto _bbb ;_fda :if _ebb ++;_ebb ==_eead {goto _becb ;};_aeb :switch _cfg [_ebb ]{case 35:goto _fda ;case 37:goto _fda ;case 47:goto _feg ;case 48:goto _fda ;case 63:goto _fda ;};goto _abg ;_feg :if _ebb ++;_ebb ==_eead {goto _aeef ;};_edbd :switch _cfg [_ebb ]{case 35:goto _fegb ;case 37:goto _dge ;case 48:goto _aebg ;case 63:goto _fegb ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _dcc ;};goto _abg ;_fegb :_bgcd =_ebb +1;goto _befc ;_befc :if _ebb ++;_ebb ==_eead {goto _faga ;};_dgaf :switch _cfg [_ebb ]{case 35:goto _fegb ;case 37:goto _fegb ;case 44:goto _fegb ;case 46:goto _fegb ;case 48:goto _fegb ;case 63:goto _fegb ;case 65:goto _bcf ;};goto _daf ;_bcf :if _ebb ++;_ebb ==_eead {goto _bgf ;};_egcb :switch _cfg [_ebb ]{case 47:goto _fcg ;case 77:goto _gff ;};goto _bdbc ;_fcg :if _ebb ++;_ebb ==_eead {goto _acbg ;};_agf :if _cfg [_ebb ]==80{goto _aafd ;};goto _bdbc ;_aafd :_bgcd =_ebb +1;goto _afbe ;_afbe :if _ebb ++;_ebb ==_eead {goto _cgad ;};_aaac :if _cfg [_ebb ]==65{goto _bcf ;};goto _daf ;_gff :if _ebb ++;_ebb ==_eead {goto _fga ;};_abff :if _cfg [_ebb ]==47{goto _aeeg ;};goto _bdbc ;_aeeg :if _ebb ++;_ebb ==_eead {goto _gga ;};_daa :if _cfg [_ebb ]==80{goto _gec ;};goto _bdbc ;_gec :if _ebb ++;_ebb ==_eead {goto _affb ;};_fac :if _cfg [_ebb ]==77{goto _aafd ;};goto _bdbc ;_dge :if _ebb ++;_ebb ==_eead {goto _cefc ;};_ade :switch _cfg [_ebb ]{case 35:goto _bfd ;case 37:goto _bfa ;case 63:goto _bfd ;};if 48<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _gbcb ;};goto _abg ;_bfd :_bgcd =_ebb +1;goto _fbb ;_fbb :if _ebb ++;_ebb ==_eead {goto _ead ;};_adb :switch _cfg [_ebb ]{case 35:goto _fegb ;case 37:goto _aaab ;case 44:goto _fegb ;case 46:goto _fegb ;case 48:goto _fegb ;case 63:goto _fegb ;case 65:goto _bcf ;};goto _daf ;_aaab :if _ebb ++;_ebb ==_eead {goto _bfgf ;};_cad :switch _cfg [_ebb ]{case 35:goto _dfaeb ;case 44:goto _dfaeb ;case 46:goto _dfaeb ;case 48:goto _dfaeb ;case 63:goto _dfaeb ;};goto _bdbc ;_dfaeb :_bgcd =_ebb +1;goto _fce ;_fce :if _ebb ++;_ebb ==_eead {goto _bca ;};_dbfc :switch _cfg [_ebb ]{case 35:goto _dfaeb ;case 44:goto _dfaeb ;case 46:goto _dfaeb ;case 48:goto _dfaeb ;case 63:goto _dfaeb ;case 65:goto _bcf ;};goto _daf ;_bfa :if _ebb ++;_ebb ==_eead {goto _dba ;};_gfec :if _cfg [_ebb ]==37{goto _bfa ;};if 48<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _gbcb ;};goto _abg ;_gbcb :_bgcd =_ebb +1;_dcb =13;goto _acef ;_acef :if _ebb ++;_ebb ==_eead {goto _gge ;};_eeg :switch _cfg [_ebb ]{case 35:goto _fegb ;case 37:goto _fbeb ;case 44:goto _fegb ;case 46:goto _fegb ;case 48:goto _dfca ;case 63:goto _fegb ;case 65:goto _bcf ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _gbcb ;};goto _daf ;_fbeb :if _ebb ++;_ebb ==_eead {goto _bcea ;};_eeda :switch _cfg [_ebb ]{case 35:goto _dfaeb ;case 37:goto _bfa ;case 44:goto _dfaeb ;case 46:goto _dfaeb ;case 63:goto _dfaeb ;};if 48<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _gbcb ;};goto _bdbc ;_dfca :_bgcd =_ebb +1;goto _cea ;_cea :if _ebb ++;_ebb ==_eead {goto _dcdae ;};_ggf :switch _cfg [_ebb ]{case 35:goto _fegb ;case 37:goto _dfca ;case 44:goto _fegb ;case 46:goto _fegb ;case 48:goto _dfca ;case 63:goto _fegb ;case 65:goto _bcf ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _gbcb ;};goto _daf ;_aebg :_bgcd =_ebb +1;goto _eeaa ;_eeaa :if _ebb ++;_ebb ==_eead {goto _fdac ;};_fgb :switch _cfg [_ebb ]{case 35:goto _fegb ;case 37:goto _dfca ;case 44:goto _fegb ;case 46:goto _fegb ;case 48:goto _aebg ;case 63:goto _fegb ;case 65:goto _bcf ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _dcc ;};goto _daf ;_dcc :_bgcd =_ebb +1;goto _cdb ;_cdb :if _ebb ++;_ebb ==_eead {goto _gfaeb ;};_dffe :switch _cfg [_ebb ]{case 35:goto _fegb ;case 37:goto _gbcb ;case 44:goto _fegb ;case 46:goto _fegb ;case 48:goto _aebg ;case 63:goto _fegb ;case 65:goto _bcf ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _dcc ;};goto _daf ;_fcag :if _ebb ++;_ebb ==_eead {goto _baf ;};_bbc :if _cfg [_ebb ]==35{goto _dfc ;};goto _dga ;_aac :_bgcd =_ebb +1;_dcb =8;goto _gbg ;_gbg :if _ebb ++;_ebb ==_eead {goto _bdbd ;};_fdg :switch _cfg [_ebb ]{case 35:goto _dbbd ;case 37:goto _acd ;case 48:goto _fdef ;case 63:goto _dbbd ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _fagf ;};goto _aagc ;_dbbd :if _ebb ++;_ebb ==_eead {goto _gcd ;};_geg :switch _cfg [_ebb ]{case 35:goto _dbbd ;case 47:goto _feg ;case 48:goto _dbbd ;case 63:goto _dbbd ;};goto _edg ;_acd :if _ebb ++;_ebb ==_eead {goto _fba ;};_edgc :if _cfg [_ebb ]==37{goto _acd ;};if 48<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _fagf ;};goto _abg ;_fagf :if _ebb ++;_ebb ==_eead {goto _abad ;};_aab :switch _cfg [_ebb ]{case 37:goto _acd ;case 47:goto _feg ;};if 48<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _fagf ;};goto _abg ;_fdef :if _ebb ++;_ebb ==_eead {goto _cbca ;};_ecgc :switch _cfg [_ebb ]{case 35:goto _dbbd ;case 37:goto _acd ;case 47:goto _feg ;case 48:goto _fdef ;case 63:goto _dbbd ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _fagf ;};goto _edg ;_add :_bgcd =_ebb +1;goto _gdg ;_gdg :if _ebb ++;_ebb ==_eead {goto _ceff ;};_fgff :switch _cfg [_ebb ]{case 47:goto _add ;case 100:goto _add ;case 109:goto _add ;case 121:goto _gggd ;};goto _dfae ;_gggd :if _ebb ++;_ebb ==_eead {goto _cbff ;};_bfdd :if _cfg [_ebb ]==121{goto _add ;};goto _gde ;_cce :_bgcd =_ebb +1;_dcb =2;goto _dffa ;_dffa :if _ebb ++;_ebb ==_eead {goto _efc ;};_bcff :switch _cfg [_ebb ]{case 35:goto _fda ;case 37:goto _egf ;case 47:goto _feg ;case 48:goto _cceb ;case 63:goto _fda ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _fbga ;};goto _bce ;_egf :if _ebb ++;_ebb ==_eead {goto _ebegc ;};_eeeb :switch _cfg [_ebb ]{case 35:goto _fda ;case 37:goto _egf ;case 47:goto _feg ;case 48:goto _egf ;case 63:goto _fda ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _fagf ;};goto _bdbg ;_cceb :if _ebb ++;_ebb ==_eead {goto _bcbg ;};_gaa :switch _cfg [_ebb ]{case 35:goto _fda ;case 37:goto _egf ;case 47:goto _feg ;case 48:goto _cceb ;case 63:goto _fda ;};if 49<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _fbga ;};goto _bdbg ;_fbga :if _ebb ++;_ebb ==_eead {goto _ddde ;};_gaeb :switch _cfg [_ebb ]{case 37:goto _fagf ;case 47:goto _feg ;};if 48<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _fbga ;};goto _abg ;_dceg :_bgcd =_ebb +1;_dcb =20;goto _cab ;_cab :if _ebb ++;_ebb ==_eead {goto _bcec ;};_gfaf :switch _cfg [_ebb ]{case 37:goto _fagf ;case 47:goto _feg ;};if 48<=_cfg [_ebb ]&&_cfg [_ebb ]<=57{goto _fbga ;};goto _eac ;_edcad :_bgcd =_ebb +1;_dcb =15;goto _fea ;_fea :if _ebb ++;_ebb ==_eead {goto _fbcg ;};_gbgc :switch _cfg [_ebb ]{case 58:goto _edcad ;case 65:goto _dde ;case 104:goto _edcad ;case 109:goto _edcad ;case 115:goto _bfe ;};goto _gae ;_dde :if _ebb ++;_ebb ==_eead {goto _eeaf ;};_fgbc :switch _cfg [_ebb ]{case 47:goto _dbe ;case 77:goto _ecd ;};goto _abg ;_dbe :if _ebb ++;_ebb ==_eead {goto _egd ;};_dgab :if _cfg [_ebb ]==80{goto _edcad ;};goto _abg ;_ecd :if _ebb ++;_ebb ==_eead {goto _aacb ;};_fafd :if _cfg [_ebb ]==47{goto _fab ;};goto _abg ;_fab :if _ebb ++;_ebb ==_eead {goto _afde ;};_dcg :if _cfg [_ebb ]==80{goto _fccb ;};goto _abg ;_fccb :if _ebb ++;_ebb ==_eead {goto _ggfc ;};_bagd :if _cfg [_ebb ]==77{goto _edcad ;};goto _abg ;_bfe :_bgcd =_ebb +1;_dcb =15;goto _eaa ;_eaa :if _ebb ++;_ebb ==_eead {goto _eacd ;};_effeb :switch _cfg [_ebb ]{case 46:goto _cdg ;case 58:goto _edcad ;case 65:goto _dde ;case 104:goto _edcad ;case 109:goto _edcad ;case 115:goto _bfe ;};goto _gae ;_cdg :if _ebb ++;_ebb ==_eead {goto _fega ;};_afd :if _cfg [_ebb ]==48{goto _adc ;};goto _aaa ;_adc :_bgcd =_ebb +1;_dcb =15;goto _ggcbg ;_ggcbg :if _ebb ++;_ebb ==_eead {goto _gdee ;};_bedd :switch _cfg [_ebb ]{case 48:goto _cfee ;case 58:goto _edcad ;case 65:goto _dde ;case 104:goto _edcad ;case 109:goto _edcad ;case 115:goto _bfe ;};goto _gae ;_cfee :_bgcd =_ebb +1;_dcb =15;goto _cbc ;_cbc :if _ebb ++;_ebb ==_eead {goto _fee ;};_fafb :switch _cfg [_ebb ]{case 48:goto _edcad ;case 58:goto _edcad ;case 65:goto _dde ;case 104:goto _edcad ;case 109:goto _edcad ;case 115:goto _bfe ;};goto _gae ;_eafa :_bgcd =_ebb +1;_dcb =5;goto _eec ;_eec :if _ebb ++;_ebb ==_eead {goto _cggc ;};_fege :switch _cfg [_ebb ]{case 35:goto _fda ;case 37:goto _fda ;case 47:goto _feg ;case 48:goto _fda ;case 63:goto _fda ;};goto _dbba ;_dgg :_bgcd =_ebb +1;_dcb =20;goto _gfbg ;_gfbg :if _ebb ++;_ebb ==_eead {goto _fgcc ;};_fcaa :switch _cfg [_ebb ]{case 47:goto _dbe ;case 77:goto _ecd ;};goto _eac ;_edd :if _ebb ++;_ebb ==_eead {goto _aafc ;};_afcd :switch _cfg [_ebb ]{case 43:goto _edcc ;case 45:goto _edcc ;};goto _eac ;_abbc :_bgcd =_ebb +1;goto _dcdd ;_dcdd :if _ebb ++;_ebb ==_eead {goto _dda ;};_acg :if _cfg [_ebb ]==101{goto _gaeg ;};goto _eac ;_gaeg :if _ebb ++;_ebb ==_eead {goto _cdee ;};_gea :if _cfg [_ebb ]==110{goto _ggcca ;};goto _fbe ;_ggcca :if _ebb ++;_ebb ==_eead {goto _deg ;};_gdad :if _cfg [_ebb ]==101{goto _cgg ;};goto _fbe ;_cgg :if _ebb ++;_ebb ==_eead {goto _dfe ;};_cece :if _cfg [_ebb ]==114{goto _bcfg ;};goto _fbe ;_bcfg :if _ebb ++;_ebb ==_eead {goto _gad ;};_beba :if _cfg [_ebb ]==97{goto _daaf ;};goto _fbe ;_daaf :if _ebb ++;_ebb ==_eead {goto _dggd ;};_dag :if _cfg [_ebb ]==108{goto _fdb ;};goto _fbe ;_cacd :_bgcd =_ebb +1;_dcb =20;goto _ddd ;_ddd :if _ebb ++;_ebb ==_eead {goto _dgdfg ;};_ebc :switch _cfg [_ebb ]{case 104:goto _bgdf ;case 109:goto _bgdf ;case 115:goto _bgdf ;};goto _gdgf ;_gdgf :if _ebb ++;_ebb ==_eead {goto _dagc ;};_ddb :if _cfg [_ebb ]==93{goto _gee ;};goto _gdgf ;_gee :_bgcd =_ebb +1;_dcb =18;goto _dbbe ;_dad :_bgcd =_ebb +1;_dcb =16;goto _dbbe ;_dbbe :if _ebb ++;_ebb ==_eead {goto _gegf ;};_adg :if _cfg [_ebb ]==93{goto _gee ;};goto _gdgf ;_bgdf :if _ebb ++;_ebb ==_eead {goto _fagc ;};_cacb :if _cfg [_ebb ]==93{goto _dad ;};goto _gdgf ;_gbd :if _ebb ++;_ebb ==_eead {goto _cgc ;};_cgfa :goto _cee ;_bggg :_bgcd =_ebb +1;_dcb =14;goto _gfae ;_gfae :if _ebb ++;_ebb ==_eead {goto _ccce ;};_ggca :switch _cfg [_ebb ]{case 47:goto _add ;case 58:goto _edcad ;case 65:goto _dde ;case 100:goto _add ;case 104:goto _edcad ;case 109:goto _bggg ;case 115:goto _bfe ;case 121:goto _gggd ;};goto _dfae ;_dab :if _ebb ++;_ebb ==_eead {goto _fdbd ;};_aedg :if _cfg [_ebb ]==121{goto _add ;};goto _eac ;_dgb :_fgfc :_cfc =34;goto _abgg ;_bdfe :_cfc =35;goto _abgg ;_gfg :_cfc =0;goto _abgg ;_bddf :_cfc =36;goto _abgg ;_agg :_cfc =37;goto _abgg ;_becb :_cfc =1;goto _abgg ;_aeef :_cfc =2;goto _abgg ;_faga :_cfc =38;goto _abgg ;_bgf :_cfc =3;goto _abgg ;_acbg :_cfc =4;goto _abgg ;_cgad :_cfc =39;goto _abgg ;_fga :_cfc =5;goto _abgg ;_gga :_cfc =6;goto _abgg ;_affb :_cfc =7;goto _abgg ;_cefc :_cfc =8;goto _abgg ;_ead :_cfc =40;goto _abgg ;_bfgf :_cfc =9;goto _abgg ;_bca :_cfc =41;goto _abgg ;_dba :_cfc =10;goto _abgg ;_gge :_cfc =42;goto _abgg ;_bcea :_cfc =11;goto _abgg ;_dcdae :_cfc =43;goto _abgg ;_fdac :_cfc =44;goto _abgg ;_gfaeb :_cfc =45;goto _abgg ;_baf :_cfc =12;goto _abgg ;_bdbd :_cfc =46;goto _abgg ;_gcd :_cfc =13;goto _abgg ;_fba :_cfc =14;goto _abgg ;_abad :_cfc =15;goto _abgg ;_cbca :_cfc =16;goto _abgg ;_ceff :_cfc =47;goto _abgg ;_cbff :_cfc =17;goto _abgg ;_efc :_cfc =48;goto _abgg ;_ebegc :_cfc =18;goto _abgg ;_bcbg :_cfc =19;goto _abgg ;_ddde :_cfc =20;goto _abgg ;_bcec :_cfc =49;goto _abgg ;_fbcg :_cfc =50;goto _abgg ;_eeaf :_cfc =21;goto _abgg ;_egd :_cfc =22;goto _abgg ;_aacb :_cfc =23;goto _abgg ;_afde :_cfc =24;goto _abgg ;_ggfc :_cfc =25;goto _abgg ;_eacd :_cfc =51;goto _abgg ;_fega :_cfc =26;goto _abgg ;_gdee :_cfc =52;goto _abgg ;_fee :_cfc =53;goto _abgg ;_cggc :_cfc =54;goto _abgg ;_fgcc :_cfc =55;goto _abgg ;_aafc :_cfc =56;goto _abgg ;_dda :_cfc =57;goto _abgg ;_cdee :_cfc =27;goto _abgg ;_deg :_cfc =28;goto _abgg ;_dfe :_cfc =29;goto _abgg ;_gad :_cfc =30;goto _abgg ;_dggd :_cfc =31;goto _abgg ;_dgdfg :_cfc =58;goto _abgg ;_dagc :_cfc =32;goto _abgg ;_gegf :_cfc =59;goto _abgg ;_fagc :_cfc =33;goto _abgg ;_cgc :_cfc =60;goto _abgg ;_ccce :_cfc =61;goto _abgg ;_fdbd :_cfc =62;goto _abgg ;_abgg :{};if _ebb ==_aefg {switch _cfc {case 35:goto _eac ;case 0:goto _abg ;case 36:goto _ebeg ;case 37:goto _bbb ;case 1:goto _abg ;case 2:goto _abg ;case 38:goto _daf ;case 3:goto _bdbc ;case 4:goto _bdbc ;case 39:goto _daf ;case 5:goto _bdbc ;case 6:goto _bdbc ;case 7:goto _bdbc ;case 8:goto _abg ;case 40:goto _daf ;case 9:goto _bdbc ;case 41:goto _daf ;case 10:goto _abg ;case 42:goto _daf ;case 11:goto _bdbc ;case 43:goto _daf ;case 44:goto _daf ;case 45:goto _daf ;case 12:goto _dga ;case 46:goto _aagc ;case 13:goto _edg ;case 14:goto _abg ;case 15:goto _abg ;case 16:goto _edg ;case 47:goto _dfae ;case 17:goto _gde ;case 48:goto _bce ;case 18:goto _bdbg ;case 19:goto _bdbg ;case 20:goto _abg ;case 49:goto _eac ;case 50:goto _gae ;case 21:goto _abg ;case 22:goto _abg ;case 23:goto _abg ;case 24:goto _abg ;case 25:goto _abg ;case 51:goto _gae ;case 26:goto _aaa ;case 52:goto _gae ;case 53:goto _gae ;case 54:goto _dbba ;case 55:goto _eac ;case 56:goto _eac ;case 57:goto _eac ;case 27:goto _fbe ;case 28:goto _fbe ;case 29:goto _fbe ;case 30:goto _fbe ;case 31:goto _fbe ;case 58:goto _eac ;case 32:goto _abg ;case 59:goto _abg ;case 33:goto _fbe ;case 60:goto _eac ;case 61:goto _dfae ;case 62:goto _eac ;};};};if _ecg > 0{copy (_cfg [0:],_cfg [_ecg :]);};};_ =_aefg ;if _cfc ==_eage {_aa .Log .Debug ("\u0066o\u0072m\u0061\u0074\u0020\u0070\u0061r\u0073\u0065 \u0065\u0072\u0072\u006f\u0072");};};func IsNumber (data string )(_ecaf bool ){_bgd ,_gdd ,_fbc :=0,0,len (data );_eff :=len (data );_dec ,_fde ,_afb :=0,0,0;_ =_fde ;_ =_afb ;_ =_dec ;{_bgd =_bda ;_dec =0;_fde =0;_afb =0;};{if _gdd ==_fbc {goto _acb ;};switch _bgd {case 0:goto _bade ;case 1:goto _bef ;case 2:goto _fcba ;case 3:goto _aagd ;case 4:goto _ccb ;case 5:goto _efa ;case 6:goto _egc ;case 7:goto _beb ;};goto _gfd ;_fcc :_fde =_gdd ;_gdd --;{_ecaf =false ;};goto _cff ;_aef :_fde =_gdd ;_gdd --;{_ecaf =_fde ==len (data );};goto _cff ;_bbe :_fde =_gdd ;_gdd --;{_ecaf =_fde ==len (data );};goto _cff ;_eeea :switch _afb {case 2:{_gdd =(_fde )-1;_ecaf =_fde ==len (data );};case 3:{_gdd =(_fde )-1;_ecaf =false ;};};goto _cff ;_cff :_dec =0;if _gdd ++;_gdd ==_fbc {goto _gfe ;};_bade :_dec =_gdd ;switch data [_gdd ]{case 43:goto _bdd ;case 45:goto _bdd ;};if 48<=data [_gdd ]&&data [_gdd ]<=57{goto _abbf ;};goto _bdf ;_bdf :if _gdd ++;_gdd ==_fbc {goto _bfg ;};_bef :goto _bdf ;_bdd :if _gdd ++;_gdd ==_fbc {goto _ddg ;};_fcba :if 48<=data [_gdd ]&&data [_gdd ]<=57{goto _abbf ;};goto _bdf ;_abbf :if _gdd ++;_gdd ==_fbc {goto _bee ;};_aagd :if data [_gdd ]==46{goto _effe ;};if 48<=data [_gdd ]&&data [_gdd ]<=57{goto _abbf ;};goto _bdf ;_effe :if _gdd ++;_gdd ==_fbc {goto _cac ;};_ccb :if 48<=data [_gdd ]&&data [_gdd ]<=57{goto _bff ;};goto _bdf ;_bff :if _gdd ++;_gdd ==_fbc {goto _cbd ;};_efa :if data [_gdd ]==69{goto _abc ;};if 48<=data [_gdd ]&&data [_gdd ]<=57{goto _bff ;};goto _bdf ;_abc :if _gdd ++;_gdd ==_fbc {goto _acfe ;};_egc :switch data [_gdd ]{case 43:goto _ebae ;case 45:goto _ebae ;};goto _bdf ;_ebae :_fde =_gdd +1;_afb =3;goto _gcge ;_cda :_fde =_gdd +1;_afb =2;goto _gcge ;_gcge :if _gdd ++;_gdd ==_fbc {goto _age ;};_beb :if 48<=data [_gdd ]&&data [_gdd ]<=57{goto _cda ;};goto _bdf ;_gfd :_gfe :_bgd =0;goto _acb ;_bfg :_bgd =1;goto _acb ;_ddg :_bgd =2;goto _acb ;_bee :_bgd =3;goto _acb ;_cac :_bgd =4;goto _acb ;_cbd :_bgd =5;goto _acb ;_acfe :_bgd =6;goto _acb ;_age :_bgd =7;goto _acb ;_acb :{};if _gdd ==_eff {switch _bgd {case 1:goto _fcc ;case 2:goto _fcc ;case 3:goto _aef ;case 4:goto _fcc ;case 5:goto _bbe ;case 6:goto _fcc ;case 7:goto _eeea ;};};};if _bgd ==_eage {return false ;};return ;};func (_fag *Lexer )nextFmt (){_fag ._cge =append (_fag ._cge ,_fag ._gbe );_fag ._gbe =Format {}};var _ba =[...]uint8 {0,14,26,41,53,67,81,94,118,135,146,157,172,183};
|
|
|
|
// Token is a format token in the Excel format string.
|
|
type Token struct{Type FmtType ;Literal byte ;DateTime string ;};func _dca (_fad ,_df float64 ,_eda Format )[]byte {if len (_eda .Fractional )==0{return nil ;};_cg :=_e .AppendFloat (nil ,_fad ,'f',-1,64);if len (_cg )> 2{_cg =_cg [2:];}else {_cg =nil ;};_af :=make ([]byte ,0,len (_cg ));_af =append (_af ,'.');_cbe :=0;_fcb :for _ggd :=0;_ggd < len (_eda .Fractional );_ggd ++{_egg :=_ggd ;_dfb :=_eda .Fractional [_ggd ];switch _dfb .Type {case FmtTypeDigit :if _egg < len (_cg ){_af =append (_af ,_cg [_egg ]);_cbe ++;}else {_af =append (_af ,'0');};case FmtTypeDigitOpt :if _egg >=0{_af =append (_af ,_cg [_egg ]);_cbe ++;}else {break _fcb ;};case FmtTypeLiteral :_af =append (_af ,_dfb .Literal );default:_aa .Log .Debug ("\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",_dfb );};};return _af ;};func Parse (s string )[]Format {_agbf :=Lexer {};_agbf .Lex (_a .NewReader (s ));_agbf ._cge =append (_agbf ._cge ,_agbf ._gbe );return _agbf ._cge ;};func _efe (_fgc float64 )string {_fed :=_e .FormatFloat (_fgc ,'E',-1,64);_ge :=_e .FormatFloat (_fgc ,'E',5,64);if len (_fed )< len (_ge ){return _e .FormatFloat (_fgc ,'E',2,64);};return _ge ;}; |