Skip to content

Commit

Permalink
reject invalid number syntax like 1e*1
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Aug 9, 2020
1 parent 48b2b53 commit 4f22451
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions cli/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
expected: |
128
- name: number query
args:
- '0, 128, 3.14, 1.2e3, 1E+3, 1E-9'
input: 0
expected: |
0
128
3.14
1200
1000
1e-9
- name: string
args:
- '.'
Expand Down
2 changes: 1 addition & 1 deletion lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func (l *lexer) scanNumber(state int) int {
l.offset++
return -l.offset
}
if state == numberStateExpLead && len(l.source) == l.offset {
if state == numberStateExpLead {
return -l.offset
}
return l.offset
Expand Down

0 comments on commit 4f22451

Please sign in to comment.