Update lexer to allow ' in numbers
Some checks failed
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Successful in 14s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Successful in 14s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Failing after 13s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Failing after 18s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Failing after 16s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Failing after 15s
Some checks failed
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Successful in 14s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Successful in 14s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Failing after 13s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Failing after 18s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Failing after 16s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Failing after 15s
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
@@ -8,6 +8,6 @@ fn lib = {
|
||||
partitions = {
|
||||
automount = [ 'boot' 'root' ]
|
||||
swap.enable = true
|
||||
swap.size = 2g
|
||||
swap.size = 2_000_000_000
|
||||
}
|
||||
}
|
||||
|
12
src/dcfg.c
12
src/dcfg.c
@@ -76,7 +76,7 @@ int64_t dcfg_strtoll(const char *s, char **end, int base)
|
||||
|
||||
size_t w = 0;
|
||||
for (size_t r = 0; r < n && s[r]; ++r)
|
||||
if (s[r] != '_')
|
||||
if (s[r] != '_' && s[r] != '\'')
|
||||
clean[w++] = s[r];
|
||||
clean[w] = '\0';
|
||||
|
||||
@@ -87,7 +87,7 @@ int64_t dcfg_strtoll(const char *s, char **end, int base)
|
||||
size_t consumed = (size_t)(tmp_end - clean);
|
||||
size_t i = 0, c = 0;
|
||||
while (i < n && c < consumed) {
|
||||
if (s[i] != '_')
|
||||
if (s[i] != '_' && s[i] != '\'')
|
||||
++c;
|
||||
++i;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ double dcfg_strtod(char const *s, char **end)
|
||||
|
||||
size_t w = 0;
|
||||
for (size_t r = 0; r < n && s[r]; ++r)
|
||||
if (s[r] != '_')
|
||||
if (s[r] != '_' && s[r] != '\'')
|
||||
clean[w++] = s[r];
|
||||
clean[w] = '\0';
|
||||
|
||||
@@ -121,7 +121,7 @@ double dcfg_strtod(char const *s, char **end)
|
||||
size_t consumed = (size_t)(tmp_end - clean);
|
||||
size_t i = 0, c = 0;
|
||||
while (i < n && c < consumed) {
|
||||
if (s[i] != '_')
|
||||
if (s[i] != '_' && s[i] != '\'')
|
||||
++c;
|
||||
++i;
|
||||
}
|
||||
@@ -573,12 +573,12 @@ static Token lex_number(Lexer *lx)
|
||||
int start = lx->offset;
|
||||
bool real = false;
|
||||
|
||||
while (isdigit_cp(lx->ch) || lx->ch == '_')
|
||||
while (isdigit_cp(lx->ch) || lx->ch == '_' || lx->ch == '\'')
|
||||
lex_advance(lx);
|
||||
if (lx->ch == '.') {
|
||||
real = true;
|
||||
lex_advance(lx);
|
||||
while (isdigit_cp(lx->ch) || lx->ch == '_')
|
||||
while (isdigit_cp(lx->ch) || lx->ch == '_' || lx->ch == '\'')
|
||||
lex_advance(lx);
|
||||
}
|
||||
return make_token(
|
||||
|
Reference in New Issue
Block a user