Hash :
f1843fc1
Author :
Thomas de Grivel
Date :
2022-01-03T14:06:48
quote
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
/*
* kv - key value text file format
*
* Copyright 2022 Thomas de Grivel
*/
#include "kv.h"
int kv_is_quotable_char (int c)
{
switch (c) {
case '"':
case '\\':
case '\n':
case '\r':
case '\t':
case '\v':
return 1;
default:
return 0;
}
return 0;
}
int kv_is_reserved_char (int c)
{
switch (c) {
case 0:
case '"':
case ',':
case ':':
case '{':
case '}':
return 1;
default:
return kv_is_space(c);
}
return 0;
}
int kv_is_space (int c)
{
switch (c) {
case ' ':
case '\n':
case '\r':
case '\t':
case '\v':
return 1;
default:
return 0;
}
return 0;
}