diff options
| author | bptato <nincsnevem662@gmail.com> | 2023-09-13 17:56:29 +0200 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2023-09-13 17:56:29 +0200 |
| commit | e59653db9fc83119fd4d67ab6fc0e4f5ddc9c248 (patch) | |
| tree | ddbb747fb00a2bee5a970ebe9e5b098d6dcbff19 /src | |
| parent | 2d2a2d8982865333e21836ab80bcee1feeff2854 (diff) | |
| download | chawan-e59653db9fc83119fd4d67ab6fc0e4f5ddc9c248.tar.gz | |
toml: simplify
I meant to put this in the previous commit
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/toml.nim | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/config/toml.nim b/src/config/toml.nim index 5774f597..0f68cc1f 100644 --- a/src/config/toml.nim +++ b/src/config/toml.nim @@ -366,12 +366,10 @@ proc consumeNumber(state: var TomlParser, c: char): TomlResult = state.reconsume() repr &= c else: + if c in {'+', '-'} and (not state.has() or not isDigit(state.peek(0))): + return state.err("invalid number") repr &= c - if repr.len > 0 and repr[0] in {'+', '-'} and - (not state.has() or not isDigit(state.peek(0))): - return state.err("invalid number") - var was_num = true while state.has(): if isDigit(state.peek(0)): |