Skip to content

Commit eb17590

Browse files
committed
This fixes qax-os#1599, and improve date and time number format
- Fix basic arithmetic operator priority issues - Support apply date and time number format with 52 languages: Estonian, Faroese, Filipino, Finnish, Frisian, Fulah, Galician, Georgian, Greek, Greenlandic, Guarani, Gujarati, Hausa, Hawaiian, Hebrew, Hindi, Hungarian, Icelandic, Igbo, Indonesian, Inuktitut, Kannada, Kashmiri, Kazakh, Khmer, Kiche, Kinyarwanda, Kiswahili, Konkani, Kyrgyz, Lao, Latin, Latvian, Lithuanian, Luxembourgish, Macedonian, Malay, Malayalam, Maltese, Maori, Mapudungun, Marathi, Mohawk, Morocco, Nepali, Nigeria, Norwegian, Occitan, Odia, Oromo, Pashto and Syllabics - Support apply the Chinese weekdays' number formats - Update the unit test and dependencies modules
1 parent aa3c79a commit eb17590

File tree

6 files changed

+2656
-162
lines changed

6 files changed

+2656
-162
lines changed

calc.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ var (
108108
"/": 4,
109109
"+": 3,
110110
"-": 3,
111-
"=": 2,
112-
"<>": 2,
113-
"<": 2,
114-
"<=": 2,
115-
">": 2,
116-
">=": 2,
117-
"&": 1,
111+
"&": 2,
112+
"=": 1,
113+
"<>": 1,
114+
"<": 1,
115+
"<=": 1,
116+
">": 1,
117+
">=": 1,
118118
}
119119
month2num = map[string]int{
120120
"january": 1,

calc_test.go

+36-31
Original file line numberDiff line numberDiff line change
@@ -35,37 +35,42 @@ func TestCalcCellValue(t *testing.T) {
3535
{nil, nil, nil, "Feb", "South 2", 45500},
3636
}
3737
mathCalc := map[string]string{
38-
"=2^3": "8",
39-
"=1=1": "TRUE",
40-
"=1=2": "FALSE",
41-
"=1<2": "TRUE",
42-
"=3<2": "FALSE",
43-
"=1<\"-1\"": "TRUE",
44-
"=\"-1\"<1": "FALSE",
45-
"=\"-1\"<\"-2\"": "TRUE",
46-
"=2<=3": "TRUE",
47-
"=2<=1": "FALSE",
48-
"=1<=\"-1\"": "TRUE",
49-
"=\"-1\"<=1": "FALSE",
50-
"=\"-1\"<=\"-2\"": "TRUE",
51-
"=2>1": "TRUE",
52-
"=2>3": "FALSE",
53-
"=1>\"-1\"": "FALSE",
54-
"=\"-1\">-1": "TRUE",
55-
"=\"-1\">\"-2\"": "FALSE",
56-
"=2>=1": "TRUE",
57-
"=2>=3": "FALSE",
58-
"=1>=\"-1\"": "FALSE",
59-
"=\"-1\">=-1": "TRUE",
60-
"=\"-1\">=\"-2\"": "FALSE",
61-
"=1&2": "12",
62-
"=15%": "0.15",
63-
"=1+20%": "1.2",
64-
"={1}+2": "3",
65-
"=1+{2}": "3",
66-
"={1}+{2}": "3",
67-
"=\"A\"=\"A\"": "TRUE",
68-
"=\"A\"<>\"A\"": "FALSE",
38+
"=2^3": "8",
39+
"=1=1": "TRUE",
40+
"=1=2": "FALSE",
41+
"=1<2": "TRUE",
42+
"=3<2": "FALSE",
43+
"=1<\"-1\"": "TRUE",
44+
"=\"-1\"<1": "FALSE",
45+
"=\"-1\"<\"-2\"": "TRUE",
46+
"=2<=3": "TRUE",
47+
"=2<=1": "FALSE",
48+
"=1<=\"-1\"": "TRUE",
49+
"=\"-1\"<=1": "FALSE",
50+
"=\"-1\"<=\"-2\"": "TRUE",
51+
"=2>1": "TRUE",
52+
"=2>3": "FALSE",
53+
"=1>\"-1\"": "FALSE",
54+
"=\"-1\">-1": "TRUE",
55+
"=\"-1\">\"-2\"": "FALSE",
56+
"=2>=1": "TRUE",
57+
"=2>=3": "FALSE",
58+
"=1>=\"-1\"": "FALSE",
59+
"=\"-1\">=-1": "TRUE",
60+
"=\"-1\">=\"-2\"": "FALSE",
61+
"=1&2": "12",
62+
"=15%": "0.15",
63+
"=1+20%": "1.2",
64+
"={1}+2": "3",
65+
"=1+{2}": "3",
66+
"={1}+{2}": "3",
67+
"=\"A\"=\"A\"": "TRUE",
68+
"=\"A\"<>\"A\"": "FALSE",
69+
"=TRUE()&FALSE()": "TRUEFALSE",
70+
"=TRUE()&FALSE()<>FALSE": "TRUE",
71+
"=TRUE()&\"1\"": "TRUE1",
72+
"=TRUE<>FALSE()": "TRUE",
73+
"=TRUE<>1&\"x\"": "TRUE",
6974
// Engineering Functions
7075
// BESSELI
7176
"=BESSELI(4.5,1)": "15.3892227537359",

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ require (
66
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
77
github.com/richardlehane/mscfb v1.0.4
88
github.com/stretchr/testify v1.8.0
9-
github.com/xuri/efp v0.0.0-20230422071738-01f4e37c47e9
10-
github.com/xuri/nfp v0.0.0-20230730012209-aee513b45ff4
9+
github.com/xuri/efp v0.0.0-20230802181842-ad255f2331ca
10+
github.com/xuri/nfp v0.0.0-20230802015359-2d5eeba905e9
1111
golang.org/x/crypto v0.11.0
1212
golang.org/x/image v0.5.0
13-
golang.org/x/net v0.12.0
13+
golang.org/x/net v0.13.0
1414
golang.org/x/text v0.11.0
1515
)
1616

go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS
1515
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
1616
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
1717
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
18-
github.com/xuri/efp v0.0.0-20230422071738-01f4e37c47e9 h1:ge5g8vsTQclA5lXDi+PuiAFw5GMIlMHOB/5e1hsf96E=
19-
github.com/xuri/efp v0.0.0-20230422071738-01f4e37c47e9/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
20-
github.com/xuri/nfp v0.0.0-20230730012209-aee513b45ff4 h1:7TXNzvlvE0E/oLDazWm2Xip72G9Su+jRzvziSxwO6Ww=
21-
github.com/xuri/nfp v0.0.0-20230730012209-aee513b45ff4/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
18+
github.com/xuri/efp v0.0.0-20230802181842-ad255f2331ca h1:uvPMDVyP7PXMMioYdyPH+0O+Ta/UO1WFfNYMO3Wz0eg=
19+
github.com/xuri/efp v0.0.0-20230802181842-ad255f2331ca/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
20+
github.com/xuri/nfp v0.0.0-20230802015359-2d5eeba905e9 h1:jmhvNv5by7bXDzzjzBXaIWmEI4lMYfv5iJtI5Pw5/aM=
21+
github.com/xuri/nfp v0.0.0-20230802015359-2d5eeba905e9/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
2222
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
2323
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
2424
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
@@ -33,8 +33,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
3333
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
3434
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
3535
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
36-
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
37-
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
36+
golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY=
37+
golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
3838
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3939
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
4040
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

0 commit comments

Comments
 (0)