Merge pull request #223 from fe-dagostino/fix_escaping

add \a \b \v for correct escaping
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a797610..61c1e59 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 3.1)
 
 # Extract version from configure.ac.
-set(VERSION_REGEX "^AC_INIT\\(libconfig,[ \t]+([0-9.]+),.*")
+set(VERSION_REGEX "^AC_INIT\\(\\[libconfig\\],[ \t]*\\[([0-9.]+)\\],.*")
 file(STRINGS "configure.ac"
   VERSION_STRING REGEX ${VERSION_REGEX})
 string(REGEX REPLACE ${VERSION_REGEX} "\\1" VERSION_STRING "${VERSION_STRING}")
diff --git a/ChangeLog b/ChangeLog
index 6e4b809..99a11a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+----- version 1.7.4 ------
+
+2022-11-22  Mark Lindner  <markl@neuromancer>
+
+	* <multiple> - Many bugfixes, including:
+	  - Handle malloc failures by calling a fatal error handler
+	  - New API to provide alternative fatal error handler
+	  - Bugfixes to lookup (by name or path) routines
+	  - Bugfixes to APIs with inconsistent const-ness
+	  - Bugfixes to APIs with inconsistent use of short/unsigned short
+	  - Bugfixes to int/int64 auto-conversion
+	  - Various cleanup/fixes to build files
+	  - Added some unit tests
 
 ----- version 1.7.3 ------
 
diff --git a/Makefile.am b/Makefile.am
index 684608d..2b3f70c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,7 +40,8 @@
 	debian/shlibs \
 	debian/watch \
 	libconfig.spec \
-	contrib
+	contrib \
+	CMakeLists.txt
 
 dist-hook:
 	rm -rf `find $(distdir)/contrib -name .svn`
diff --git a/README b/README
index 5aef293..7097f56 100644
--- a/README
+++ b/README
@@ -10,7 +10,7 @@
 
 				 -*-
 
-The `examples' subdirectory contains some examples of using libconfig
+The `examples' subdirectory contains some examples of how to use libconfig
 from C and C++.
 
 				 -*-
diff --git a/ac_config.h.in b/ac_config.h.in
index 6244938..33d48bd 100644
--- a/ac_config.h.in
+++ b/ac_config.h.in
@@ -9,8 +9,8 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
+/* Define to 1 if you have the <minix/config.h> header file. */
+#undef HAVE_MINIX_CONFIG_H
 
 /* Define to 1 if you have the `newlocale' function. */
 #undef HAVE_NEWLOCALE
@@ -18,6 +18,9 @@
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
+/* Define to 1 if you have the <stdio.h> header file. */
+#undef HAVE_STDIO_H
+
 /* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
@@ -39,6 +42,9 @@
 /* Define to 1 if you have the `uselocale' function. */
 #undef HAVE_USELOCALE
 
+/* Define to 1 if you have the <wchar.h> header file. */
+#undef HAVE_WCHAR_H
+
 /* Define to 1 if you have the <xlocale.h> header file. */
 #undef HAVE_XLOCALE_H
 
@@ -67,7 +73,9 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* Define to 1 if you have the ANSI C header files. */
+/* Define to 1 if all of the C90 standard headers exist (not just the ones
+   required in a freestanding environment). This macro is provided for
+   backward compatibility; new code need not use it. */
 #undef STDC_HEADERS
 
 /* Configured target name. */
@@ -77,21 +85,87 @@
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
+/* Enable general extensions on macOS.  */
+#ifndef _DARWIN_C_SOURCE
+# undef _DARWIN_C_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
 /* Enable GNU extensions on systems that have them.  */
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
 #endif
-/* Enable threading extensions on Solaris.  */
+/* Enable X/Open compliant socket functions that do not require linking
+   with -lxnet on HP-UX 11.11.  */
+#ifndef _HPUX_ALT_XOPEN_SOCKET_API
+# undef _HPUX_ALT_XOPEN_SOCKET_API
+#endif
+/* Identify the host operating system as Minix.
+   This macro does not affect the system headers' behavior.
+   A future release of Autoconf may stop defining this macro.  */
+#ifndef _MINIX
+# undef _MINIX
+#endif
+/* Enable general extensions on NetBSD.
+   Enable NetBSD compatibility extensions on Minix.  */
+#ifndef _NETBSD_SOURCE
+# undef _NETBSD_SOURCE
+#endif
+/* Enable OpenBSD compatibility extensions on NetBSD.
+   Oddly enough, this does nothing on OpenBSD.  */
+#ifndef _OPENBSD_SOURCE
+# undef _OPENBSD_SOURCE
+#endif
+/* Define to 1 if needed for POSIX-compatible behavior.  */
+#ifndef _POSIX_SOURCE
+# undef _POSIX_SOURCE
+#endif
+/* Define to 2 if needed for POSIX-compatible behavior.  */
+#ifndef _POSIX_1_SOURCE
+# undef _POSIX_1_SOURCE
+#endif
+/* Enable POSIX-compatible threading on Solaris.  */
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
 #endif
+/* Enable extensions specified by ISO/IEC TS 18661-5:2014.  */
+#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-1:2014.  */
+#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
+# undef __STDC_WANT_IEC_60559_BFP_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-2:2015.  */
+#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
+# undef __STDC_WANT_IEC_60559_DFP_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-4:2015.  */
+#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
+# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TS 18661-3:2015.  */
+#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
+# undef __STDC_WANT_IEC_60559_TYPES_EXT__
+#endif
+/* Enable extensions specified by ISO/IEC TR 24731-2:2010.  */
+#ifndef __STDC_WANT_LIB_EXT2__
+# undef __STDC_WANT_LIB_EXT2__
+#endif
+/* Enable extensions specified by ISO/IEC 24747:2009.  */
+#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
+# undef __STDC_WANT_MATH_SPEC_FUNCS__
+#endif
 /* Enable extensions on HP NonStop.  */
 #ifndef _TANDEM_SOURCE
 # undef _TANDEM_SOURCE
 #endif
-/* Enable general extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
+/* Enable X/Open extensions.  Define to 500 only if necessary
+   to make mbstate_t available.  */
+#ifndef _XOPEN_SOURCE
+# undef _XOPEN_SOURCE
 #endif
 
 
@@ -102,15 +176,5 @@
    `char[]'. */
 #undef YYTEXT_POINTER
 
-/* Define to 1 if on MINIX. */
-#undef _MINIX
-
-/* Define to 2 if the system does not provide POSIX.1 features except with
-   this defined. */
-#undef _POSIX_1_SOURCE
-
-/* Define to 1 if you need to in order for `stat' and other things to work. */
-#undef _POSIX_SOURCE
-
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
diff --git a/conanfile.py b/conanfile.py
index 16c4477..00d23bf 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -27,7 +27,7 @@
 
     def set_version(self):
         configure_ac = tools.load(os.path.join(self.recipe_folder, "configure.ac"))
-        self.version = next(re.finditer(r"AC_INIT\(libconfig,[ \t]+([0-9.]+),.*", configure_ac)).group(1)
+        self.version = next(re.finditer(r"AC_INIT\(\[libconfig\],[ \t]*\[([0-9.]+)\],.*", configure_ac)).group(1)
 
     def config_options(self):
         if self.settings.os == "Windows":
@@ -67,4 +67,4 @@
             self.cpp_info.components["libconfig_cpp"].defines = ["LIBCONFIGXX_STATIC"]
         self.cpp_info.components["libconfig_cpp"].names["cmake_find_package"] = ["libconfig++"]
         self.cpp_info.components["libconfig_cpp"].names["cmake_find_package_multi"] = ["libconfig++"]
