Skip to content

Commit

Permalink
Treaet data-file numbers with leading + as numeric (#1269)
Browse files Browse the repository at this point in the history
* accept data-file numbers with leading + as numeric

* augment unit-test cases

* artifacts from `make dev`
  • Loading branch information
johnkerl committed Apr 15, 2023
1 parent 209cc68 commit b8f3902
Show file tree
Hide file tree
Showing 118 changed files with 459 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/src/manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -3354,5 +3354,5 @@ MILLER(1) MILLER(1)



2023-03-27 MILLER(1)
2023-04-15 MILLER(1)
</pre>
2 changes: 1 addition & 1 deletion docs/src/manpage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3333,4 +3333,4 @@ MILLER(1) MILLER(1)



2023-03-27 MILLER(1)
2023-04-15 MILLER(1)
2 changes: 1 addition & 1 deletion docs/src/reference-dsl-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Regardless, if you specify an invalid timezone, you'll be clearly notified:
<b>mlr --from example.csv --tz This/Is/A/Typo cat</b>
</pre>
<pre class="pre-non-highlight-in-pair">
mlr : unknown time zone This/Is/A/Typo
mlr: TZ environment variable appears malformed: "This/Is/A/Typo"
</pre>

<pre class="pre-highlight-in-pair">
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/mlrval/mlrval_infer.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ func inferHexInt(mv *Mlrval) *Mlrval {
if mv.printrep[0] == '-' {
input = mv.printrep[3:]
negate = true
} else if mv.printrep[0] == '+' {
input = mv.printrep[3:]
negate = false
} else {
input = mv.printrep[2:]
negate = false
Expand Down Expand Up @@ -207,6 +210,9 @@ func inferBaseInt(mv *Mlrval, base int) *Mlrval {
if mv.printrep[0] == '-' {
input = mv.printrep[3:]
negate = true
} else if mv.printrep[0] == '+' {
input = mv.printrep[3:]
negate = false
} else {
input = mv.printrep[2:]
negate = false
Expand Down
3 changes: 3 additions & 0 deletions internal/pkg/scan/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func FindScanType(sinput string) ScanType {
if i0 == '-' {
return findScanTypePositiveNumberOrString(input[1:])
}
if i0 == '+' {
return findScanTypePositiveNumberOrString(input[1:])
}
if i0 >= '0' && i0 <= '9' {
return findScanTypePositiveNumberOrString(input)
}
Expand Down
2 changes: 1 addition & 1 deletion man/manpage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3333,4 +3333,4 @@ MILLER(1) MILLER(1)



2023-03-27 MILLER(1)
2023-04-15 MILLER(1)
4 changes: 2 additions & 2 deletions man/mlr.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: mlr
.\" Author: [see the "AUTHOR" section]
.\" Generator: ./mkman.rb
.\" Date: 2023-03-27
.\" Date: 2023-04-15
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MILLER" "1" "2023-03-27" "\ \&" "\ \&"
.TH "MILLER" "1" "2023-04-15" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Portability definitions
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0001/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot 7.12000000
iquot 7.00000000
mod 1.20000000
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0002/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot 7.50000000
iquot 7
mod 5
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0003/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot -7.12000000
iquot -8.00000000
mod 8.80000000
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0004/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot -7.50000000
iquot -8
mod 5
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0005/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot 7.12000000
iquot 7.00000000
mod 1.20000000
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0006/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot 7.50000000
iquot 7
mod 5
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0007/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot -7.12000000
iquot -8.00000000
mod 8.80000000
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0008/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot -7.50000000
iquot -8
mod 5
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0009/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot -7.12000000
iquot -8.00000000
mod -8.80000000
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0010/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot -7.50000000
iquot -8
mod -5
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0011/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot 7.12000000
iquot 7.00000000
mod -1.20000000
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0012/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot 7.50000000
iquot 7
mod -5
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0013/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot -7.12000000
iquot -8.00000000
mod -8.80000000
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0014/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot -7.50000000
iquot -8
mod -5
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0015/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot 7.12000000
iquot 7.00000000
mod -1.20000000
4 changes: 4 additions & 0 deletions test/cases/dsl-pythonic-division/0016/expout
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
quot 7.50000000
iquot 7
mod -5
4 changes: 4 additions & 0 deletions test/cases/dsl-type-inference/0001/expout
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
y 151
4 changes: 4 additions & 0 deletions test/cases/dsl-type-inference/0002/expout
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
pf1 71.20000000
nf1 -71.20000000
tf1 71.20000000
zf 0.00000000
pf2 73.40000000
nf2 -73.40000000
tf2 73.40000000
pi1 75
ni1 -75
ti1 +75
zi 0
pi2 76
ni2 -76
ti2 +76
Loading

0 comments on commit b8f3902

Please sign in to comment.