format: fix vet errors with generated function

This commit is contained in:
Todd 2017-09-18 23:21:06 -04:00
parent b30eaaae44
commit 32bc9e3a50
2 changed files with 18 additions and 17 deletions

View File

@ -17,7 +17,7 @@ const isnumber_error int = -1
const isnumber_en_main int = 0 const isnumber_en_main int = 0
//line isnumber.rl:27 //line isnumber.rl:27
func IsNumber(data string) bool { func IsNumber(data string) (isNumber bool) {
cs, p, pe := 0, 0, len(data) cs, p, pe := 0, 0, len(data)
eof := len(data) eof := len(data)
ts, te, act := 0, 0, 0 ts, te, act := 0, 0, 0
@ -25,7 +25,7 @@ func IsNumber(data string) bool {
_ = act _ = act
_ = ts _ = ts
//line isnumber.go:37 //line isnumber.go:38
{ {
cs = isnumber_start cs = isnumber_start
ts = 0 ts = 0
@ -33,7 +33,7 @@ func IsNumber(data string) bool {
act = 0 act = 0
} }
//line isnumber.go:45 //line isnumber.go:46
{ {
if p == pe { if p == pe {
goto _test_eof goto _test_eof
@ -62,7 +62,7 @@ func IsNumber(data string) bool {
te = p te = p
p-- p--
{ {
return false isNumber = false
} }
goto st0 goto st0
tr4: tr4:
@ -70,7 +70,7 @@ func IsNumber(data string) bool {
te = p te = p
p-- p--
{ {
return te == len(data) isNumber = te == len(data)
} }
goto st0 goto st0
tr7: tr7:
@ -78,7 +78,7 @@ func IsNumber(data string) bool {
te = p te = p
p-- p--
{ {
return te == len(data) isNumber = te == len(data)
} }
goto st0 goto st0
tr10: tr10:
@ -87,12 +87,12 @@ func IsNumber(data string) bool {
case 2: case 2:
{ {
p = (te) - 1 p = (te) - 1
return te == len(data) isNumber = te == len(data)
} }
case 3: case 3:
{ {
p = (te) - 1 p = (te) - 1
return false isNumber = false
} }
} }
@ -108,7 +108,7 @@ func IsNumber(data string) bool {
//line NONE:1 //line NONE:1
ts = p ts = p
//line isnumber.go:110 //line isnumber.go:111
switch data[p] { switch data[p] {
case 43: case 43:
goto st2 goto st2
@ -198,7 +198,7 @@ func IsNumber(data string) bool {
goto _test_eof7 goto _test_eof7
} }
st_case_7: st_case_7:
//line isnumber.go:200 //line isnumber.go:201
if 48 <= data[p] && data[p] <= 57 { if 48 <= data[p] && data[p] <= 57 {
goto tr11 goto tr11
} }
@ -253,9 +253,9 @@ func IsNumber(data string) bool {
} }
//line isnumber.rl:39 //line isnumber.rl:40
if cs == format_error { if cs == format_error {
return false return false
} }
return false return
} }

View File

@ -20,12 +20,12 @@ import (
float = sign? [0-9]+ '.' [0-9]+ ('E' sign [0-9]+)?; float = sign? [0-9]+ '.' [0-9]+ ('E' sign [0-9]+)?;
main := |* main := |*
integer => { return te == len(data); }; integer => { isNumber = te == len(data); };
float => { return te == len(data); }; float => { isNumber = te == len(data); };
any* => { return false; }; any* => { isNumber = false; };
*|; *|;
}%% }%%
func IsNumber(data string) bool { func IsNumber(data string) (isNumber bool) {
cs, p, pe := 0, 0, len(data) cs, p, pe := 0, 0, len(data)
eof := len(data) eof := len(data)
ts, te,act := 0,0,0 ts, te,act := 0,0,0
@ -33,6 +33,7 @@ func IsNumber(data string) bool {
_ = act _ = act
_ = ts _ = ts
%%{ %%{
write init; write init;
write exec; write exec;
@ -40,5 +41,5 @@ func IsNumber(data string) bool {
if cs == format_error { if cs == format_error {
return false return false
} }
return false return
} }