-        self.cpp_info.components["libconfig_cpp"].names["pg_config"] = "libconfig++"
\ No newline at end of file
+        self.cpp_info.components["libconfig_cpp"].names["pg_config"] = "libconfig++"
diff --git a/configure.ac b/configure.ac
index 6181ba5..86c3a38 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT(libconfig, 1.7.3, hyperrealm@gmail.com, libconfig,
-	[https://hyperrealm.github.io/libconfig/])
+AC_INIT([libconfig],[1.7.4],[hyperrealm@gmail.com],[libconfig],
+        [https://hyperrealm.github.io/libconfig/])
 AC_CONFIG_AUX_DIR([aux-build])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CANONICAL_TARGET
@@ -16,18 +16,16 @@
 AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
 
 # Enable GNU extensions.
-AC_GNU_SOURCE
+AC_USE_SYSTEM_EXTENSIONS
 
-LT_INIT()
+LT_INIT(win32-dll)
 
 dnl Checks for programs.
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX
-AC_LIBTOOL_WIN32_DLL
-AC_PROG_LIBTOOL
 
-AM_PROG_LEX
+AM_PROG_LEX(noyywrap)
 if test Z"$LEX" != Zflex; then
 cat <<EOF
 *******************************************************************
@@ -38,7 +36,7 @@
 EOF
 fi
 
-AC_PROG_YACC
+AC_PROG_YACC(noyywrap)
 if test Z"$YACC" != "Zbison -y"; then
 cat <<EOF
 *******************************************************************
@@ -75,7 +73,8 @@
 
 
 dnl Checks for header files.
-AC_HEADER_STDC
+AC_CHECK_INCLUDES_DEFAULT
+
 AC_CHECK_HEADERS(unistd.h stdint.h xlocale.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
@@ -146,8 +145,7 @@
 
 dnl Checks for library functions.
 
-AC_OUTPUT(
-	Makefile
+AC_CONFIG_FILES([Makefile
 	lib/Makefile
 	lib/libconfig.pc
 	lib/libconfig++.pc
@@ -160,4 +158,5 @@
 	tinytest/Makefile
 	tests/Makefile
 	libconfig.spec
-	)
+	])
+AC_OUTPUT
diff --git a/debian/copyright b/debian/copyright
index 94a3ec2..4cb34b0 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -11,7 +11,7 @@
 	Jose Luis Tallon - Enhancements, bugfixes
 
 
-Copyright:	Copyright (C) 2005-2015  Mark A Lindner
+Copyright:	Copyright (C) 2005-2023  Mark A Lindner
 
 License:	LGPL-2.1
 
diff --git a/doc/libconfig.texi b/doc/libconfig.texi
index e12e82f..97f8501 100644
--- a/doc/libconfig.texi
+++ b/doc/libconfig.texi
@@ -6,8 +6,8 @@
 @setfilename libconfig.info
 @settitle libconfig
 
-@set edition 1.7.3
-@set update-date 20 Jun 2021
+@set edition 1.7.4
+@set update-date 22 Nov 2022
 @set subtitle-text A Library For Processing Structured Configuration Files
 @set author-text Mark A.@: Lindner
 
@@ -38,7 +38,7 @@
 
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 2004-2021  Mark A Lindner
+Copyright @copyright{} 2004-2023  Mark A Lindner
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -800,6 +800,42 @@
 
 @end deftypefun
 
+@deftypefun void config_set_fatal_error_func (@w{config_fatal_error_fn_t @var{func}})
+
+@b{Since @i{v1.7.4}}
+
+@cindex fatal error
+Specifies the function @var{func} to call when a fatal error is encountered.
+If @var{func} is @code{NULL}, the default fatal error handler function will
+be reinstated.
+
+@tindex config_fatal_error_fn_t
+The type @i{config_fatal_error_fn_t} is a type alias
+for a function whose signature is:
+
+@deftypefun @w{void} func (@w{const char *@var{message}})
+
+The function receives an error message @var{message}. The function is
+not expected to return to the caller; if it does, the resulting
+behavior is undefined.
+
+@end deftypefun
+
+Fatal errors are unrecoverable, and the only reasonable course of
+action is to abort the calling process. The default fatal error
+handler function writes a message to standard error and then calls
+@code{abort()}. One potential alternate implementation would be to
+call @code{exit()} with an exit status that indicates to the parent
+process (such as a watchdog process) that the current process has
+encountered an unrecoverable condition and should be respawned.
+
+In the current implementation, the only condition that will produce a
+fatal error is a memory allocation failure---that is, a @code{NULL}
+return value from @code{malloc()}, @code{calloc()}, or
+@code{realloc()}.
+
+@end deftypefun
+
 @deftypefun void config_set_include_dir (@w{config_t *@var{config}}, @w{const char *@var{include_dir}})
 @deftypefunx {const char *} config_get_include_dir (@w{const config_t *@var{config}})
 
@@ -879,8 +915,8 @@
 
 @end deftypefun
 
-@deftypefun {unsigned short} config_get_float_precision(@w{config_t *@var{config}})
-@deftypefunx void config_set_float_precision(@w{config_t *@var{config}}, @w{unsigned short @var{digits}})
+@deftypefun {unsigned short} config_get_float_precision (@w{config_t *@var{config}})
+@deftypefunx void config_set_float_precision (@w{config_t *@var{config}}, @w{unsigned short @var{digits}})
 
 @b{Since @i{v1.6}}
 
@@ -978,14 +1014,14 @@
 @deftypefun int config_get_auto_convert (@w{const config_t *@var{config}})
 @deftypefunx void config_set_auto_convert (@w{config_t *@var{config}}, @w{int @var{flag}})
 
-These functions get and set the @code{CONFIG_OPTION_AUTO_CONVERT}
+These functions get and set the @code{CONFIG_OPTION_AUTOCONVERT}
 option. They are obsoleted by the @code{config_set_option()} and
 @code{config_get_option()} functions described above.
 
 @end deftypefun
 
-@deftypefun short config_get_default_format (@w{config_t * @var{config}})
-@deftypefunx void config_set_default_format (@w{config_t * @var{config}}, @w{short @var{format}})
+@deftypefun {unsigned short} config_get_default_format (@w{config_t * @var{config}})
+@deftypefunx void config_set_default_format (@w{config_t * @var{config}}, @w{unsigned short @var{format}})
 
 These functions, which are implemented as macros, get and set the
 default external format for settings in the configuration
@@ -1039,6 +1075,15 @@
 
 @end deftypefun
 
+@deftypefun {const config_setting_t *} config_lookup_const (@w{const config_t * @var{config}}, @w{const char * @var{path}})
+
+@b{Since @i{v1.7.4}}
+
+This function is identical to @code{config_lookup()}, except that the
+setting is returned as a @code{const} structure.
+
+@end deftypefun
+
 @deftypefun {config_setting_t *} config_setting_lookup (@w{const config_setting_t * @var{setting}}, @w{const char * @var{path}})
 
 This function locates a setting by a path @var{path} relative to
@@ -1048,6 +1093,15 @@
 
 @end deftypefun
 
+@deftypefun {const config_setting_t *} config_setting_lookup_const (@w{const config_setting_t * @var{setting}}, @w{const char * @var{path}})
+
+@b{Since @i{v1.7.4}}
+
+This function is identical to @code{config_setting_lookup()}, except that the
+setting is returned as a @code{const} structure.
+
+@end deftypefun
+
 @deftypefun int config_setting_get_int (@w{const config_setting_t * @var{setting}})
 @deftypefunx {long long} config_setting_get_int64 (@w{const config_setting_t * @var{setting}})
 @deftypefunx double config_setting_get_float (@w{const config_setting_t * @var{setting}})
@@ -1098,8 +1152,8 @@
 
 @end deftypefun
 
-@deftypefun short config_setting_get_format (@w{config_setting_t * @var{setting}})
-@deftypefunx int config_setting_set_format (@w{config_setting_t * @var{setting}}, @w{short @var{format}})
+@deftypefun {unsigned short} config_setting_get_format (@w{config_setting_t * @var{setting}})
+@deftypefunx int config_setting_set_format (@w{config_setting_t * @var{setting}}, @w{unsigned short @var{format}})
 
 These functions get and set the external format for the setting @var{setting}.
 
@@ -1380,6 +1434,20 @@
 
 @end deftypemethod
 
+@tindex SettingRangeException
+A @code{SettingRangeException} is thrown when an attempt is made to
+read a 64-bit integer configuration setting into an integer variable,
+and the value of that setting is outside the range of an integer.
+
+@deftypemethod SettingRangeException {} SettingRangeException (@w{const Setting &@var{setting}})
+@deftypemethodx SettingRangeException {} SettingRangeException (@w{const Setting &@var{setting}}, @w{int @var{index}})
+@deftypemethodx SettingRangeException {} SettingRangeException (@w{const Setting &@var{setting}}, @w{const char *@var{name}})
+@b{Since @i{v1.7.4}}
+
+These methods construct @code{SettingRangeException} objects for the given @var{setting} and/or member @var{index} or @var{name}.
+
+@end deftypemethod
+
 @tindex SettingNotFoundException
 A @code{SettingNotFoundException} is thrown when a setting is not found.
 
@@ -1861,6 +1929,22 @@
 @end smallexample
 @end cartouche
 
+A @code{SettingRangeException} is thrown under the following
+circumstances:
+
+@itemize @bullet
+
+@item
+The setting's value is a 64-bit integer, and is being cast to a
+smaller integer type such as @code{int} or @code{unsigned long}, but
+the value is outside the range of that type.
+
+@item
+The setting's value is a negative integer, and is being cast to an
+unsigned integer type such as @code{unsigned int}.
+
+@end itemize
+
 If the assignment is invalid due to a type mismatch, a
 @code{SettingTypeException} is thrown.
 
diff --git a/examples/Makefile.am b/examples/Makefile.am
index e084bf0..0c39968 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -4,3 +4,5 @@
 if BUILDCXX
 SUBDIRS += c++
 endif
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/examples/c++/Makefile.am b/examples/c++/Makefile.am
index 46b66d0..5cff85a 100644
--- a/examples/c++/Makefile.am
+++ b/examples/c++/Makefile.am
@@ -13,4 +13,5 @@
 EXTRA_DIST = \
 	example.cfg invalid.cfg \
 	*.vcproj \
-	*.vcxproj
+	*.vcxproj \
+	CMakeLists.txt
diff --git a/examples/c++/example1.cpp b/examples/c++/example1.cpp
index feaab2d..fe29b3a 100644
--- a/examples/c++/example1.cpp
+++ b/examples/c++/example1.cpp
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2010  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/examples/c++/example2.cpp b/examples/c++/example2.cpp
index f4ebe79..8be977b 100644
--- a/examples/c++/example2.cpp
+++ b/examples/c++/example2.cpp
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2010  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/examples/c++/example3.cpp b/examples/c++/example3.cpp
index 1732a86..30fafd5 100644
--- a/examples/c++/example3.cpp
+++ b/examples/c++/example3.cpp
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2010  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/examples/c++/example4.cpp b/examples/c++/example4.cpp
index 7ac550b..fbaa49d 100644
--- a/examples/c++/example4.cpp
+++ b/examples/c++/example4.cpp
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2010  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/examples/c/Makefile.am b/examples/c/Makefile.am
index 18172a8..fbfeeba 100644
--- a/examples/c/Makefile.am
+++ b/examples/c/Makefile.am
@@ -14,4 +14,5 @@
 	cfg_includes/*.cfg \
 	cfg_includes/cfg_subincludes/*.cfg \
 	*.vcproj \
-	*.vcxproj
+	*.vcxproj \
+	CMakeLists.txt
diff --git a/examples/c/example1.c b/examples/c/example1.c
index 0c7b5b4..f2ff9af 100644
--- a/examples/c/example1.c
+++ b/examples/c/example1.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/examples/c/example2.c b/examples/c/example2.c
index 2859bd9..eeac345 100644
--- a/examples/c/example2.c
+++ b/examples/c/example2.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/examples/c/example3.c b/examples/c/example3.c
index 5b7f8a7..aa27db5 100644
--- a/examples/c/example3.c
+++ b/examples/c/example3.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/examples/c/example4.c b/examples/c/example4.c
index 1f8b0c0..0835ebb 100644
--- a/examples/c/example4.c
+++ b/examples/c/example4.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -89,7 +89,10 @@
   {
     while((dir_entry = readdir(dp)) != NULL)
     {
-      snprintf(file_path, PATH_MAX, "%s/%s", include_path, dir_entry->d_name);
+      int r = snprintf(file_path, PATH_MAX, "%s/%s", include_path,
+                       dir_entry->d_name);
+      if(r < 0) abort(); // Handle possible truncation of very long path
+      
       if(lstat(file_path, &stat_buf) != 0) continue;
       if(!S_ISREG(stat_buf.st_mode)) continue;
       if(fnmatch(path, file_path, FNM_PATHNAME) != 0) continue;
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 709a1b5..e218fa3 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -123,7 +123,7 @@
   PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
   )
 
-install(TARGETS ${libname}
+install(TARGETS ${libname} ${libname}++
     EXPORT libconfigTargets
     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -131,30 +131,20 @@
     PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
 )
 
-install(TARGETS ${libname}++
-    EXPORT libconfig++Targets
-    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
-    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-)
-
 
 include(CMakePackageConfigHelpers)
-foreach(target_name libconfig libconfig++)
-  write_basic_package_version_file("${target_name}ConfigVersion.cmake"
+write_basic_package_version_file("libconfigConfigVersion.cmake"
     VERSION ${PACKAGE_VERSION}
     COMPATIBILITY SameMajorVersion
     )
 
-  install(EXPORT ${target_name}Targets
-    FILE "${target_name}Config.cmake"
+install(EXPORT libconfigTargets
+    FILE "libconfigConfig.cmake"
     NAMESPACE libconfig::
     DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libconfig
     )
 
-  install(FILES
-    "${CMAKE_CURRENT_BINARY_DIR}/${target_name}ConfigVersion.cmake"
+install(FILES
+    "${CMAKE_CURRENT_BINARY_DIR}/libconfigConfigVersion.cmake"
     DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libconfig"
     )
-endforeach()
diff --git a/lib/Makefile.am b/lib/Makefile.am
index ce4c599..ad6dfd1 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -18,7 +18,7 @@
 #
 # For more info see section 6.3 of the GNU Libtool Manual.
 
-VERINFO = -version-info 12:0:1
+VERINFO = -version-info 13:0:2
 
 ## Flex
 PARSER_PREFIX = libconfig_yy
@@ -78,7 +78,8 @@
 	$(BUILT_SOURCES) \
 	libconfigcpp.cc libconfig.hh \
 	*.vcproj \
-	*.vcxproj
+	*.vcxproj \
+	CMakeLists.txt
 
 pkgconfigdir = $(libdir)/pkgconfig
 
diff --git a/lib/grammar.c b/lib/grammar.c
index a4a37ec..26aa039 100644
--- a/lib/grammar.c
+++ b/lib/grammar.c
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
+/* A Bison parser, made by GNU Bison 3.8.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -15,7 +16,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -33,6 +34,10 @@
 /* C LALR(1) parser skeleton written by Richard Stallman, by
    simplifying the original so-called "semantic" parser.  */
 
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+   especially those whose name start with YY_ or yy_.  They are
+   private implementation details that can be changed or removed.  */
+
 /* All symbols defined below should begin with yy or YY, to avoid
    infringing on user name space.  This should be done even for local
    variables, as they might otherwise be expanded by user macros.
@@ -40,11 +45,11 @@
    define necessary library symbols; they are noted "INFRINGES ON
    USER NAME SPACE" below.  */
 
-/* Identify Bison output.  */
-#define YYBISON 1
+/* Identify Bison output, and Bison version.  */
+#define YYBISON 30800
 
-/* Bison version.  */
-#define YYBISON_VERSION "3.0.4"
+/* Bison version string.  */
+#define YYBISON_VERSION "3.8"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -66,9 +71,8 @@
 #define yydebug         libconfig_yydebug
 #define yynerrs         libconfig_yynerrs
 
-
-/* Copy the first part of user declarations.  */
-#line 32 "grammar.y" /* yacc.c:339  */
+/* First part of user prologue.  */
+#line 32 "grammar.y"
 
 #include <string.h>
 #include <stdlib.h>
@@ -83,6 +87,8 @@
 extern int libconfig_yylex();
 extern int libconfig_yyget_lineno();
 
+#define YYMALLOC libconfig_malloc
+
 static const char *err_array_elem_type = "mismatched element type in array";
 static const char *err_duplicate_setting = "duplicate setting name";
 
@@ -111,26 +117,31 @@
 }
 
 
-#line 115 "grammar.c" /* yacc.c:339  */
+#line 121 "grammar.c"
 
-# ifndef YY_NULLPTR
-#  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULLPTR nullptr
+# ifndef YY_CAST
+#  ifdef __cplusplus
+#   define YY_CAST(Type, Val) static_cast<Type> (Val)
+#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
 #  else
-#   define YY_NULLPTR 0
+#   define YY_CAST(Type, Val) ((Type) (Val))
+#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+#  endif
+# endif
+# ifndef YY_NULLPTR
+#  if defined __cplusplus
+#   if 201103L <= __cplusplus
+#    define YY_NULLPTR nullptr
+#   else
+#    define YY_NULLPTR 0
+#   endif
+#  else
+#   define YY_NULLPTR ((void*)0)
 #  endif
 # endif
 
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* In a future release of Bison, this section will be replaced
-   by #include "y.tab.h".  */
+/* Use api.header.include to #include this header
+   instead of duplicating it here.  */
 #ifndef YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED
 # define YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED
 /* Debug traces.  */
@@ -141,34 +152,43 @@
 extern int libconfig_yydebug;
 #endif
 
-/* Token type.  */
+/* Token kinds.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
   enum yytokentype
   {
-    TOK_BOOLEAN = 258,
-    TOK_INTEGER = 259,
-    TOK_HEX = 260,
-    TOK_INTEGER64 = 261,
-    TOK_HEX64 = 262,
-    TOK_FLOAT = 263,
-    TOK_STRING = 264,
-    TOK_NAME = 265,
-    TOK_EQUALS = 266,
-    TOK_NEWLINE = 267,
-    TOK_ARRAY_START = 268,
-    TOK_ARRAY_END = 269,
-    TOK_LIST_START = 270,
-    TOK_LIST_END = 271,
-    TOK_COMMA = 272,
-    TOK_GROUP_START = 273,
-    TOK_GROUP_END = 274,
-    TOK_SEMICOLON = 275,
-    TOK_GARBAGE = 276,
-    TOK_ERROR = 277
+    YYEMPTY = -2,
+    YYEOF = 0,                     /* "end of file"  */
+    YYerror = 256,                 /* error  */
+    YYUNDEF = 257,                 /* "invalid token"  */
+    TOK_BOOLEAN = 258,             /* TOK_BOOLEAN  */
+    TOK_INTEGER = 259,             /* TOK_INTEGER  */
+    TOK_HEX = 260,                 /* TOK_HEX  */
+    TOK_INTEGER64 = 261,           /* TOK_INTEGER64  */
+    TOK_HEX64 = 262,               /* TOK_HEX64  */
+    TOK_FLOAT = 263,               /* TOK_FLOAT  */
+    TOK_STRING = 264,              /* TOK_STRING  */
+    TOK_NAME = 265,                /* TOK_NAME  */
+    TOK_EQUALS = 266,              /* TOK_EQUALS  */
+    TOK_NEWLINE = 267,             /* TOK_NEWLINE  */
+    TOK_ARRAY_START = 268,         /* TOK_ARRAY_START  */
+    TOK_ARRAY_END = 269,           /* TOK_ARRAY_END  */
+    TOK_LIST_START = 270,          /* TOK_LIST_START  */
+    TOK_LIST_END = 271,            /* TOK_LIST_END  */
+    TOK_COMMA = 272,               /* TOK_COMMA  */
+    TOK_GROUP_START = 273,         /* TOK_GROUP_START  */
+    TOK_GROUP_END = 274,           /* TOK_GROUP_END  */
+    TOK_SEMICOLON = 275,           /* TOK_SEMICOLON  */
+    TOK_GARBAGE = 276,             /* TOK_GARBAGE  */
+    TOK_ERROR = 277                /* TOK_ERROR  */
   };
+  typedef enum yytokentype yytoken_kind_t;
 #endif
-/* Tokens.  */
+/* Token kinds.  */
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYerror 256
+#define YYUNDEF 257
 #define TOK_BOOLEAN 258
 #define TOK_INTEGER 259
 #define TOK_HEX 260
@@ -192,19 +212,18 @@
 
 /* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
 union YYSTYPE
 {
-#line 76 "grammar.y" /* yacc.c:355  */
+#line 78 "grammar.y"
 
   int ival;
   long long llval;
   double fval;
   char *sval;
 
-#line 206 "grammar.c" /* yacc.c:355  */
-};
+#line 225 "grammar.c"
 
+};
 typedef union YYSTYPE YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define YYSTYPE_IS_DECLARED 1
@@ -212,40 +231,155 @@
 
 
 
+#if !defined libconfig_yyerror && !defined YYERROR_IS_DECLARED
+void libconfig_yyerror (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx, const char *msg);
+#endif
+#if !defined libconfig_yylex && !defined YYLEX_IS_DECLARED
+int libconfig_yylex (YYSTYPE *yylvalp, void *scanner);
+#endif
+
 int libconfig_yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx);
 
+
 #endif /* !YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED  */
