27 lines
642 B
C
27 lines
642 B
C
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "toml_internal.h"
|
|
|
|
Result(void) toml_parse_bare_key(TomlParser* self, str* s_out)
|
|
{
|
|
Deferral(1);
|
|
|
|
cstr s = self->ptr;
|
|
u64 len = 0;
|
|
|
|
while (self->ptr < self->end) {
|
|
char ch = *self->ptr;
|
|
|
|
if (!(isalnum(ch) || ch == '_' || ch == '-'))
|
|
break;
|
|
|
|
len++;
|
|
toml_move_next(self);
|
|
}
|
|
|
|
*s_out = str_copy(str_construct((void*)s, len, false));
|
|
Return RESULT_VOID;
|
|
}
|