diff options
author | bptato <nincsnevem662@gmail.com> | 2024-09-21 19:36:00 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-09-21 19:36:00 +0200 |
commit | e17f81396cdd323de1f5ee7b2541699ede97f95d (patch) | |
tree | 987553aec39f883ac05d535280631770d1a1e502 /src/config | |
parent | 3b3b2a9afd41c64e45c3ab59afd6b0bb49458173 (diff) | |
download | chawan-e17f81396cdd323de1f5ee7b2541699ede97f95d.tar.gz |
toml: fix casing
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/toml.nim | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/config/toml.nim b/src/config/toml.nim index 2978585c..20dbfbe5 100644 --- a/src/config/toml.nim +++ b/src/config/toml.nim @@ -387,17 +387,17 @@ proc consumeNoState(state: var TomlParser): Result[bool, TomlError] = return state.err("unexpected end of file") type ParsedNumberType = enum - NUMBER_INTEGER, NUMBER_FLOAT, NUMBER_HEX, NUMBER_OCT + pntInteger, pntFloat, pntHex, pntOct proc consumeNumber(state: var TomlParser; c: char): TomlResult = var repr = "" - var numType = NUMBER_INTEGER + var numType = pntInteger if c == '0' and state.has(): let c = state.consume() if c == 'x': - numType = NUMBER_HEX + numType = pntHex elif c == 'o': - numType = NUMBER_OCT + numType = pntOct else: state.reconsume() repr &= c @@ -418,15 +418,15 @@ proc consumeNumber(state: var TomlParser; c: char): TomlResult = if state.has(1) and state.peek(0) == '.' and state.peek(1) in AsciiDigit: repr &= state.consume() repr &= state.consume() - if numType notin {NUMBER_INTEGER, NUMBER_FLOAT}: + if numType notin {pntInteger, pntFloat}: return state.err("invalid floating point number") - numType = NUMBER_FLOAT + numType = pntFloat while state.has() and state.peek(0) in AsciiDigit: repr &= state.consume() if state.has(1) and state.peek(0) in {'E', 'e'}: - if numType notin {NUMBER_INTEGER, NUMBER_FLOAT}: + if numType notin {pntInteger, pntFloat}: return state.err("invalid floating point number") - numType = NUMBER_FLOAT + numType = pntFloat var j = 2 if state.peek(1) == '-' or state.peek(1) == '+': inc j @@ -437,22 +437,22 @@ proc consumeNumber(state: var TomlParser; c: char): TomlResult = while state.has() and state.peek(0) in AsciiDigit: repr &= state.consume() case numType - of NUMBER_INTEGER: + of pntInteger: let val = parseInt64(repr) if val.isNone: return state.err("invalid integer") return ok(TomlValue(t: tvtInteger, i: val.get)) - of NUMBER_HEX: + of pntHex: let val = parseHexInt64(repr) if val.isNone: return state.err("invalid hexadecimal number") return ok(TomlValue(t: tvtInteger, i: val.get)) - of NUMBER_OCT: + of pntOct: let val = parseOctInt64(repr) if val.isNone: return state.err("invalid octal number") return ok(TomlValue(t: tvtInteger, i: val.get)) - of NUMBER_FLOAT: + of pntFloat: let val = parseFloat64(repr) return ok(TomlValue(t: tvtFloat, f: val)) |