+/* Symbol kind.  */
+enum yysymbol_kind_t
+{
+  YYSYMBOL_YYEMPTY = -2,
+  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
+  YYSYMBOL_YYerror = 1,                    /* error  */
+  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
+  YYSYMBOL_TOK_BOOLEAN = 3,                /* TOK_BOOLEAN  */
+  YYSYMBOL_TOK_INTEGER = 4,                /* TOK_INTEGER  */
+  YYSYMBOL_TOK_HEX = 5,                    /* TOK_HEX  */
+  YYSYMBOL_TOK_INTEGER64 = 6,              /* TOK_INTEGER64  */
+  YYSYMBOL_TOK_HEX64 = 7,                  /* TOK_HEX64  */
+  YYSYMBOL_TOK_FLOAT = 8,                  /* TOK_FLOAT  */
+  YYSYMBOL_TOK_STRING = 9,                 /* TOK_STRING  */
+  YYSYMBOL_TOK_NAME = 10,                  /* TOK_NAME  */
+  YYSYMBOL_TOK_EQUALS = 11,                /* TOK_EQUALS  */
+  YYSYMBOL_TOK_NEWLINE = 12,               /* TOK_NEWLINE  */
+  YYSYMBOL_TOK_ARRAY_START = 13,           /* TOK_ARRAY_START  */
+  YYSYMBOL_TOK_ARRAY_END = 14,             /* TOK_ARRAY_END  */
+  YYSYMBOL_TOK_LIST_START = 15,            /* TOK_LIST_START  */
+  YYSYMBOL_TOK_LIST_END = 16,              /* TOK_LIST_END  */
+  YYSYMBOL_TOK_COMMA = 17,                 /* TOK_COMMA  */
+  YYSYMBOL_TOK_GROUP_START = 18,           /* TOK_GROUP_START  */
+  YYSYMBOL_TOK_GROUP_END = 19,             /* TOK_GROUP_END  */
+  YYSYMBOL_TOK_SEMICOLON = 20,             /* TOK_SEMICOLON  */
+  YYSYMBOL_TOK_GARBAGE = 21,               /* TOK_GARBAGE  */
+  YYSYMBOL_TOK_ERROR = 22,                 /* TOK_ERROR  */
+  YYSYMBOL_YYACCEPT = 23,                  /* $accept  */
+  YYSYMBOL_configuration = 24,             /* configuration  */
+  YYSYMBOL_setting_list = 25,              /* setting_list  */
+  YYSYMBOL_setting_list_optional = 26,     /* setting_list_optional  */
+  YYSYMBOL_setting_terminator = 27,        /* setting_terminator  */
+  YYSYMBOL_setting = 28,                   /* setting  */
+  YYSYMBOL_29_1 = 29,                      /* $@1  */
+  YYSYMBOL_array = 30,                     /* array  */
+  YYSYMBOL_31_2 = 31,                      /* $@2  */
+  YYSYMBOL_list = 32,                      /* list  */
+  YYSYMBOL_33_3 = 33,                      /* $@3  */
+  YYSYMBOL_value = 34,                     /* value  */
+  YYSYMBOL_string = 35,                    /* string  */
+  YYSYMBOL_simple_value = 36,              /* simple_value  */
+  YYSYMBOL_value_list = 37,                /* value_list  */
+  YYSYMBOL_value_list_optional = 38,       /* value_list_optional  */
+  YYSYMBOL_simple_value_list = 39,         /* simple_value_list  */
+  YYSYMBOL_simple_value_list_optional = 40, /* simple_value_list_optional  */
+  YYSYMBOL_group = 41,                     /* group  */
+  YYSYMBOL_42_4 = 42                       /* $@4  */
+};
+typedef enum yysymbol_kind_t yysymbol_kind_t;
 
-/* Copy the second part of user declarations.  */
 
-#line 222 "grammar.c" /* yacc.c:358  */
+
 
 #ifdef short
 # undef short
 #endif
 
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
+/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
+   <limits.h> and (if available) <stdint.h> are included
+   so that the code can choose integer types of a good width.  */
+
+#ifndef __PTRDIFF_MAX__
+# include <limits.h> /* INFRINGES ON USER NAME SPACE */
+# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
+#  define YY_STDINT_H
+# endif
 #endif
 
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
+/* Narrow types that promote to a signed type and that can represent a
+   signed or unsigned integer of at least N bits.  In tables they can
+   save space and decrease cache pressure.  Promoting to a signed type
+   helps avoid bugs in integer arithmetic.  */
+
+#ifdef __INT_LEAST8_MAX__
+typedef __INT_LEAST8_TYPE__ yytype_int8;
+#elif defined YY_STDINT_H
+typedef int_least8_t yytype_int8;
 #else
 typedef signed char yytype_int8;
 #endif
 
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
+#ifdef __INT_LEAST16_MAX__
+typedef __INT_LEAST16_TYPE__ yytype_int16;
+#elif defined YY_STDINT_H
+typedef int_least16_t yytype_int16;
 #else
-typedef unsigned short int yytype_uint16;
+typedef short yytype_int16;
 #endif
 
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
+/* Work around bug in HP-UX 11.23, which defines these macros
+   incorrectly for preprocessor constants.  This workaround can likely
+   be removed in 2023, as HPE has promised support for HP-UX 11.23
+   (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
+   <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
+#ifdef __hpux
+# undef UINT_LEAST8_MAX
+# undef UINT_LEAST16_MAX
+# define UINT_LEAST8_MAX 255
+# define UINT_LEAST16_MAX 65535
+#endif
+
+#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST8_TYPE__ yytype_uint8;
+#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
+       && UINT_LEAST8_MAX <= INT_MAX)
+typedef uint_least8_t yytype_uint8;
+#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
+typedef unsigned char yytype_uint8;
 #else
-typedef short int yytype_int16;
+typedef short yytype_uint8;
+#endif
+
+#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST16_TYPE__ yytype_uint16;
+#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
+       && UINT_LEAST16_MAX <= INT_MAX)
+typedef uint_least16_t yytype_uint16;
+#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
+typedef unsigned short yytype_uint16;
+#else
+typedef int yytype_uint16;
+#endif
+
+#ifndef YYPTRDIFF_T
+# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
+#  define YYPTRDIFF_T __PTRDIFF_TYPE__
+#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
+# elif defined PTRDIFF_MAX
+#  ifndef ptrdiff_t
+#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  endif
+#  define YYPTRDIFF_T ptrdiff_t
+#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
+# else
+#  define YYPTRDIFF_T long
+#  define YYPTRDIFF_MAXIMUM LONG_MAX
+# endif
 #endif
 
 #ifndef YYSIZE_T
@@ -253,15 +387,28 @@
 #  define YYSIZE_T __SIZE_TYPE__
 # elif defined size_t
 #  define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
+# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 #  define YYSIZE_T size_t
 # else
-#  define YYSIZE_T unsigned int
+#  define YYSIZE_T unsigned
 # endif
 #endif
 
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+#define YYSIZE_MAXIMUM                                  \
+  YY_CAST (YYPTRDIFF_T,                                 \
+           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
+            ? YYPTRDIFF_MAXIMUM                         \
+            : YY_CAST (YYSIZE_T, -1)))
+
+#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
+
+/* Stored state numbers (used for stacks). */
+typedef yytype_int8 yy_state_t;
+
+/* State numbers in computations.  */
+typedef int yy_state_fast_t;
 
 #ifndef YY_
 # if defined YYENABLE_NLS && YYENABLE_NLS
@@ -275,47 +422,43 @@
 # endif
 #endif
 
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__                                               \
-      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
-     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+
+#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
 # else
-#  define YY_ATTRIBUTE(Spec) /* empty */
+#  define YY_ATTRIBUTE_PURE
 # endif
 #endif
 
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
-#endif
-
 #ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
-     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
 # else
-#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+#  define YY_ATTRIBUTE_UNUSED
 # endif
 #endif
 
 /* Suppress unused-variable warnings by "using" E.  */
 #if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
+# define YY_USE(E) ((void) (E))
 #else
-# define YYUSE(E) /* empty */
+# define YY_USE(E) /* empty */
 #endif
 
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
-    _Pragma ("GCC diagnostic push") \
-    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
+# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
+#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
+    _Pragma ("GCC diagnostic push")                                     \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
+# else
+#  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
+    _Pragma ("GCC diagnostic push")                                     \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+# endif
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
     _Pragma ("GCC diagnostic pop")
 #else
 # define YY_INITIAL_VALUE(Value) Value
@@ -328,8 +471,22 @@
 # define YY_INITIAL_VALUE(Value) /* Nothing. */
 #endif
 
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN                          \
+    _Pragma ("GCC diagnostic push")                            \
+    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END            \
+    _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
 
-#if ! defined yyoverflow || YYERROR_VERBOSE
+
+#define YY_ASSERT(E) ((void) (0 && (E)))
+
+#if !defined yyoverflow
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
 
@@ -394,8 +551,7 @@
 #   endif
 #  endif
 # endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
+#endif /* !defined yyoverflow */
 
 #if (! defined yyoverflow \
      && (! defined __cplusplus \
@@ -404,17 +560,17 @@
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-  yytype_int16 yyss_alloc;
+  yy_state_t yyss_alloc;
   YYSTYPE yyvs_alloc;
 };
 
 /* The size of the maximum gap between one aligned stack and the next.  */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
 
 /* The size of an array large to enough to hold all stacks, each with
    N elements.  */
 # define YYSTACK_BYTES(N) \
-     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
       + YYSTACK_GAP_MAXIMUM)
 
 # define YYCOPY_NEEDED 1
@@ -427,11 +583,11 @@
 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
     do                                                                  \
       {                                                                 \
-        YYSIZE_T yynewbytes;                                            \
+        YYPTRDIFF_T yynewbytes;                                         \
         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
         Stack = &yyptr->Stack_alloc;                                    \
-        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-        yyptr += yynewbytes / sizeof (*yyptr);                          \
+        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
       }                                                                 \
     while (0)
 
@@ -443,12 +599,12 @@
 # ifndef YYCOPY
 #  if defined __GNUC__ && 1 < __GNUC__
 #   define YYCOPY(Dst, Src, Count) \
-      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
 #  else
 #   define YYCOPY(Dst, Src, Count)              \
       do                                        \
         {                                       \
-          YYSIZE_T yyi;                         \
+          YYPTRDIFF_T yyi;                      \
           for (yyi = 0; yyi < (Count); yyi++)   \
             (Dst)[yyi] = (Src)[yyi];            \
         }                                       \
@@ -471,17 +627,20 @@
 /* YYNSTATES -- Number of states.  */
 #define YYNSTATES  47
 
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
-   by yylex, with out-of-bounds checking.  */
-#define YYUNDEFTOK  2
+/* YYMAXUTOK -- Last valid token kind.  */
 #define YYMAXUTOK   277
 
-#define YYTRANSLATE(YYX)                                                \
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, with out-of-bounds checking.  */
+#define YYTRANSLATE(YYX)                                \
+  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
+   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
+   : YYSYMBOL_YYUNDEF)
 
 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
-   as returned by yylex, without out-of-bounds checking.  */
-static const yytype_uint8 yytranslate[] =
+   as returned by yylex.  */
+static const yytype_int8 yytranslate[] =
 {
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -514,57 +673,60 @@
 };
 
 #if YYDEBUG
-  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
-static const yytype_uint16 yyrline[] =
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+static const yytype_int16 yyrline[] =
 {
-       0,    92,    92,    94,    98,    99,   102,   104,   107,   109,
-     110,   115,   114,   134,   133,   157,   156,   179,   180,   181,
-     182,   186,   187,   191,   211,   233,   255,   277,   299,   317,
-     345,   346,   347,   350,   352,   356,   357,   358,   361,   363,
-     368,   367
+       0,    94,    94,    96,   100,   101,   104,   106,   109,   111,
+     112,   117,   116,   136,   135,   159,   158,   181,   182,   183,
+     184,   188,   189,   193,   213,   235,   257,   279,   301,   319,
+     347,   348,   349,   352,   354,   358,   359,   360,   363,   365,
+     370,   369
 };
 #endif
 
-#if YYDEBUG || YYERROR_VERBOSE || 0
+/** Accessing symbol of state STATE.  */
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
+
+#if YYDEBUG || 0
+/* The user-facing name of the symbol whose (internal) number is
+   YYSYMBOL.  No bounds checking.  */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
 {
-  "$end", "error", "$undefined", "TOK_BOOLEAN", "TOK_INTEGER", "TOK_HEX",
-  "TOK_INTEGER64", "TOK_HEX64", "TOK_FLOAT", "TOK_STRING", "TOK_NAME",
-  "TOK_EQUALS", "TOK_NEWLINE", "TOK_ARRAY_START", "TOK_ARRAY_END",
-  "TOK_LIST_START", "TOK_LIST_END", "TOK_COMMA", "TOK_GROUP_START",
-  "TOK_GROUP_END", "TOK_SEMICOLON", "TOK_GARBAGE", "TOK_ERROR", "$accept",
-  "configuration", "setting_list", "setting_list_optional",
-  "setting_terminator", "setting", "$@1", "array", "$@2", "list", "$@3",
-  "value", "string", "simple_value", "value_list", "value_list_optional",
-  "simple_value_list", "simple_value_list_optional", "group", "$@4", YY_NULLPTR
+  "\"end of file\"", "error", "\"invalid token\"", "TOK_BOOLEAN",
+  "TOK_INTEGER", "TOK_HEX", "TOK_INTEGER64", "TOK_HEX64", "TOK_FLOAT",
+  "TOK_STRING", "TOK_NAME", "TOK_EQUALS", "TOK_NEWLINE", "TOK_ARRAY_START",
+  "TOK_ARRAY_END", "TOK_LIST_START", "TOK_LIST_END", "TOK_COMMA",
+  "TOK_GROUP_START", "TOK_GROUP_END", "TOK_SEMICOLON", "TOK_GARBAGE",
+  "TOK_ERROR", "$accept", "configuration", "setting_list",
+  "setting_list_optional", "setting_terminator", "setting", "$@1", "array",
+  "$@2", "list", "$@3", "value", "string", "simple_value", "value_list",
+  "value_list_optional", "simple_value_list", "simple_value_list_optional",
+  "group", "$@4", YY_NULLPTR
 };
+
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
+{
+  return yytname[yysymbol];
+}
 #endif
 
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
-   (internal) symbol number NUM (which must be that of a token).  */
-static const yytype_uint16 yytoknum[] =
-{
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-     275,   276,   277
-};
-# endif
+#define YYPACT_NINF (-26)
 
-#define YYPACT_NINF -26
+#define yypact_value_is_default(Yyn) \
+  ((Yyn) == YYPACT_NINF)
 
-#define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-26)))
+#define YYTABLE_NINF (-1)
 
-#define YYTABLE_NINF -1
-
-#define yytable_value_is_error(Yytable_value) \
+#define yytable_value_is_error(Yyn) \
   0
 
-  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-     STATE-NUM.  */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
 static const yytype_int8 yypact[] =
 {
       -8,   -26,    12,    -8,   -26,     5,   -26,   -26,     0,   -26,
@@ -574,10 +736,10 @@
       23,   -26,     0,   -26,   -26,   -26,   -26
 };
 
