Skip to content

Commit

Permalink
Make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mattverse committed Mar 7, 2024
1 parent c4e1abe commit 1a87ce7
Showing 1 changed file with 127 additions and 137 deletions.
264 changes: 127 additions & 137 deletions types/coin_regex.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

//line coin_regex.rl:1
// `coin_regex.go` is generated by regel using `ragel -Z coin_regex.rl`.
// do not directly edit `coin_regex.go`.
// source: types/coin_regex.rl
// nolint:gocritic,unused,ineffassign


// Regex parsing of denoms were as the following
// reDnmString = `[a-zA-Z][a-zA-Z0-9/:._-]{2,127}`
// reDecAmt = `[[:digit:]]+(?:\.[[:digit:]]+)?|\.[[:digit:]]+`
Expand All @@ -17,167 +15,159 @@
package types

func MatchDenom(data []byte) bool {
var _scanner_actions []byte = []byte{
0, 1, 0,
}

//line coin_regex.rl:19

//line coin_regex.go:24
var _scanner_actions []byte = []byte{
0, 1, 0,
}

var _scanner_key_offsets []byte = []byte{
0, 0, 4, 11,
}

var _scanner_trans_keys []byte = []byte{
65, 90, 97, 122, 95, 45, 58, 65,
90, 97, 122,
}

var _scanner_single_lengths []byte = []byte{
0, 0, 1, 0,
}
var _scanner_key_offsets []byte = []byte{
0, 0, 4, 11,
}

var _scanner_range_lengths []byte = []byte{
0, 2, 3, 0,
}
var _scanner_trans_keys []byte = []byte{
65, 90, 97, 122, 95, 45, 58, 65,
90, 97, 122,
}

var _scanner_index_offsets []byte = []byte{
0, 0, 3, 8,
}
var _scanner_single_lengths []byte = []byte{
0, 0, 1, 0,
}

var _scanner_indicies []byte = []byte{
0, 0, 1, 2, 2, 2, 2, 1,
1,
}
var _scanner_range_lengths []byte = []byte{
0, 2, 3, 0,
}

var _scanner_trans_targs []byte = []byte{
2, 0, 3,
}
var _scanner_index_offsets []byte = []byte{
0, 0, 3, 8,
}

var _scanner_trans_actions []byte = []byte{
0, 0, 1,
}
var _scanner_indicies []byte = []byte{
0, 0, 1, 2, 2, 2, 2, 1,
1,
}

const scanner_start int = 1
const scanner_first_final int = 3
const scanner_error int = 0
var _scanner_trans_targs []byte = []byte{
2, 0, 3,
}

const scanner_en_main int = 1
var _scanner_trans_actions []byte = []byte{
0, 0, 1,
}

const scanner_start int = 1
const scanner_first_final int = 3

Check failure on line 57 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / golangci-lint

const `scanner_first_final` is unused (unused)

Check failure on line 57 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / Analyze

const `scanner_first_final` is unused (unused)
const scanner_error int = 0

Check failure on line 58 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / golangci-lint

const `scanner_error` is unused (unused)

Check failure on line 58 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / Analyze

const `scanner_error` is unused (unused)

//line coin_regex.rl:20
const scanner_en_main int = 1

Check failure on line 60 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / golangci-lint

const `scanner_en_main` is unused (unused)

Check failure on line 60 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / Analyze

const `scanner_en_main` is unused (unused)

if len(data) < 3 || len(data) > 128 {
return false
}
cs, p, pe, eof := 0, 0, len(data), len(data)
_ = eof

//line coin_regex.go:78
{
cs = scanner_start
if len(data) < 3 || len(data) > 128 {
return false
}
cs, p, pe, eof := 0, 0, len(data), len(data)
_ = eof

//line coin_regex.go:83
{
var _klen int
var _trans int
var _acts int
var _nacts uint
var _keys int
if p == pe {
goto _test_eof
}
if cs == 0 {
goto _out
cs = scanner_start
}
_resume:
_keys = int(_scanner_key_offsets[cs])
_trans = int(_scanner_index_offsets[cs])

_klen = int(_scanner_single_lengths[cs])
if _klen > 0 {
_lower := int(_keys)
var _mid int
_upper := int(_keys + _klen - 1)
for {
if _upper < _lower {
break
}

_mid = _lower + ((_upper - _lower) >> 1)
switch {
case data[p] < _scanner_trans_keys[_mid]:
_upper = _mid - 1
case data[p] > _scanner_trans_keys[_mid]:
_lower = _mid + 1
default:
_trans += int(_mid - int(_keys))
goto _match
}
{
var _klen int
var _trans int
var _acts int
var _nacts uint
var _keys int
if p == pe {
goto _test_eof
}
_keys += _klen
_trans += _klen
}

_klen = int(_scanner_range_lengths[cs])
if _klen > 0 {
_lower := int(_keys)
var _mid int
_upper := int(_keys + (_klen << 1) - 2)
for {
if _upper < _lower {
break
if cs == 0 {
goto _out
}
_resume:
_keys = int(_scanner_key_offsets[cs])
_trans = int(_scanner_index_offsets[cs])

_klen = int(_scanner_single_lengths[cs])
if _klen > 0 {
_lower := int(_keys)

Check failure on line 90 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary conversion (unconvert)

Check failure on line 90 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / Analyze

unnecessary conversion (unconvert)
var _mid int
_upper := int(_keys + _klen - 1)

Check failure on line 92 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary conversion (unconvert)

Check failure on line 92 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / Analyze

unnecessary conversion (unconvert)
for {
if _upper < _lower {
break
}

_mid = _lower + ((_upper - _lower) >> 1)
switch {
case data[p] < _scanner_trans_keys[_mid]:
_upper = _mid - 1
case data[p] > _scanner_trans_keys[_mid]:
_lower = _mid + 1
default:
_trans += int(_mid - int(_keys))

Check failure on line 105 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary conversion (unconvert)

Check failure on line 105 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / Analyze

unnecessary conversion (unconvert)
goto _match
}
}
_keys += _klen
_trans += _klen
}

_mid = _lower + (((_upper - _lower) >> 1) & ^1)
switch {
case data[p] < _scanner_trans_keys[_mid]:
_upper = _mid - 2
case data[p] > _scanner_trans_keys[_mid + 1]:
_lower = _mid + 2
default:
_trans += int((_mid - int(_keys)) >> 1)
goto _match
_klen = int(_scanner_range_lengths[cs])
if _klen > 0 {
_lower := int(_keys)

Check failure on line 115 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary conversion (unconvert)

Check failure on line 115 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / Analyze

unnecessary conversion (unconvert)
var _mid int
_upper := int(_keys + (_klen << 1) - 2)

Check failure on line 117 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary conversion (unconvert)

Check failure on line 117 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / Analyze

unnecessary conversion (unconvert)
for {
if _upper < _lower {
break
}

_mid = _lower + (((_upper - _lower) >> 1) & ^1)
switch {
case data[p] < _scanner_trans_keys[_mid]:
_upper = _mid - 2
case data[p] > _scanner_trans_keys[_mid+1]:
_lower = _mid + 2
default:
_trans += int((_mid - int(_keys)) >> 1)

Check failure on line 130 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary conversion (unconvert)

Check failure on line 130 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / Analyze

unnecessary conversion (unconvert)
goto _match
}
}
_trans += _klen
}
_trans += _klen
}

_match:
_trans = int(_scanner_indicies[_trans])
cs = int(_scanner_trans_targs[_trans])
_match:
_trans = int(_scanner_indicies[_trans])
cs = int(_scanner_trans_targs[_trans])

if _scanner_trans_actions[_trans] == 0 {
goto _again
}
if _scanner_trans_actions[_trans] == 0 {
goto _again
}

_acts = int(_scanner_trans_actions[_trans])
_nacts = uint(_scanner_actions[_acts]); _acts++
for ; _nacts > 0; _nacts-- {
_acts = int(_scanner_trans_actions[_trans])
_nacts = uint(_scanner_actions[_acts])
_acts++
switch _scanner_actions[_acts-1] {
case 0:
//line coin_regex.rl:34
return true
//line coin_regex.go:165
for ; _nacts > 0; _nacts-- {
_acts++
switch _scanner_actions[_acts-1] {

Check failure on line 150 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / golangci-lint

singleCaseSwitch: should rewrite switch statement to if statement (gocritic)

Check failure on line 150 in types/coin_regex.go

View workflow job for this annotation

GitHub Actions / Analyze

singleCaseSwitch: should rewrite switch statement to if statement (gocritic)
case 0:
return true
}
}
}

_again:
if cs == 0 {
goto _out
}
p++
if p != pe {
goto _resume
}
_test_eof: {}
_out: {}
_again:
if cs == 0 {
goto _out
}
p++
if p != pe {
goto _resume
}
_test_eof:
{
}
_out:
{
}
}

//line coin_regex.rl:38

return false
}
return false
}

0 comments on commit 1a87ce7

Please sign in to comment.