Implement a simple config file parser

This commit is contained in:
TennesseeTrash 2025-06-09 01:41:33 +02:00
parent 405b68b824
commit 167b8bee8d
20 changed files with 601 additions and 0 deletions

View file

@ -0,0 +1,12 @@
# First, we wanna test if it can even do the basics
an int = 123456
a float = 3.5
a long (8B) = 121212121212121212
a double = 0.0000128
# Now we want to see if it correctly blows up
an incorrect char = 256
unsigned = -34
signed, but large = 3000000000
mangled float = 3.f4
mangled float 2 = 2.4f

View file

@ -0,0 +1,4 @@
# Test whether comments behave correctly
# this shouldn't = be accessible
while this = is accessible # and this comment doesn't interfere

View file

@ -0,0 +1,3 @@
# Another example of an empty config
# The config should initialize successfully,
# but there should be no kv-pairs inside it

View file

View file

@ -0,0 +1,2 @@
# This probably doesn't need to exist, but eh
existing key = existing value

View file

@ -0,0 +1,10 @@
# A simple config file that
normal_key=normal_value
another_key=another_value
generic=generic
another_one=another_value
= oh no, an empty key
another_one=...
# It doesn't really matter what's here, because the parser won't reach it

View file

@ -0,0 +1,8 @@
# A simple config file that contains a # character inside the key
normal_key=normal_value
another_key=another_value
a_very_bas#ic_key=generic_value
another_one=...
# It doesn't really matter what's here, because the parser won't reach it

View file

@ -0,0 +1,10 @@
# A simple config file that
normal_key=normal_value
another_key=another_value
generic=generic
another_one=another_value
another_one=...
# It doesn't really matter what's here, because the parser won't reach it
sneaky_key

View file

@ -0,0 +1,4 @@
# A simple config
that appears = correct
but it = has = an invalid line # Should blow up here
another=pair

View file

@ -0,0 +1,10 @@
# A simple config file that contains only the key on a single line
normal_key=normal_value
another_key=another_value
generic=generic
another_one=another_value
a_very_basic_key
another_one=...
# It doesn't really matter what's here, because the parser won't reach it