-  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
-     Performed when YYTABLE does not specify something else to do.  Zero
-     means the default is an error.  */
-static const yytype_uint8 yydefact[] =
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+   Performed when YYTABLE does not specify something else to do.  Zero
+   means the default is an error.  */
+static const yytype_int8 yydefact[] =
 {
        2,    11,     0,     3,     4,     0,     1,     5,     0,    23,
       24,    26,    25,    27,    28,    21,    13,    15,    40,    18,
@@ -586,24 +748,24 @@
       37,    14,    32,    16,    41,    36,    31
 };
 
-  /* YYPGOTO[NTERM-NUM].  */
+/* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
      -26,   -26,    -5,   -26,   -26,    -3,   -26,   -26,   -26,   -26,
      -26,   -25,   -26,   -15,   -26,   -26,   -26,   -26,   -26,   -26
 };
 
-  /* YYDEFGOTO[NTERM-NUM].  */
+/* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int8 yydefgoto[] =
 {
-      -1,     2,     3,    39,    30,     4,     5,    19,    25,    20,
+       0,     2,     3,    39,    30,     4,     5,    19,    25,    20,
       26,    21,    22,    23,    36,    37,    33,    34,    24,    27
 };
 
-  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
-     positive, shift that token.  If negative, reduce the rule whose
-     number is the opposite.  If YYTABLE_NINF, syntax error.  */
-static const yytype_uint8 yytable[] =
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule whose
+   number is the opposite.  If YYTABLE_NINF, syntax error.  */
+static const yytype_int8 yytable[] =
 {
        7,    35,     1,     9,    10,    11,    12,    13,    14,    15,
       32,    28,     6,    16,    29,    17,     8,    46,    18,    31,
@@ -619,9 +781,9 @@
        7,     8,     9,    19,    -1,    38
 };
 
-  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-     symbol of state STATE-NUM.  */
-static const yytype_uint8 yystos[] =
+/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
+   state STATE-NUM.  */
+static const yytype_int8 yystos[] =
 {
        0,    10,    24,    25,    28,    29,     0,    28,    11,     3,
        4,     5,     6,     7,     8,     9,    13,    15,    18,    30,
@@ -630,8 +792,8 @@
       17,    14,    17,    16,    19,    36,    34
 };
 
-  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
+/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
+static const yytype_int8 yyr1[] =
 {
        0,    23,    24,    24,    25,    25,    26,    26,    27,    27,
       27,    29,    28,    31,    30,    33,    32,    34,    34,    34,
@@ -640,8 +802,8 @@
       42,    41
 };
 
-  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
+/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
+static const yytype_int8 yyr2[] =
 {
        0,     2,     0,     1,     1,     2,     0,     1,     0,     1,
        1,     0,     5,     0,     4,     0,     4,     1,     1,     1,
@@ -651,39 +813,39 @@
 };
 
 
+enum { YYENOMEM = -2 };
+
 #define yyerrok         (yyerrstatus = 0)
 #define yyclearin       (yychar = YYEMPTY)
-#define YYEMPTY         (-2)
-#define YYEOF           0
 
 #define YYACCEPT        goto yyacceptlab
 #define YYABORT         goto yyabortlab
 #define YYERROR         goto yyerrorlab
+#define YYNOMEM         goto yyexhaustedlab
 
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
-#define YYBACKUP(Token, Value)                                  \
-do                                                              \
-  if (yychar == YYEMPTY)                                        \
-    {                                                           \
-      yychar = (Token);                                         \
-      yylval = (Value);                                         \
-      YYPOPSTACK (yylen);                                       \
-      yystate = *yyssp;                                         \
-      goto yybackup;                                            \
-    }                                                           \
-  else                                                          \
-    {                                                           \
-      yyerror (scanner, ctx, scan_ctx, YY_("syntax error: cannot back up")); \
-      YYERROR;                                                  \
-    }                                                           \
-while (0)
+#define YYBACKUP(Token, Value)                                    \
+  do                                                              \
+    if (yychar == YYEMPTY)                                        \
+      {                                                           \
+        yychar = (Token);                                         \
+        yylval = (Value);                                         \
+        YYPOPSTACK (yylen);                                       \
+        yystate = *yyssp;                                         \
+        goto yybackup;                                            \
+      }                                                           \
+    else                                                          \
+      {                                                           \
+        yyerror (scanner, ctx, scan_ctx, YY_("syntax error: cannot back up")); \
+        YYERROR;                                                  \
+      }                                                           \
+  while (0)
 
-/* Error token number */
-#define YYTERROR        1
-#define YYERRCODE       256
-
+/* Backward compatibility with an undocumented macro.
+   Use YYerror or YYUNDEF. */
+#define YYERRCODE YYUNDEF
 
 
 /* Enable debugging if requested.  */
@@ -700,58 +862,55 @@
     YYFPRINTF Args;                             \
 } while (0)
 
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
 
 
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
 do {                                                                      \
   if (yydebug)                                                            \
     {                                                                     \
       YYFPRINTF (stderr, "%s ", Title);                                   \
       yy_symbol_print (stderr,                                            \
-                  Type, Value, scanner, ctx, scan_ctx); \
+                  Kind, Value, scanner, ctx, scan_ctx); \
       YYFPRINTF (stderr, "\n");                                           \
     }                                                                     \
 } while (0)
 
 
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT.  |
-`----------------------------------------*/
+/*-----------------------------------.
+| Print this symbol's value on YYO.  |
+`-----------------------------------*/
 
 static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
+yy_symbol_value_print (FILE *yyo,
+                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
 {
-  FILE *yyo = yyoutput;
-  YYUSE (yyo);
-  YYUSE (scanner);
-  YYUSE (ctx);
-  YYUSE (scan_ctx);
+  FILE *yyoutput = yyo;
+  YY_USE (yyoutput);
+  YY_USE (scanner);
+  YY_USE (ctx);
+  YY_USE (scan_ctx);
   if (!yyvaluep)
     return;
-# ifdef YYPRINT
-  if (yytype < YYNTOKENS)
-    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
-  YYUSE (yytype);
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YY_USE (yykind);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO.  |
+`---------------------------*/
 
 static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
+yy_symbol_print (FILE *yyo,
+                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
 {
-  YYFPRINTF (yyoutput, "%s %s (",
-             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+  YYFPRINTF (yyo, "%s %s (",
+             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
 
-  yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, ctx, scan_ctx);
-  YYFPRINTF (yyoutput, ")");
+  yy_symbol_value_print (yyo, yykind, yyvaluep, scanner, ctx, scan_ctx);
+  YYFPRINTF (yyo, ")");
 }
 
 /*------------------------------------------------------------------.
@@ -760,7 +919,7 @@
 `------------------------------------------------------------------*/
 
 static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
 {
   YYFPRINTF (stderr, "Stack now");
   for (; yybottom <= yytop; yybottom++)
@@ -783,21 +942,21 @@
 `------------------------------------------------*/
 
 static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
+                 int yyrule, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
 {
-  unsigned long int yylno = yyrline[yyrule];
+  int yylno = yyrline[yyrule];
   int yynrhs = yyr2[yyrule];
   int yyi;
-  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
              yyrule - 1, yylno);
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr,
-                       yystos[yyssp[yyi + 1 - yynrhs]],
-                       &(yyvsp[(yyi + 1) - (yynrhs)])
-                                              , scanner, ctx, scan_ctx);
+                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+                       &yyvsp[(yyi + 1) - (yynrhs)], scanner, ctx, scan_ctx);
       YYFPRINTF (stderr, "\n");
     }
 }
@@ -812,8 +971,8 @@
    multiple parsers can coexist.  */
 int yydebug;
 #else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YYDPRINTF(Args) ((void) 0)
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
 # define YY_STACK_PRINT(Bottom, Top)
 # define YY_REDUCE_PRINT(Rule)
 #endif /* !YYDEBUG */
@@ -836,253 +995,35 @@
 #endif
 
 
-#if YYERROR_VERBOSE
 
-# ifndef yystrlen
-#  if defined __GLIBC__ && defined _STRING_H
-#   define yystrlen strlen
-#  else
-/* Return the length of YYSTR.  */
-static YYSIZE_T
-yystrlen (const char *yystr)
-{
-  YYSIZE_T yylen;
-  for (yylen = 0; yystr[yylen]; yylen++)
-    continue;
-  return yylen;
-}
-#  endif
-# endif
 
-# ifndef yystpcpy
-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-#   define yystpcpy stpcpy
-#  else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-   YYDEST.  */
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-{
-  char *yyd = yydest;
-  const char *yys = yysrc;
 
-  while ((*yyd++ = *yys++) != '\0')
-    continue;
-
-  return yyd - 1;
-}
-#  endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
-   quotes and backslashes, so that it's suitable for yyerror.  The
-   heuristic is that double-quoting is unnecessary unless the string
-   contains an apostrophe, a comma, or backslash (other than
-   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
-   null, do not copy; instead, return the length of what the result
-   would have been.  */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
-  if (*yystr == '"')
-    {
-      YYSIZE_T yyn = 0;
-      char const *yyp = yystr;
-
-      for (;;)
-        switch (*++yyp)
-          {
-          case '\'':
-          case ',':
-            goto do_not_strip_quotes;
-
-          case '\\':
-            if (*++yyp != '\\')
-              goto do_not_strip_quotes;
-            /* Fall through.  */
-          default:
-            if (yyres)
-              yyres[yyn] = *yyp;
-            yyn++;
-            break;
-
-          case '"':
-            if (yyres)
-              yyres[yyn] = '\0';
-            return yyn;
-          }
-    do_not_strip_quotes: ;
-    }
-
-  if (! yyres)
-    return yystrlen (yystr);
-
-  return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
-   about the unexpected token YYTOKEN for the state stack whose top is
-   YYSSP.
-
-   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
-   not large enough to hold the message.  In that case, also set
-   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
-   required number of bytes is too large to store.  */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
-                yytype_int16 *yyssp, int yytoken)
-{
-  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
-  YYSIZE_T yysize = yysize0;
-  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-  /* Internationalized format string. */
-  const char *yyformat = YY_NULLPTR;
-  /* Arguments of yyformat. */
-  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-  /* Number of reported tokens (one for the "unexpected", one per
-     "expected"). */
-  int yycount = 0;
-
-  /* There are many possibilities here to consider:
-     - If this state is a consistent state with a default action, then
-       the only way this function was invoked is if the default action
-       is an error action.  In that case, don't check for expected
-       tokens because there are none.
-     - The only way there can be no lookahead present (in yychar) is if
-       this state is a consistent state with a default action.  Thus,
-       detecting the absence of a lookahead is sufficient to determine
-       that there is no unexpected or expected token to report.  In that
-       case, just report a simple "syntax error".
-     - Don't assume there isn't a lookahead just because this state is a
-       consistent state with a default action.  There might have been a
-       previous inconsistent state, consistent state with a non-default
-       action, or user semantic action that manipulated yychar.
-     - Of course, the expected token list depends on states to have
-       correct lookahead information, and it depends on the parser not
-       to perform extra reductions after fetching a lookahead from the
-       scanner and before detecting a syntax error.  Thus, state merging
-       (from LALR or IELR) and default reductions corrupt the expected
-       token list.  However, the list is correct for canonical LR with
-       one exception: it will still contain any token that will not be
-       accepted due to an error action in a later state.
-  */
-  if (yytoken != YYEMPTY)
-    {
-      int yyn = yypact[*yyssp];
-      yyarg[yycount++] = yytname[yytoken];
-      if (!yypact_value_is_default (yyn))
-        {
-          /* Start YYX at -YYN if negative to avoid negative indexes in
-             YYCHECK.  In other words, skip the first -YYN actions for
-             this state because they are default actions.  */
-          int yyxbegin = yyn < 0 ? -yyn : 0;
-          /* Stay within bounds of both yycheck and yytname.  */
-          int yychecklim = YYLAST - yyn + 1;
-          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-          int yyx;
-
-          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
-                && !yytable_value_is_error (yytable[yyx + yyn]))
-              {
-                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-                  {
-                    yycount = 1;
-                    yysize = yysize0;
-                    break;
-                  }
-                yyarg[yycount++] = yytname[yyx];
-                {
-                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
-                  if (! (yysize <= yysize1
-                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-                    return 2;
-                  yysize = yysize1;
-                }
-              }
-        }
-    }
-
-  switch (yycount)
-    {
-# define YYCASE_(N, S)                      \
-      case N:                               \
-        yyformat = S;                       \
-      break
-      YYCASE_(0, YY_("syntax error"));
-      YYCASE_(1, YY_("syntax error, unexpected %s"));
-      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
-      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
-      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
-      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
-    }
-
-  {
-    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
-    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-      return 2;
-    yysize = yysize1;
-  }
-
-  if (*yymsg_alloc < yysize)
-    {
-      *yymsg_alloc = 2 * yysize;
-      if (! (yysize <= *yymsg_alloc
-             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
-        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
-      return 1;
-    }
-
-  /* Avoid sprintf, as that infringes on the user's name space.
-     Don't have undefined behavior even if the translation
-     produced a string with the wrong number of "%s"s.  */
-  {
-    char *yyp = *yymsg;
-    int yyi = 0;
-    while ((*yyp = *yyformat) != '\0')
-      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
-        {
-          yyp += yytnamerr (yyp, yyarg[yyi++]);
-          yyformat += 2;
-        }
-      else
-        {
-          yyp++;
-          yyformat++;
-        }
-  }
-  return 0;
-}
-#endif /* YYERROR_VERBOSE */
 
 /*-----------------------------------------------.
 | Release the memory associated to this symbol.  |
 `-----------------------------------------------*/
 
 static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
+yydestruct (const char *yymsg,
+            yysymbol_kind_t yykind, YYSTYPE *yyvaluep, void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
 {
-  YYUSE (yyvaluep);
-  YYUSE (scanner);
-  YYUSE (ctx);
-  YYUSE (scan_ctx);
+  YY_USE (yyvaluep);
+  YY_USE (scanner);
+  YY_USE (ctx);
+  YY_USE (scan_ctx);
   if (!yymsg)
     yymsg = "Deleting";
-  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
 
   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  switch (yytype)
+  switch (yykind)
     {
-          case 9: /* TOK_STRING  */
-#line 88 "grammar.y" /* yacc.c:1257  */
-      { free(((*yyvaluep).sval)); }
-#line 1083 "grammar.c" /* yacc.c:1257  */
+    case YYSYMBOL_TOK_STRING: /* TOK_STRING  */
+#line 90 "grammar.y"
+            { free(((*yyvaluep).sval)); }
+#line 1025 "grammar.c"
         break;
 
-
       default:
         break;
     }
@@ -1092,6 +1033,8 @@
 
 
 
+
+
 /*----------.
 | yyparse.  |
 `----------*/
@@ -1099,7 +1042,7 @@
 int
 yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx)
 {
-/* The lookahead symbol.  */
+/* Lookahead token kind.  */
 int yychar;
 
 
@@ -1110,45 +1053,38 @@
 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
 
     /* Number of syntax errors so far.  */
-    int yynerrs;
+    int yynerrs = 0;
 
-    int yystate;
+    yy_state_fast_t yystate = 0;
     /* Number of tokens to shift before error messages enabled.  */
-    int yyerrstatus;
+    int yyerrstatus = 0;
 
-    /* The stacks and their tools:
-       'yyss': related to states.
-       'yyvs': related to semantic values.
-
-       Refer to the stacks through separate pointers, to allow yyoverflow
+    /* Refer to the stacks through separate pointers, to allow yyoverflow
        to reallocate them elsewhere.  */
 
-    /* The state stack.  */
-    yytype_int16 yyssa[YYINITDEPTH];
-    yytype_int16 *yyss;
-    yytype_int16 *yyssp;
+    /* Their size.  */
+    YYPTRDIFF_T yystacksize = YYINITDEPTH;
 
-    /* The semantic value stack.  */
+    /* The state stack: array, bottom, top.  */
+    yy_state_t yyssa[YYINITDEPTH];
+    yy_state_t *yyss = yyssa;
+    yy_state_t *yyssp = yyss;
+
+    /* The semantic value stack: array, bottom, top.  */
     YYSTYPE yyvsa[YYINITDEPTH];
-    YYSTYPE *yyvs;
-    YYSTYPE *yyvsp;
-
-    YYSIZE_T yystacksize;
+    YYSTYPE *yyvs = yyvsa;
+    YYSTYPE *yyvsp = yyvs;
 
   int yyn;
+  /* The return value of yyparse.  */
   int yyresult;
-  /* Lookahead token as an internal (translated) token number.  */
-  int yytoken = 0;
+  /* Lookahead symbol kind.  */
+  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
   /* The variables used to return semantic value and location from the
      action routines.  */
   YYSTYPE yyval;
 
-#if YYERROR_VERBOSE
-  /* Buffer for error messages, and its allocated size.  */
-  char yymsgbuf[128];
-  char *yymsg = yymsgbuf;
-  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
+
 
 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
@@ -1156,71 +1092,75 @@
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
-  yyssp = yyss = yyssa;
-  yyvsp = yyvs = yyvsa;
-  yystacksize = YYINITDEPTH;
-
   YYDPRINTF ((stderr, "Starting parse\n"));
 
-  yystate = 0;
-  yyerrstatus = 0;
-  yynerrs = 0;
   yychar = YYEMPTY; /* Cause a token to be read.  */
+
   goto yysetstate;
 
+
 /*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate.  |
+| yynewstate -- push a new state, which is found in yystate.  |
 `------------------------------------------------------------*/
- yynewstate:
+yynewstate:
   /* In all cases, when you get here, the value and location stacks
      have just been pushed.  So pushing a state here evens the stacks.  */
   yyssp++;
 
- yysetstate:
-  *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yysetstate -- set current state (the top of the stack) to yystate.  |
+`--------------------------------------------------------------------*/
+yysetstate:
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+  YY_IGNORE_USELESS_CAST_BEGIN
+  *yyssp = YY_CAST (yy_state_t, yystate);
+  YY_IGNORE_USELESS_CAST_END
+  YY_STACK_PRINT (yyss, yyssp);
 
   if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+    YYNOMEM;
+#else
     {
       /* Get the current used size of the three stacks, in elements.  */
-      YYSIZE_T yysize = yyssp - yyss + 1;
+      YYPTRDIFF_T yysize = yyssp - yyss + 1;
 
-#ifdef yyoverflow
+# if defined yyoverflow
       {
         /* Give user a chance to reallocate the stack.  Use copies of
            these so that the &'s don't force the real ones into
            memory.  */
+        yy_state_t *yyss1 = yyss;
         YYSTYPE *yyvs1 = yyvs;
-        yytype_int16 *yyss1 = yyss;
 
         /* Each stack pointer address is followed by the size of the
            data in use in that stack, in bytes.  This used to be a
            conditional around just the two extra args, but that might
            be undefined if yyoverflow is a macro.  */
         yyoverflow (YY_("memory exhausted"),
-                    &yyss1, yysize * sizeof (*yyssp),
-                    &yyvs1, yysize * sizeof (*yyvsp),
+                    &yyss1, yysize * YYSIZEOF (*yyssp),
+                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
                     &yystacksize);
-
         yyss = yyss1;
         yyvs = yyvs1;
       }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
-      goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
       /* Extend the stack our own way.  */
       if (YYMAXDEPTH <= yystacksize)
-        goto yyexhaustedlab;
+        YYNOMEM;
       yystacksize *= 2;
       if (YYMAXDEPTH < yystacksize)
         yystacksize = YYMAXDEPTH;
 
       {
-        yytype_int16 *yyss1 = yyss;
+        yy_state_t *yyss1 = yyss;
         union yyalloc *yyptr =
-          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+          YY_CAST (union yyalloc *,
+                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
         if (! yyptr)
-          goto yyexhaustedlab;
+          YYNOMEM;
         YYSTACK_RELOCATE (yyss_alloc, yyss);
         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
@@ -1228,30 +1168,31 @@
           YYSTACK_FREE (yyss1);
       }
 # endif
-#endif /* no yyoverflow */
 
       yyssp = yyss + yysize - 1;
       yyvsp = yyvs + yysize - 1;
 
-      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                  (unsigned long int) yystacksize));
+      YY_IGNORE_USELESS_CAST_BEGIN
+      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+                  YY_CAST (long, yystacksize)));
+      YY_IGNORE_USELESS_CAST_END
 
       if (yyss + yystacksize - 1 <= yyssp)
         YYABORT;
     }
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
 
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
   if (yystate == YYFINAL)
     YYACCEPT;
 
   goto yybackup;
 
+
 /*-----------.
 | yybackup.  |
 `-----------*/
 yybackup:
-
   /* Do appropriate processing given the current state.  Read a
      lookahead token if we need one and don't already have one.  */
 
@@ -1262,18 +1203,29 @@
 
   /* Not known => get a lookahead token if don't already have one.  */
 
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
+  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
   if (yychar == YYEMPTY)
     {
-      YYDPRINTF ((stderr, "Reading a token: "));
+      YYDPRINTF ((stderr, "Reading a token\n"));
       yychar = yylex (&yylval, scanner);
     }
 
   if (yychar <= YYEOF)
     {
-      yychar = yytoken = YYEOF;
+      yychar = YYEOF;
+      yytoken = YYSYMBOL_YYEOF;
       YYDPRINTF ((stderr, "Now at end of input.\n"));
     }
+  else if (yychar == YYerror)
+    {
+      /* The scanner already issued an error message, process directly
+         to error recovery.  But do not keep the error token as
+         lookahead, it is too special and may lead us to an endless
+         loop in error recovery. */
+      yychar = YYUNDEF;
+      yytoken = YYSYMBOL_YYerror;
+      goto yyerrlab1;
+    }
   else
     {
       yytoken = YYTRANSLATE (yychar);
@@ -1301,15 +1253,13 @@
 
   /* Shift the lookahead token.  */
   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
-  /* Discard the shifted token.  */
-  yychar = YYEMPTY;
-
   yystate = yyn;
   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
   YY_IGNORE_MAYBE_UNINITIALIZED_END
 
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
   goto yynewstate;
 
 
@@ -1324,7 +1274,7 @@
 
 
 /*-----------------------------.
-| yyreduce -- Do a reduction.  |
+| yyreduce -- do a reduction.  |
 `-----------------------------*/
 yyreduce:
   /* yyn is the number of a rule to reduce with.  */
@@ -1344,9 +1294,9 @@
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     {
-        case 11:
-#line 115 "grammar.y" /* yacc.c:1646  */
-    {
+  case 11: /* $@1: %empty  */
+#line 117 "grammar.y"
+  {
     ctx->setting = config_setting_add(ctx->parent, (yyvsp[0].sval), CONFIG_TYPE_NONE);
 
     if(ctx->setting == NULL)
@@ -1359,12 +1309,12 @@
       CAPTURE_PARSE_POS(ctx->setting);
     }
   }
-#line 1363 "grammar.c" /* yacc.c:1646  */
+#line 1313 "grammar.c"
     break;
 
-  case 13:
-#line 134 "grammar.y" /* yacc.c:1646  */
-    {
+  case 13: /* $@2: %empty  */
+#line 136 "grammar.y"
+  {
     if(IN_LIST())
     {
       ctx->parent = config_setting_add(ctx->parent, NULL, CONFIG_TYPE_ARRAY);
@@ -1377,21 +1327,21 @@
       ctx->setting = NULL;
     }
   }
-#line 1381 "grammar.c" /* yacc.c:1646  */
+#line 1331 "grammar.c"
     break;
 
-  case 14:
-#line 149 "grammar.y" /* yacc.c:1646  */
-    {
+  case 14: /* array: TOK_ARRAY_START $@2 simple_value_list_optional TOK_ARRAY_END  */
+#line 151 "grammar.y"
+  {
     if(ctx->parent)
       ctx->parent = ctx->parent->parent;
   }
-#line 1390 "grammar.c" /* yacc.c:1646  */
+#line 1340 "grammar.c"
     break;
 
-  case 15:
-#line 157 "grammar.y" /* yacc.c:1646  */
-    {
+  case 15: /* $@3: %empty  */
+#line 159 "grammar.y"
+  {
     if(IN_LIST())
     {
       ctx->parent = config_setting_add(ctx->parent, NULL, CONFIG_TYPE_LIST);
@@ -1404,33 +1354,33 @@
       ctx->setting = NULL;
     }
   }
-#line 1408 "grammar.c" /* yacc.c:1646  */
+#line 1358 "grammar.c"
     break;
 
-  case 16:
-#line 172 "grammar.y" /* yacc.c:1646  */
-    {
+  case 16: /* list: TOK_LIST_START $@3 value_list_optional TOK_LIST_END  */
+#line 174 "grammar.y"
+  {
     if(ctx->parent)
       ctx->parent = ctx->parent->parent;
   }
-#line 1417 "grammar.c" /* yacc.c:1646  */
+#line 1367 "grammar.c"
     break;
 
-  case 21:
-#line 186 "grammar.y" /* yacc.c:1646  */
-    { libconfig_parsectx_append_string(ctx, (yyvsp[0].sval)); free((yyvsp[0].sval)); }
-#line 1423 "grammar.c" /* yacc.c:1646  */
+  case 21: /* string: TOK_STRING  */
+#line 188 "grammar.y"
+             { libconfig_parsectx_append_string(ctx, (yyvsp[0].sval)); free((yyvsp[0].sval)); }
+#line 1373 "grammar.c"
     break;
 
-  case 22:
-#line 187 "grammar.y" /* yacc.c:1646  */
-    { libconfig_parsectx_append_string(ctx, (yyvsp[0].sval)); free((yyvsp[0].sval)); }
-#line 1429 "grammar.c" /* yacc.c:1646  */
+  case 22: /* string: string TOK_STRING  */
+#line 189 "grammar.y"
+                      { libconfig_parsectx_append_string(ctx, (yyvsp[0].sval)); free((yyvsp[0].sval)); }
+#line 1379 "grammar.c"
     break;
 
-  case 23:
-#line 192 "grammar.y" /* yacc.c:1646  */
-    {
+  case 23: /* simple_value: TOK_BOOLEAN  */
+#line 194 "grammar.y"
+  {
     if(IN_ARRAY() || IN_LIST())
     {
       config_setting_t *e = config_setting_set_bool_elem(ctx->parent, -1,
@@ -1449,12 +1399,12 @@
     else
       config_setting_set_bool(ctx->setting, (int)(yyvsp[0].ival));
   }
-#line 1453 "grammar.c" /* yacc.c:1646  */
+#line 1403 "grammar.c"
     break;
 
-  case 24:
-#line 212 "grammar.y" /* yacc.c:1646  */
-    {
+  case 24: /* simple_value: TOK_INTEGER  */
+#line 214 "grammar.y"
+  {
     if(IN_ARRAY() || IN_LIST())
     {
       config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[0].ival));
@@ -1475,12 +1425,12 @@
       config_setting_set_format(ctx->setting, CONFIG_FORMAT_DEFAULT);
     }
   }
-#line 1479 "grammar.c" /* yacc.c:1646  */
+#line 1429 "grammar.c"
     break;
 
-  case 25:
-#line 234 "grammar.y" /* yacc.c:1646  */
-    {
+  case 25: /* simple_value: TOK_INTEGER64  */
+#line 236 "grammar.y"
+  {
     if(IN_ARRAY() || IN_LIST())
     {
       config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[0].llval));
@@ -1501,12 +1451,12 @@
       config_setting_set_format(ctx->setting, CONFIG_FORMAT_DEFAULT);
     }
   }
-#line 1505 "grammar.c" /* yacc.c:1646  */
+#line 1455 "grammar.c"
     break;
 
-  case 26:
-#line 256 "grammar.y" /* yacc.c:1646  */
-    {
+  case 26: /* simple_value: TOK_HEX  */
+#line 258 "grammar.y"
+  {
     if(IN_ARRAY() || IN_LIST())
     {
       config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[0].ival));
@@ -1527,12 +1477,12 @@
       config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX);
     }
   }
-#line 1531 "grammar.c" /* yacc.c:1646  */
+#line 1481 "grammar.c"
     break;
 
-  case 27:
-#line 278 "grammar.y" /* yacc.c:1646  */
-    {
+  case 27: /* simple_value: TOK_HEX64  */
+#line 280 "grammar.y"
+  {
     if(IN_ARRAY() || IN_LIST())
     {
       config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[0].llval));
@@ -1553,12 +1503,12 @@
       config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX);
     }
   }
-#line 1557 "grammar.c" /* yacc.c:1646  */
+#line 1507 "grammar.c"
     break;
 
-  case 28:
-#line 300 "grammar.y" /* yacc.c:1646  */
-    {
+  case 28: /* simple_value: TOK_FLOAT  */
+#line 302 "grammar.y"
+  {
     if(IN_ARRAY() || IN_LIST())
     {
       config_setting_t *e = config_setting_set_float_elem(ctx->parent, -1, (yyvsp[0].fval));
@@ -1575,12 +1525,12 @@
     else
       config_setting_set_float(ctx->setting, (yyvsp[0].fval));
   }
-#line 1579 "grammar.c" /* yacc.c:1646  */
+#line 1529 "grammar.c"
     break;
 
-  case 29:
-#line 318 "grammar.y" /* yacc.c:1646  */
-    {
+  case 29: /* simple_value: string  */
+#line 320 "grammar.y"
+  {
     if(IN_ARRAY() || IN_LIST())
     {
       const char *s = libconfig_parsectx_take_string(ctx);
@@ -1604,12 +1554,12 @@
       __delete(s);
     }
   }
-#line 1608 "grammar.c" /* yacc.c:1646  */
+#line 1558 "grammar.c"
     break;
 
-  case 40:
-#line 368 "grammar.y" /* yacc.c:1646  */
-    {
+  case 40: /* $@4: %empty  */
+#line 370 "grammar.y"
+  {
     if(IN_LIST())
     {
       ctx->parent = config_setting_add(ctx->parent, NULL, CONFIG_TYPE_GROUP);
@@ -1622,20 +1572,21 @@
       ctx->setting = NULL;
     }
   }
-#line 1626 "grammar.c" /* yacc.c:1646  */
+#line 1576 "grammar.c"
     break;
 
-  case 41:
-#line 383 "grammar.y" /* yacc.c:1646  */
-    {
+  case 41: /* group: TOK_GROUP_START $@4 setting_list_optional TOK_GROUP_END  */
+#line 385 "grammar.y"
+  {
     if(ctx->parent)
       ctx->parent = ctx->parent->parent;
   }
-#line 1635 "grammar.c" /* yacc.c:1646  */
+#line 1585 "grammar.c"
     break;
 
 
-#line 1639 "grammar.c" /* yacc.c:1646  */
+#line 1589 "grammar.c"
+
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -1649,25 +1600,23 @@
      case of YYERROR or YYBACKUP, subsequent parser actions might lead
      to an incorrect destructor call or verbose syntax error message
      before the lookahead is translated.  */
-  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
 
   YYPOPSTACK (yylen);
   yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
 
   *++yyvsp = yyval;
 
   /* Now 'shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
-  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTOKENS];
+  {
+    const int yylhs = yyr1[yyn] - YYNTOKENS;
+    const int yyi = yypgoto[yylhs] + *yyssp;
+    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+               ? yytable[yyi]
+               : yydefgoto[yylhs]);
+  }
 
   goto yynewstate;
 
@@ -1678,50 +1627,14 @@
 yyerrlab:
   /* Make sure we have latest lookahead translation.  See comments at
      user semantic actions for why this is necessary.  */
-  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
+  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
   /* If not already recovering from an error, report this error.  */
   if (!yyerrstatus)
     {
       ++yynerrs;
-#if ! YYERROR_VERBOSE
       yyerror (scanner, ctx, scan_ctx, YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
-                                        yyssp, yytoken)
-      {
-        char const *yymsgp = YY_("syntax error");
-        int yysyntax_error_status;
-        yysyntax_error_status = YYSYNTAX_ERROR;
-        if (yysyntax_error_status == 0)
-          yymsgp = yymsg;
-        else if (yysyntax_error_status == 1)
-          {
-            if (yymsg != yymsgbuf)
-              YYSTACK_FREE (yymsg);
-            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
-            if (!yymsg)
-              {
-                yymsg = yymsgbuf;
-                yymsg_alloc = sizeof yymsgbuf;
-                yysyntax_error_status = 2;
-              }
-            else
-              {
-                yysyntax_error_status = YYSYNTAX_ERROR;
-                yymsgp = yymsg;
-              }
-          }
-        yyerror (scanner, ctx, scan_ctx, yymsgp);
-        if (yysyntax_error_status == 2)
-          goto yyexhaustedlab;
-      }
-# undef YYSYNTAX_ERROR
-#endif
     }
 
-
-
   if (yyerrstatus == 3)
     {
       /* If just tried and failed to reuse lookahead token after an
@@ -1750,12 +1663,11 @@
 | yyerrorlab -- error raised explicitly by YYERROR.  |
 `---------------------------------------------------*/
 yyerrorlab:
-
-  /* Pacify compilers like GCC when the user code never invokes
-     YYERROR and the label yyerrorlab therefore never appears in user
-     code.  */
-  if (/*CONSTCOND*/ 0)
-     goto yyerrorlab;
+  /* Pacify compilers when the user code never invokes YYERROR and the
+     label yyerrorlab therefore never appears in user code.  */
+  if (0)
+    YYERROR;
+  ++yynerrs;
 
   /* Do not reclaim the symbols of the rule whose action triggered
      this YYERROR.  */
@@ -1772,13 +1684,14 @@
 yyerrlab1:
   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
+  /* Pop stack until we find a state that shifts the error token.  */
   for (;;)
     {
       yyn = yypact[yystate];
       if (!yypact_value_is_default (yyn))
         {
-          yyn += YYTERROR;
-          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+          yyn += YYSYMBOL_YYerror;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
             {
               yyn = yytable[yyn];
               if (0 < yyn)
@@ -1792,7 +1705,7 @@
 
 
       yydestruct ("Error: popping",
-                  yystos[yystate], yyvsp, scanner, ctx, scan_ctx);
+                  YY_ACCESSING_SYMBOL (yystate), yyvsp, scanner, ctx, scan_ctx);
       YYPOPSTACK (1);
       yystate = *yyssp;
       YY_STACK_PRINT (yyss, yyssp);
@@ -1804,7 +1717,7 @@
 
 
   /* Shift the error token.  */
-  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
 
   yystate = yyn;
   goto yynewstate;
@@ -1815,26 +1728,30 @@
 `-------------------------------------*/
 yyacceptlab:
   yyresult = 0;
-  goto yyreturn;
+  goto yyreturnlab;
+
 
 /*-----------------------------------.
 | yyabortlab -- YYABORT comes here.  |
 `-----------------------------------*/
 yyabortlab:
   yyresult = 1;
-  goto yyreturn;
+  goto yyreturnlab;
 
-#if !defined yyoverflow || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here.  |
-`-------------------------------------------------*/
+
+/*-----------------------------------------------------------.
+| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
+`-----------------------------------------------------------*/
 yyexhaustedlab:
   yyerror (scanner, ctx, scan_ctx, YY_("memory exhausted"));
   yyresult = 2;
-  /* Fall through.  */
-#endif
+  goto yyreturnlab;
 
-yyreturn:
+
+/*----------------------------------------------------------.
+| yyreturnlab -- parsing is finished, clean up and return.  |
+`----------------------------------------------------------*/
+yyreturnlab:
   if (yychar != YYEMPTY)
     {
       /* Make sure we have latest lookahead translation.  See comments at
@@ -1850,18 +1767,16 @@
   while (yyssp != yyss)
     {
       yydestruct ("Cleanup: popping",
-                  yystos[*yyssp], yyvsp, scanner, ctx, scan_ctx);
+                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, scanner, ctx, scan_ctx);
       YYPOPSTACK (1);
     }
 #ifndef yyoverflow
   if (yyss != yyssa)
     YYSTACK_FREE (yyss);
 #endif
-#if YYERROR_VERBOSE
-  if (yymsg != yymsgbuf)
-    YYSTACK_FREE (yymsg);
-#endif
+
   return yyresult;
 }
-#line 389 "grammar.y" /* yacc.c:1906  */
+
+#line 391 "grammar.y"
 
diff --git a/lib/grammar.h b/lib/grammar.h
index 9b746df..84fa1c9 100644
--- a/lib/grammar.h
+++ b/lib/grammar.h
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
+/* A Bison parser, made by GNU Bison 3.8.  */
 
 /* Bison interface for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
+   Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -15,7 +16,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -30,6 +31,10 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+   especially those whose name start with YY_ or yy_.  They are
+   private implementation details that can be changed or removed.  */
+
 #ifndef YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED
 # define YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED
 /* Debug traces.  */
@@ -40,34 +45,43 @@
 extern int libconfig_yydebug;
 #endif
 
-/* Token type.  */
+/* Token kinds.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
   enum yytokentype
   {
-    TOK_BOOLEAN = 258,
-    TOK_INTEGER = 259,
-    TOK_HEX = 260,
-    TOK_INTEGER64 = 261,
-    TOK_HEX64 = 262,
-    TOK_FLOAT = 263,
-    TOK_STRING = 264,
-    TOK_NAME = 265,
-    TOK_EQUALS = 266,
-    TOK_NEWLINE = 267,
-    TOK_ARRAY_START = 268,
-    TOK_ARRAY_END = 269,
-    TOK_LIST_START = 270,
-    TOK_LIST_END = 271,
-    TOK_COMMA = 272,
-    TOK_GROUP_START = 273,
-    TOK_GROUP_END = 274,
-    TOK_SEMICOLON = 275,
-    TOK_GARBAGE = 276,
-    TOK_ERROR = 277
+    YYEMPTY = -2,
+    YYEOF = 0,                     /* "end of file"  */
+    YYerror = 256,                 /* error  */
+    YYUNDEF = 257,                 /* "invalid token"  */
+    TOK_BOOLEAN = 258,             /* TOK_BOOLEAN  */
+    TOK_INTEGER = 259,             /* TOK_INTEGER  */
+    TOK_HEX = 260,                 /* TOK_HEX  */
+    TOK_INTEGER64 = 261,           /* TOK_INTEGER64  */
+    TOK_HEX64 = 262,               /* TOK_HEX64  */
+    TOK_FLOAT = 263,               /* TOK_FLOAT  */
+    TOK_STRING = 264,              /* TOK_STRING  */
+    TOK_NAME = 265,                /* TOK_NAME  */
+    TOK_EQUALS = 266,              /* TOK_EQUALS  */
+    TOK_NEWLINE = 267,             /* TOK_NEWLINE  */
+    TOK_ARRAY_START = 268,         /* TOK_ARRAY_START  */
+    TOK_ARRAY_END = 269,           /* TOK_ARRAY_END  */
+    TOK_LIST_START = 270,          /* TOK_LIST_START  */
+    TOK_LIST_END = 271,            /* TOK_LIST_END  */
+    TOK_COMMA = 272,               /* TOK_COMMA  */
+    TOK_GROUP_START = 273,         /* TOK_GROUP_START  */
+    TOK_GROUP_END = 274,           /* TOK_GROUP_END  */
+    TOK_SEMICOLON = 275,           /* TOK_SEMICOLON  */
+    TOK_GARBAGE = 276,             /* TOK_GARBAGE  */
+    TOK_ERROR = 277                /* TOK_ERROR  */
   };
+  typedef enum yytokentype yytoken_kind_t;
 #endif
-/* Tokens.  */
+/* Token kinds.  */
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYerror 256
+#define YYUNDEF 257
 #define TOK_BOOLEAN 258
 #define TOK_INTEGER 259
 #define TOK_HEX 260
@@ -91,19 +105,18 @@
 
 /* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
 union YYSTYPE
 {
-#line 76 "grammar.y" /* yacc.c:1909  */
+#line 78 "grammar.y"
 
   int ival;
   long long llval;
   double fval;
   char *sval;
 
-#line 105 "grammar.h" /* yacc.c:1909  */
-};
+#line 118 "grammar.h"
 
+};
 typedef union YYSTYPE YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define YYSTYPE_IS_DECLARED 1
@@ -111,6 +124,14 @@
 
 
 
+#if !defined libconfig_yyerror && !defined YYERROR_IS_DECLARED
+void libconfig_yyerror (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx, const char *msg);
+#endif
+#if !defined libconfig_yylex && !defined YYLEX_IS_DECLARED
+int libconfig_yylex (YYSTYPE *yylvalp, void *scanner);
+#endif
+
 int libconfig_yyparse (void *scanner, struct parse_context *ctx, struct scan_context *scan_ctx);
 
+
 #endif /* !YY_LIBCONFIG_YY_GRAMMAR_H_INCLUDED  */
diff --git a/lib/grammar.y b/lib/grammar.y
index 87dac00..f614fa7 100644
--- a/lib/grammar.y
+++ b/lib/grammar.y
@@ -1,7 +1,7 @@
 /* -*- mode: C -*- */
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -43,6 +43,8 @@
 extern int libconfig_yylex();
 extern int libconfig_yyget_lineno();
 
+#define YYMALLOC libconfig_malloc
+
 static const char *err_array_elem_type = "mismatched element type in array";
 static const char *err_duplicate_setting = "duplicate setting name";
 
diff --git a/lib/libconfig.c b/lib/libconfig.c
index 2f3cbfa..f6fefb8 100644
--- a/lib/libconfig.c
+++ b/lib/libconfig.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2020  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -125,32 +125,6 @@
 
 /* ------------------------------------------------------------------------- */
 
-static int __config_name_compare(const char *a, const char *b)
-{
-  const char *p, *q;
-
-  for(p = a, q = b; ; p++, q++)
-  {
-    int pd = ((! *p) || strchr(PATH_TOKENS, *p));
-    int qd = ((! *q) || strchr(PATH_TOKENS, *q));
-
-    if(pd && qd)
-      break;
-    else if(pd)
-      return(-1);
-    else if(qd)
-      return(1);
-    else if(*p < *q)
-      return(-1);
-    else if(*p > *q)
-      return(1);
-  }
-
-  return(0);
-}
-
-/* ------------------------------------------------------------------------- */
-
 static void __config_indent(FILE *stream, int depth, unsigned short w)
 {
   if(w)
@@ -374,7 +348,7 @@
 {
   if((list->length % CHUNK_SIZE) == 0)
   {
-    list->elements = (config_setting_t **)realloc(
+    list->elements = (config_setting_t **)libconfig_realloc(
       list->elements,
       (list->length + CHUNK_SIZE) * sizeof(config_setting_t *));
   }
@@ -385,14 +359,18 @@
 
 /* ------------------------------------------------------------------------- */
 
+/* This function takes the length of the name to be searched for, so that one
+ * component of a longer path can be passed in.
+ */
 static config_setting_t *__config_list_search(config_list_t *list,
                                               const char *name,
+                                              size_t namelen,
                                               unsigned int *idx)
 {
   config_setting_t **found = NULL;
   unsigned int i;
 
-  if(! list)
+  if(! list || ! name)
     return(NULL);
 
   for(i = 0, found = list->elements; i < list->length; i++, found++)
@@ -400,7 +378,8 @@
     if(! (*found)->name)
       continue;
 
-    if(! __config_name_compare(name, (*found)->name))
+    if((strlen((*found)->name) == namelen)
+        && !strncmp(name, (*found)->name, namelen))
     {
       if(idx)
         *idx = i;
@@ -653,7 +632,7 @@
   if(stream != NULL)
   {
     // On some operating systems, fopen() succeeds on a directory.
-    int fd = fileno(stream);
+    int fd = posix_fileno(stream);
     struct stat statbuf;
 
     if(fstat(fd, &statbuf) == 0)
@@ -696,11 +675,11 @@
 
   if(config_get_option(config, CONFIG_OPTION_FSYNC))
   {
-    int fd = fileno(stream);
+    int fd = posix_fileno(stream);
 
     if(fd >= 0)
     {
-      if(fsync(fd) != 0)
+      if(posix_fsync(fd) != 0)
       {
         fclose(stream);
         config->error_text = __io_error;
@@ -825,6 +804,12 @@
 
 /* ------------------------------------------------------------------------- */
 
+void config_set_fatal_error_func(config_fatal_error_fn_t func) {
+  libconfig_set_fatal_error_func(func);
+}
+
+/* ------------------------------------------------------------------------- */
+
 static config_setting_t *config_setting_create(config_setting_t *parent,
                                                const char *name, int type)
 {
@@ -1192,7 +1177,7 @@
 
 /* ------------------------------------------------------------------------- */
 
-int config_setting_set_format(config_setting_t *setting, short format)
+int config_setting_set_format(config_setting_t *setting, unsigned short format)
 {
   if(((setting->type != CONFIG_TYPE_INT)
       && (setting->type != CONFIG_TYPE_INT64))
@@ -1206,7 +1191,7 @@
 
 /* ------------------------------------------------------------------------- */
 
-short config_setting_get_format(const config_setting_t *setting)
+unsigned short config_setting_get_format(const config_setting_t *setting)
 {
   return(setting->format != 0 ? setting->format
          : setting->config->default_format);
@@ -1214,33 +1199,51 @@
 
 /* ------------------------------------------------------------------------- */
 
-config_setting_t *config_setting_lookup(config_setting_t *setting,
-                                        const char *path)
+const config_setting_t *config_setting_lookup_const(
+  const config_setting_t *setting, const char *path)
 {
   const char *p = path;
-  config_setting_t *found = setting;
+  const config_setting_t *found = setting;
 
-  for(;;)
+  while(*p && found)
   {
-    while(*p && strchr(PATH_TOKENS, *p))
-      p++;
-
-    if(! *p)
-      break;
+    if(strchr(PATH_TOKENS, *p))
+      ++p;
 
     if(*p == '[')
-      found = config_setting_get_elem(found, atoi(++p));
+    {
+      char *q;
+      long index = strtol(++p, &q, 10);
+      if(*q != ']')
+        return NULL;
+
+      p = ++q;
+      found = config_setting_get_elem(found, index);
+    }
+    else if(found->type == CONFIG_TYPE_GROUP)
+    {
+      const char *q = p;
+
+      while(*q && !strchr(PATH_TOKENS, *q))
+        ++q;
+
+      found = __config_list_search(found->value.list, p, (size_t)(q - p),
+                                   NULL);
+      p = q;
+    }
     else
-      found = config_setting_get_member(found, p);
-
-    if(! found)
       break;
-
-    while(! strchr(PATH_TOKENS, *p))
-      p++;
   }
 
-  return(*p || (found == setting) ? NULL : found);
+  return((*p || (found == setting)) ? NULL : found);
+}
+
+/* ------------------------------------------------------------------------- */
+
+config_setting_t *config_setting_lookup(const config_setting_t *setting,
+                                        const char *path)
+{
+  return((config_setting_t *)config_setting_lookup_const(setting, path));
 }
 
 /* ------------------------------------------------------------------------- */
@@ -1252,6 +1255,14 @@
 
 /* ------------------------------------------------------------------------- */
 
+const config_setting_t *config_lookup_const(const config_t *config,
+                                            const char *path)
+{
+  return(config_setting_lookup(config->root, path));
+}
+
+/* ------------------------------------------------------------------------- */
+
 int config_lookup_string(const config_t *config, const char *path,
                          const char **value)
 {
@@ -1559,7 +1570,10 @@
   if(setting->type != CONFIG_TYPE_GROUP)
     return(NULL);
 
-  return(__config_list_search(setting->value.list, name, NULL));
+  if(!name)
+    return(NULL);
+
+  return(__config_list_search(setting->value.list, name, strlen(name), NULL));
 }
 
 /* ------------------------------------------------------------------------- */
@@ -1647,7 +1661,7 @@
   const char *settingName;
   const char *lastFound;
 
-  if(! parent)
+  if(! parent || !name)
     return(CONFIG_FALSE);
 
   if(parent->type != CONFIG_TYPE_GROUP)
@@ -1670,9 +1684,11 @@
       break;
     }
 
-  }while(*++settingName);
+  }
+  while(*++settingName);
 
-  if(!(setting = __config_list_search(setting->parent->value.list, settingName, &idx)))
+  if(!(setting = __config_list_search(setting->parent->value.list, settingName,
+                                      strlen(settingName), &idx)))
     return(CONFIG_FALSE);
 
   __config_list_remove(setting->parent->value.list, idx);
@@ -1741,7 +1757,7 @@
 
   if(include_dir && IS_RELATIVE_PATH(path))
   {
-    file = (char *)malloc(strlen(include_dir) + strlen(path) + 2);
+    file = (char *)libconfig_malloc(strlen(include_dir) + strlen(path) + 2);
     strcpy(file, include_dir);
     strcat(file, FILE_SEPARATOR);
     strcat(file, path);
@@ -1751,7 +1767,7 @@
 
   *error = NULL;
 
-  files = (const char **)malloc(sizeof(char **) * 2);
+  files = (const char **)libconfig_malloc(sizeof(char **) * 2);
   files[0] = file;
   files[1] = NULL;
 
diff --git a/lib/libconfig.h b/lib/libconfig.h
index 5e4eea3..d8288da 100644
--- a/lib/libconfig.h
+++ b/lib/libconfig.h
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -41,7 +41,7 @@
 
 #define LIBCONFIG_VER_MAJOR    1
 #define LIBCONFIG_VER_MINOR    7
-#define LIBCONFIG_VER_REVISION 0
+#define LIBCONFIG_VER_REVISION 4
 
 #include <stdio.h>
 
@@ -82,8 +82,8 @@
 typedef struct config_setting_t
 {
   char *name;
-  short type;
-  short format;
+  unsigned short type;
+  unsigned short format;
   config_value_t value;
   struct config_setting_t *parent;
   struct config_t *config;
@@ -110,6 +110,8 @@
                                              const char *,
                                              const char **);
 
+typedef void (*config_fatal_error_fn_t)(const char *);
+
 typedef struct config_t
 {
   config_setting_t *root;
@@ -132,7 +134,7 @@
 extern LIBCONFIG_API void config_write(const config_t *config, FILE *stream);
 
 extern LIBCONFIG_API void config_set_default_format(config_t *config,
-                                                    short format);
+                                                    unsigned short format);
 
 extern LIBCONFIG_API void config_set_options(config_t *config, int options);
 extern LIBCONFIG_API int config_get_options(const config_t *config);
@@ -173,6 +175,9 @@
 extern LIBCONFIG_API void config_destroy(config_t *config);
 extern LIBCONFIG_API void config_clear(config_t *config);
 
+extern LIBCONFIG_API void config_set_fatal_error_func(
+  config_fatal_error_fn_t func);
+
 extern LIBCONFIG_API int config_setting_get_int(
   const config_setting_t *setting);
 extern LIBCONFIG_API long long config_setting_get_int64(
@@ -207,8 +212,8 @@
                                                    const char *value);
 
 extern LIBCONFIG_API int config_setting_set_format(config_setting_t *setting,
-                                                   short format);
-extern LIBCONFIG_API short config_setting_get_format(
+                                                   unsigned short format);
+extern LIBCONFIG_API unsigned short config_setting_get_format(
   const config_setting_t *setting);
 
 extern LIBCONFIG_API int config_setting_get_int_elem(
@@ -301,8 +306,13 @@
 
 extern LIBCONFIG_API config_setting_t *config_lookup(const config_t *config,
                                                      const char *path);
+extern LIBCONFIG_API const config_setting_t *config_lookup_const(
+  const config_t *config, const char *path);
+  
 extern LIBCONFIG_API config_setting_t *config_setting_lookup(
-  config_setting_t *setting, const char *path);
+  const config_setting_t *setting, const char *path);
+extern LIBCONFIG_API const config_setting_t *config_setting_lookup_const(
+  const config_setting_t *setting, const char *path);
 
 extern LIBCONFIG_API int config_lookup_int(const config_t *config,
                                            const char *path, int *value);
@@ -322,10 +332,10 @@
   ((C)->root)
 
 #define  /* void */ config_set_default_format(/* config_t * */ C,       \
-                                              /* short */ F)            \
+                                              /* unsigned short */ F)   \
   (C)->default_format = (F)
 
-#define /* short */ config_get_default_format(/* config_t * */ C)       \
+#define /* unsigned short */ config_get_default_format(/* config_t * */ C) \
   ((C)->default_format)
 
 #define /* unsigned short */ config_setting_source_line(   \
diff --git a/lib/libconfig.h++ b/lib/libconfig.h++
index 18578fa..548ce17 100644
--- a/lib/libconfig.h++
+++ b/lib/libconfig.h++
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -41,7 +41,7 @@
 
 #define LIBCONFIGXX_VER_MAJOR    1
 #define LIBCONFIGXX_VER_MINOR    7
-#define LIBCONFIGXX_VER_REVISION 0
+#define LIBCONFIGXX_VER_REVISION 4
 
 #if __cplusplus < 201103L
 #define LIBCONFIGXX_NOEXCEPT throw()
@@ -94,6 +94,17 @@
   virtual const char *what() const LIBCONFIGXX_NOEXCEPT;
 };
 
+class LIBCONFIGXX_API SettingRangeException : public SettingException
+{
+  public:
+
+  SettingRangeException(const Setting &setting);
+  SettingRangeException(const Setting &setting, int idx);
+  SettingRangeException(const Setting &setting, const char *name);
+
+  virtual const char *what() const LIBCONFIGXX_NOEXCEPT;
+};
+
 class LIBCONFIGXX_API SettingNotFoundException : public SettingException
 {
   public:
diff --git a/lib/libconfig.hh b/lib/libconfig.hh
index a3257d0..6ba0893 100644
--- a/lib/libconfig.hh
+++ b/lib/libconfig.hh
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A structured configuration file parsing library
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/lib/libconfigcpp.c++ b/lib/libconfigcpp.c++
index add44f5..038f162 100644
--- a/lib/libconfigcpp.c++
+++ b/lib/libconfigcpp.c++
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -49,6 +49,15 @@
 
 // ---------------------------------------------------------------------------
 
+static void __fatal_error_func(const char *message)
+{
+  // Assume memory allocation failure; this is the only fatal error
+  // condition currently defined.
+  throw std::bad_alloc();
+}
+
+// ---------------------------------------------------------------------------
+
 ParseException::ParseException(const char *file, int line, const char *error)
   : _file(file ? ::strdup(file) : NULL), _line(line), _error(error)
 {
@@ -255,6 +264,35 @@
 
 // ---------------------------------------------------------------------------
 
+SettingRangeException::SettingRangeException(const Setting &setting)
+  : SettingException(setting)
+{
+}
+
+// ---------------------------------------------------------------------------
+
+SettingRangeException::SettingRangeException(const Setting &setting, int idx)
+  : SettingException(setting, idx)
+{
+}
+
+// ---------------------------------------------------------------------------
+
+SettingRangeException::SettingRangeException(const Setting &setting,
+                                             const char *name)
+  : SettingException(setting, name)
+{
+}
+
+// ---------------------------------------------------------------------------
+
+const char *SettingRangeException::what() const LIBCONFIGXX_NOEXCEPT
+{
+  return("SettingRangeException");
+}
+
+// ---------------------------------------------------------------------------
+
 SettingNotFoundException::SettingNotFoundException(const Setting &setting,
                                                    int idx)
   : SettingException(setting, idx)
@@ -322,6 +360,7 @@
   config_set_hook(_config, reinterpret_cast<void *>(this));
   config_set_destructor(_config, ConfigDestructor);
   config_set_include_func(_config, __include_func);
+  config_set_fatal_error_func(__fatal_error_func);
 }
 
 // ---------------------------------------------------------------------------
@@ -687,6 +726,15 @@
 
 Setting::operator int() const
 {
+  if(_type == TypeInt64)
+  {
+    long long val = config_setting_get_int64(_setting);
+    if((val < INT_MIN) || (val > INT_MAX))
+      throw SettingRangeException(*this);
+
+    return((int)val);
+  }
+
   assertType(TypeInt);
 
   return(config_setting_get_int(_setting));
@@ -696,9 +744,20 @@
 
 Setting::operator unsigned int() const
 {
+  if(_type == TypeInt64)
+  {
+    long long val = config_setting_get_int64(_setting);
+    if((val < 0) || (val > UINT_MAX))
+      throw SettingRangeException(*this);
+
+    return(static_cast<unsigned int>(val));
+  }
+
   assertType(TypeInt);
 
   int v = config_setting_get_int(_setting);
+  if(v < 0)
+    throw SettingRangeException(*this);
 
   return(static_cast<unsigned int>(v));
 }
@@ -727,6 +786,9 @@
 
 Setting::operator long long() const
 {
+  if(_type == TypeInt)
+    return((long long)config_setting_get_int(_setting));
+
   assertType(TypeInt64);
 
   return(config_setting_get_int64(_setting));
@@ -736,9 +798,20 @@
 
 Setting::operator unsigned long long() const
 {
+  if(_type == TypeInt)
+  {
+    int val = config_setting_get_int(_setting);
+    if(val < 0)
+      throw SettingRangeException(*this);
+
+    return(static_cast<unsigned long long>(val));
+  }
+
   assertType(TypeInt64);
 
   long long v = config_setting_get_int64(_setting);
+  if(v < 0)
+    throw SettingRangeException(*this);
 
   return(static_cast<unsigned long long>(v));
 }
diff --git a/lib/libconfigcpp.cc b/lib/libconfigcpp.cc
index cab4f64..b5ce1c3 100644
--- a/lib/libconfigcpp.cc
+++ b/lib/libconfigcpp.cc
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A structured configuration file parsing library
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/lib/parsectx.h b/lib/parsectx.h
index 02ce511..854278f 100644
--- a/lib/parsectx.h
+++ b/lib/parsectx.h
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2020  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/lib/scanctx.c b/lib/scanctx.c
index 02130ab..cc7d8ac 100644
--- a/lib/scanctx.c
+++ b/lib/scanctx.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2020  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/lib/scanctx.h b/lib/scanctx.h
index 3c5c374..cd8b6be 100644
--- a/lib/scanctx.h
+++ b/lib/scanctx.h
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2020  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/lib/scanner.l b/lib/scanner.l
index 035e2dd..57b9754 100644
--- a/lib/scanner.l
+++ b/lib/scanner.l
@@ -1,7 +1,7 @@
 /* -*- mode: C -*- */
 /* --------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2020  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -31,6 +31,7 @@
 %option header-file="scanner.h"
 %option outfile="lex.yy.c"
 %option extra-type="struct scan_context *"
+%option noyyalloc noyyrealloc
 
 %{
 
@@ -203,3 +204,15 @@
       yyterminate();
   }
 }
+
+%%
+
+void *libconfig_yyalloc(size_t bytes, void *yyscanner)
+{
+  return(libconfig_malloc(bytes));
+}
+
+void *libconfig_yyrealloc(void *ptr, size_t bytes, void *yyscanner)
+{
+  return(libconfig_realloc(ptr, bytes));
+}
diff --git a/lib/strbuf.c b/lib/strbuf.c
index fa2d913..c9763fb 100644
--- a/lib/strbuf.c
+++ b/lib/strbuf.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2020  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -38,7 +38,7 @@
   if(newlen > buf->capacity)
   {
     buf->capacity = (newlen + (STRING_BLOCK_SIZE - 1)) & mask;
-    buf->string = (char *)realloc(buf->string, buf->capacity);
+    buf->string = (char *)libconfig_realloc(buf->string, buf->capacity);
   }
 }
 
diff --git a/lib/strbuf.h b/lib/strbuf.h
index 0bc9b13..7385b05 100644
--- a/lib/strbuf.h
+++ b/lib/strbuf.h
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2020  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/lib/strvec.c b/lib/strvec.c
index e1c3daa..09289c2 100644
--- a/lib/strvec.c
+++ b/lib/strvec.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2020  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -34,7 +34,7 @@
   if(vec->length == vec->capacity)
   {
     vec->capacity += CHUNK_SIZE;
-    vec->strings = (const char **)realloc(
+    vec->strings = (const char **)libconfig_realloc(
         (void *)vec->strings,
         (vec->capacity + 1) * sizeof(const char *));
     vec->end = vec->strings + vec->length;
diff --git a/lib/strvec.h b/lib/strvec.h
index e90aa2c..2781afb 100644
--- a/lib/strvec.h
+++ b/lib/strvec.h
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2020  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
diff --git a/lib/util.c b/lib/util.c
index b4b00b8..80b5d99 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -30,6 +30,70 @@
 
 /* ------------------------------------------------------------------------- */
 
+void libconfig_fatal_error_handler(const char *message)
+{
+  if(posix_write(STDERR_FILENO, (const void *)message, strlen(message))) {}
+  abort();
+}
+
+/* ------------------------------------------------------------------------- */
+
+static void (*__libconfig_fatal_error_func)(const char *) =
+  libconfig_fatal_error_handler;
+
+static const char *__libconfig_malloc_failure_message =
+  "\alibconfig: memory allocation failure\n";
+
+/* ------------------------------------------------------------------------- */
+
+void libconfig_set_fatal_error_func(void (*func)(const char *))
+{
+  __libconfig_fatal_error_func = (func ? func
+                                  : libconfig_fatal_error_handler);
+}
+
+/* ------------------------------------------------------------------------- */
+
+void libconfig_fatal_error(const char *message)
+{
+  __libconfig_fatal_error_func(message);
+}
+
+/* ------------------------------------------------------------------------- */
+
+void *libconfig_malloc(size_t size)
+{
+  void *ptr = malloc(size);
+  if(!ptr)
+    libconfig_fatal_error(__libconfig_malloc_failure_message);
+
+  return(ptr);
+}
+
+/* ------------------------------------------------------------------------- */
+
+void *libconfig_calloc(size_t nmemb, size_t size)
+{
+  void *ptr = calloc(nmemb, size);
+  if(!ptr)
+    libconfig_fatal_error(__libconfig_malloc_failure_message);
+
+  return(ptr);
+}
+
+/* ------------------------------------------------------------------------- */
+
+void *libconfig_realloc(void *ptr, size_t size)
+{
+  ptr = realloc(ptr, size);
+  if(!ptr)
+    libconfig_fatal_error(__libconfig_malloc_failure_message);
+
+  return(ptr);
+}
+
+/* ------------------------------------------------------------------------- */
+
 long long libconfig_parse_integer(const char *s, int *ok)
 {
   long long llval;
diff --git a/lib/util.h b/lib/util.h
index 9cd2463..99d7e9f 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -23,7 +23,15 @@
 #include <string.h>
 #include <sys/types.h>
 
-#define __new(T) (T *)calloc(1, sizeof(T)) /* zeroed */
+extern void libconfig_set_fatal_error_func(void (*func)(const char *));
+
+extern void libconfig_fatal_error(const char *message);
+
+extern void *libconfig_malloc(size_t size);
+extern void *libconfig_calloc(size_t nmemb, size_t size);
+extern void *libconfig_realloc(void *ptr, size_t size);
+
+#define __new(T) (T *)libconfig_calloc(1, sizeof(T)) /* zeroed */
 #define __delete(P) free((void *)(P))
 #define __zero(P) memset((void *)(P), 0, sizeof(*P))
 
diff --git a/lib/wincompat.c b/lib/wincompat.c
index 8a243f9..a0fedfa 100644
--- a/lib/wincompat.c
+++ b/lib/wincompat.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -28,7 +28,7 @@
 #include <errno.h>
 #include <io.h>
 
-int fsync(int fd)
+int posix_fsync(int fd)
 {
   HANDLE h = (HANDLE)_get_osfhandle(fd);
   if(h == INVALID_HANDLE_VALUE)
diff --git a/lib/wincompat.h b/lib/wincompat.h
index 5de29c3..e45e667 100644
--- a/lib/wincompat.h
+++ b/lib/wincompat.h
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -33,6 +33,7 @@
 #define _STDLIB_H
 #endif
 
+#include <io.h>
 #include <malloc.h>
 
 #ifdef _MSC_VER
@@ -42,7 +43,13 @@
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
-#define fileno _fileno
+#define posix_fileno _fileno
+#define posix_write  _write
+
+/* Might be able to replace this with:
+#define posix_fsync  _commit
+*/
+extern int posix_fsync(int fd);
 
 #if _MSC_VER <= 1800
 #define snprintf  _snprintf
@@ -64,6 +71,10 @@
   || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) \
   || defined(__MINGW32__))
 
+#ifndef STDERR_FILENO
+#define STDERR_FILENO 2
+#endif
+
 #define INT64_FMT "%I64d"
 #define UINT64_FMT "%I64u"
 
@@ -101,9 +112,13 @@
 #define IS_RELATIVE_PATH(P) \
   (PathIsRelativeA(P))
 
-extern int fsync(int fd);
+#else /* !( defined(WIN32/WIN64) && ! defined(__MINGW32__) ) */
 
-#else /* defined(WIN32/WIN64) && ! defined(__MINGW32__) */
+#include <unistd.h> /* for fsync() */
+
+#define posix_fileno fileno
+#define posix_fsync  fsync
+#define posix_write  write
 
 #define INT64_CONST(I)  (I ## LL)
 #define UINT64_CONST(I) (I ## ULL)
@@ -111,8 +126,6 @@
 #define IS_RELATIVE_PATH(P) \
   ((P)[0] != '/')
 
-#include <unistd.h> /* for fsync() */
-
 #endif /* defined(WIN32/WIN64) && ! defined(__MINGW32__) */
 
 #endif /* __wincompat_h */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2a099c6..2e5bcd8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,4 +15,5 @@
 	tests.vcproj \
 	tests.vcxproj \
 	testdata/*.cfg \
-	testdata/*.txt
+	testdata/*.txt \
+	CMakeLists.txt
diff --git a/tests/testdata/nesting.cfg b/tests/testdata/nesting.cfg
new file mode 100644
index 0000000..3e37234
--- /dev/null
+++ b/tests/testdata/nesting.cfg
@@ -0,0 +1,6 @@
+
+foo = (
+  { string: "orange", number: 3, flag: false, array: [7, 13] },
+  { string: "blue", number: 11, flag: true, array: [1, 2, 3, 4] },
+  { string: "red", number: 7, flag: false, array: [77, 88] }
+)
diff --git a/tests/tests.c b/tests/tests.c
index c12a0c6..1637414 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
    libconfig - A library for processing structured configuration files
-   Copyright (C) 2005-2018  Mark A Lindner
+   Copyright (C) 2005-2023  Mark A Lindner
 
    This file is part of libconfig.
 
@@ -64,8 +64,8 @@
                                          const char *parse_error)
 {
   config_t cfg;
-  char actual_error[128];
-  char expected_error[128];
+  char actual_error[256];
+  char expected_error[256];
 
   config_init(&cfg);
   TT_ASSERT_FALSE(config_read_file(&cfg, input_file));
@@ -88,8 +88,8 @@
                                            const char *parse_error)
 {
   config_t cfg;
-  char actual_error[128];
-  char expected_error[128];
+  char actual_error[256];
+  char expected_error[256];
 
   config_init(&cfg);
   TT_ASSERT_FALSE(config_read_string(&cfg, input_text));
@@ -482,6 +482,15 @@
   TT_ASSERT_TRUE(ok);
   TT_ASSERT_STR_EQ("abc\"def\"", str);
 
+  ok = config_lookup_string(&cfg, "escape_seqs.dquote.[0]", &str);
+  TT_ASSERT_FALSE(ok);
+
+  ok = config_lookup_string(&cfg, "escape_seqs.dquote.extrajunk", &str);
+  TT_ASSERT_FALSE(ok);
+
+  ok = config_lookup_string(&cfg, "escape_seqs.dquote.", &str);
+  TT_ASSERT_TRUE(ok);
+
   config_destroy(&cfg);
 }
 
@@ -545,6 +554,116 @@
 
 /* ------------------------------------------------------------------------- */
 
+TT_TEST(SettingLookups)
+{
+  config_t cfg;
+  int ok;
+  int ival;
+  const char *str;
+  config_setting_t *setting, *parent;
+
+  config_init(&cfg);
+  config_set_options(&cfg, CONFIG_OPTION_ALLOW_OVERRIDES);
+  config_set_include_dir(&cfg, "./testdata");
+
+  ok = config_read_file(&cfg, "testdata/nesting.cfg");
+  if(!ok)
+  {
+    printf("error: %s:%d\n", config_error_text(&cfg),
+           config_error_line(&cfg));
+  }
+  TT_ASSERT_TRUE(ok);
+
+  ok = config_lookup_string(&cfg, "foo.[0].string", &str);
+  TT_ASSERT_TRUE(ok);
+  TT_ASSERT_STR_EQ("orange", str);
+
+  ok = config_lookup_int(&cfg, "foo.[1].array.[3]", &ival);
+  TT_ASSERT_TRUE(ok);
+  TT_ASSERT_INT_EQ(4, ival);
+
+  ok = config_lookup_bool(&cfg, "foo.[1].flag", &ival);
+  TT_ASSERT_TRUE(ok);
+  TT_ASSERT_INT_EQ(CONFIG_TRUE, ival);
+
+  ok = config_lookup_int(&cfg, "foo.[2].number", &ival);
+  TT_ASSERT_TRUE(ok);
+  TT_ASSERT_INT_EQ(7, ival);
+
+  ok = config_lookup_string(&cfg, "foo.[0].string.blah", &str);
+  TT_ASSERT_FALSE(ok);
+
+  ok = config_lookup_string(&cfg, "foo.[0].string.[0]", &str);
+  TT_ASSERT_FALSE(ok);
+
+  ok = config_lookup_string(&cfg, "foo.[0].[1]", &str);
+  TT_ASSERT_FALSE(ok);
+  
+  ok = config_lookup_string(&cfg, "foo.[0].array.[0].blah", &str);
+  TT_ASSERT_FALSE(ok);
+
+  ok = config_lookup_string(&cfg, "[0]", &str);
+  TT_ASSERT_FALSE(ok);
+
+  setting = config_lookup(&cfg, "foo.[0].array.[0]");
+  TT_ASSERT_PTR_NOTNULL(setting);
+
+  setting = config_lookup(&cfg, "foo.[0].array.[0");
+  TT_ASSERT_PTR_NULL(setting);
+  
+  setting = config_lookup(&cfg, "/foo.[0].array.[0]");
+  TT_ASSERT_PTR_NOTNULL(setting);
+
+  setting = config_lookup(&cfg, "/foo/[0]/array/[0]");
+  TT_ASSERT_PTR_NOTNULL(setting);
+
+  parent = config_lookup(&cfg, ".foo");
+  TT_ASSERT_PTR_NOTNULL(parent);
+
+  setting = config_setting_lookup(parent, ".[0]");
+  TT_ASSERT_PTR_NOTNULL(setting);
+  
+  setting = config_setting_lookup(parent, ".[0].array");
+  TT_ASSERT_PTR_NOTNULL(setting);
+
+  setting = config_setting_lookup(parent, ".[0].array.[1]");
+  TT_ASSERT_PTR_NOTNULL(setting);
+
+  setting = config_setting_lookup(parent, "[0].array.[1000]");
+  TT_ASSERT_PTR_NULL(setting);
+
+  setting = config_setting_lookup(parent, "[0].array.[0].blah");
+  TT_ASSERT_PTR_NULL(setting);
+}
+
+/* ------------------------------------------------------------------------- */
+
+TT_TEST(ReadStream)
+{
+  config_t cfg;
+  int ok;
+  FILE *stream;
+
+  config_init(&cfg);
+  config_set_include_dir(&cfg, "./testdata");
+
+  stream = fopen("testdata/nesting.cfg", "rt");
+  TT_ASSERT_PTR_NOTNULL(stream);
+
+  ok = config_read(&cfg, stream);
+
+  fclose(stream);
+  
+  if(!ok)
+  {
+    printf("error: %s:%d\n", config_error_text(&cfg),
+           config_error_line(&cfg));
+  }
+  TT_ASSERT_TRUE(ok);
+}
+
+/* ------------------------------------------------------------------------- */
+
 int main(int argc, char **argv)
 {
   int failures;
@@ -563,6 +682,8 @@
   TT_SUITE_TEST(LibConfigTests, RemoveSetting);
   TT_SUITE_TEST(LibConfigTests, EscapedStrings);
   TT_SUITE_TEST(LibConfigTests, OverrideSetting);
+  TT_SUITE_TEST(LibConfigTests, SettingLookups);
+  TT_SUITE_TEST(LibConfigTests, ReadStream);
   TT_SUITE_RUN(LibConfigTests);
   failures = TT_SUITE_NUM_FAILURES(LibConfigTests);
   TT_SUITE_END(LibConfigTests);
diff --git a/tinytest/Makefile.am b/tinytest/Makefile.am
index 443132c..7ee7b0a 100644
--- a/tinytest/Makefile.am
+++ b/tinytest/Makefile.am
@@ -3,4 +3,4 @@
 
 libtinytest_a_SOURCES = tinytest.c tinytest.h
 
-EXTRA_DIST = tinytest.vcproj tinytest.vcxproj
+EXTRA_DIST = tinytest.vcproj tinytest.vcxproj CMakeLists.txt