]> dgit.raspbian.org Git - libfyaml.git/commitdiff
New upstream version 0.7.12
authorJose Luis Blanco Claraco <joseluisblancoc@gmail.com>
Tue, 22 Feb 2022 21:23:34 +0000 (22:23 +0100)
committerJose Luis Blanco Claraco <joseluisblancoc@gmail.com>
Tue, 22 Feb 2022 21:23:34 +0000 (22:23 +0100)
19 files changed:
.libtool-version
.tarball-version
Makefile.in
config.h.in
configure
configure.ac
doc/Makefile.in
src/Makefile.in
src/lib/fy-diag.h
src/lib/fy-dump.c
src/lib/fy-dump.h
src/lib/fy-input.c
src/lib/fy-input.h
src/lib/fy-parse.c
src/lib/fy-parse.h
test/Makefile.in
test/testsuite-evstream.test
test/testsuite-json.test
test/testsuite.test

index a759e95bcc38dcaadb5fd2ec04e0cb29a9cc3428..b83a3978a83c2bc6be2903a618b70e5c9752785d 100644 (file)
@@ -1 +1 @@
-1:1:0
+1:2:0
index b4d6d12101febdd4c5792ced9aae7600069d928e..88a7b2285774ee0449d2b8e88c4550b96a83faf1 100644 (file)
@@ -1 +1 @@
-0.7.11
+0.7.12
index 0b7bbc8f31c23703595f9eb957d4ec98ceeed261..2fae43dd2721c75a394a0a9f0bdd44a6a1629a33 100644 (file)
@@ -209,7 +209,8 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
        $(top_srcdir)/build-aux/shave.in \
        $(top_srcdir)/build-aux/tap-driver.sh AUTHORS build-aux/ar-lib \
        build-aux/compile build-aux/config.guess build-aux/config.sub \
-       build-aux/install-sh build-aux/ltmain.sh build-aux/missing
+       build-aux/depcomp build-aux/install-sh build-aux/ltmain.sh \
+       build-aux/missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -296,6 +297,7 @@ GIT = @GIT@
 GREP = @GREP@
 HAVE_CHECK = @HAVE_CHECK@
 HAVE_COMPATIBLE_CHECK = @HAVE_COMPATIBLE_CHECK@
+HAVE_DEVMODE = @HAVE_DEVMODE@
 HAVE_LIBYAML = @HAVE_LIBYAML@
 HAVE_NETWORK = @HAVE_NETWORK@
 HAVE_QSORT_R = @HAVE_QSORT_R@
index eea84d0ec7592b20dd9e5d7b87e85c4c497dda54..688a7080e881f7aa89228127ff9cab736d0cd106 100644 (file)
@@ -13,6 +13,9 @@
    don't. */
 #undef HAVE_DECL_ENVIRON
 
+/* Define to 1 if developer mode is enabled */
+#undef HAVE_DEVMODE
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
index a2abd7626818ebaec8f4e6b2ca4e06c9110753a3..a5e00b369d924f0690debad2101d30ae1ea47991 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libfyaml 0.7.11.
+# Generated by GNU Autoconf 2.69 for libfyaml 0.7.12.
 #
 # Report bugs to <pantelis.antoniou@konsulko.com>.
 #
@@ -592,8 +592,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libfyaml'
 PACKAGE_TARNAME='libfyaml'
-PACKAGE_VERSION='0.7.11'
-PACKAGE_STRING='libfyaml 0.7.11'
+PACKAGE_VERSION='0.7.12'
+PACKAGE_STRING='libfyaml 0.7.12'
 PACKAGE_BUGREPORT='pantelis.antoniou@konsulko.com'
 PACKAGE_URL=''
 
@@ -668,6 +668,9 @@ HAVE_SPHINX_FALSE
 HAVE_SPHINX_TRUE
 PIP3
 SPHINX
+HAVE_DEVMODE_FALSE
+HAVE_DEVMODE_TRUE
+HAVE_DEVMODE
 HAVE_NETWORK_FALSE
 HAVE_NETWORK_TRUE
 HAVE_NETWORK
@@ -844,6 +847,7 @@ with_gnu_ld
 with_sysroot
 enable_libtool_lock
 enable_network
+enable_devmode
 enable_shave
 '
       ac_precious_vars='build_alias
@@ -1421,7 +1425,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libfyaml 0.7.11 to adapt to many kinds of systems.
+\`configure' configures libfyaml 0.7.12 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1492,7 +1496,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libfyaml 0.7.11:";;
+     short | recursive ) echo "Configuration of libfyaml 0.7.12:";;
    esac
   cat <<\_ACEOF
 
@@ -1514,6 +1518,7 @@ Optional Features:
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
   --disable-network       Disable tests requiring network access
+  --enable-devmode        Enable development mode only debugging
   --enable-shave          use shave to make the build pretty [[default=yes]]
 
 Optional Packages:
@@ -1559,7 +1564,7 @@ Some influential environment variables:
               https://github.com/yaml/yaml-test-suite)
   TESTSUITECHECKOUT
               Testsuite checkout (default:
-              80f289435a56189bbc5ca2f318574e48dbeef8aa)
+              6e6c296ae9c9d2d5c4134b4b64d01b29ac19ff6f)
   JSONTESTSUITEURL
               JSON Testsuite git repo URL (default:
               https://github.com/nst/JSONTestSuite)
@@ -1633,7 +1638,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libfyaml configure 0.7.11
+libfyaml configure 0.7.12
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2223,7 +2228,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libfyaml $as_me 0.7.11, which was
+It was created by libfyaml $as_me 0.7.12, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3091,7 +3096,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libfyaml'
- VERSION='0.7.11'
+ VERSION='0.7.12'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3241,7 +3246,7 @@ EXTRA=`echo $VERSION | cut -d- -f2- -s`
 #                    increase current, set revision and age to 0
 
 
-LIBTOOL_VERSION=1:1:0
+LIBTOOL_VERSION=1:2:0
 
 
 
@@ -18575,6 +18580,32 @@ else
 fi
 
 
+# Check whether --enable-devmode was given.
+if test "${enable_devmode+set}" = set; then :
+  enableval=$enable_devmode;
+fi
+
+
+if test "x$enable_devmode" != "xno" ; then
+       HAVE_DEVMODE=1
+else
+       HAVE_DEVMODE=0
+fi
+
+ if  test x$HAVE_DEVMODE = x1 ; then
+  HAVE_DEVMODE_TRUE=
+  HAVE_DEVMODE_FALSE='#'
+else
+  HAVE_DEVMODE_TRUE='#'
+  HAVE_DEVMODE_FALSE=
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DEVMODE $HAVE_DEVMODE
+_ACEOF
+
+
 # check for sphinx
 # Extract the first word of "sphinx-build", so it can be a program name with args.
 set dummy sphinx-build; ac_word=$2
@@ -18805,7 +18836,7 @@ fi
 
 
 if test "x$TESTSUITECHECKOUT" == "x" ; then
-       TESTSUITECHECKOUT="80f289435a56189bbc5ca2f318574e48dbeef8aa"
+       TESTSUITECHECKOUT="6e6c296ae9c9d2d5c4134b4b64d01b29ac19ff6f"
 fi
 
 
@@ -19202,6 +19233,10 @@ if test -z "${HAVE_NETWORK_TRUE}" && test -z "${HAVE_NETWORK_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_NETWORK\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${HAVE_DEVMODE_TRUE}" && test -z "${HAVE_DEVMODE_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_DEVMODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${HAVE_SPHINX_TRUE}" && test -z "${HAVE_SPHINX_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_SPHINX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -19615,7 +19650,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libfyaml $as_me 0.7.11, which was
+This file was extended by libfyaml $as_me 0.7.12, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -19681,7 +19716,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libfyaml config.status 0.7.11
+libfyaml config.status 0.7.12
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -21804,6 +21839,7 @@ echo "
     HAVE_CHECK:            ${HAVE_CHECK}
     HAVE_COMPATIBLE_CHECK: ${HAVE_COMPATIBLE_CHECK}
     HAVE_NETWORK:          ${HAVE_NETWORK}
+    HAVE_DEVMODE:          ${HAVE_DEVMODE}
     HAVE_SPHINX:           ${HAVE_SPHINX}
     GIT:                   $GIT
     DOCKER:                $DOCKER
index 8a495ec018f007451877686f0d3c9929a73c4721..8b366edf2dba6326bb710679ee134afc57aeba08 100644 (file)
@@ -186,15 +186,30 @@ AC_ARG_ENABLE([network],
              AS_HELP_STRING([--disable-network],
                             [Disable tests requiring network access]))
 
-if test "x$enable_network" != "xno" ; then 
+if test "x$enable_network" != "xno" ; then
        HAVE_NETWORK=1
 else
        HAVE_NETWORK=0
-fi     
+fi
 AC_SUBST(HAVE_NETWORK)
 AM_CONDITIONAL([HAVE_NETWORK],
               [ test x$HAVE_NETWORK = x1 ])
 
+dnl enable internet available when checking
+AC_ARG_ENABLE([devmode],
+             AS_HELP_STRING([--enable-devmode],
+                            [Enable development mode only debugging]))
+
+if test "x$enable_devmode" != "xno" ; then
+       HAVE_DEVMODE=1
+else
+       HAVE_DEVMODE=0
+fi
+AC_SUBST(HAVE_DEVMODE)
+AM_CONDITIONAL([HAVE_DEVMODE],
+              [ test x$HAVE_DEVMODE = x1 ])
+AC_DEFINE_UNQUOTED([HAVE_DEVMODE], [$HAVE_DEVMODE], [Define to 1 if developer mode is enabled])
+
 # check for sphinx
 AC_PATH_PROG([SPHINX], [sphinx-build])
 
@@ -268,10 +283,10 @@ if test "x$TESTSUITEURL" == "x" ; then
        TESTSUITEURL="https://github.com/yaml/yaml-test-suite"
 fi
 
-AC_ARG_VAR(TESTSUITECHECKOUT, [Testsuite checkout (default: 80f289435a56189bbc5ca2f318574e48dbeef8aa)])
+AC_ARG_VAR(TESTSUITECHECKOUT, [Testsuite checkout (default: 6e6c296ae9c9d2d5c4134b4b64d01b29ac19ff6f)])
 
 if test "x$TESTSUITECHECKOUT" == "x" ; then
-       TESTSUITECHECKOUT="80f289435a56189bbc5ca2f318574e48dbeef8aa"
+       TESTSUITECHECKOUT="6e6c296ae9c9d2d5c4134b4b64d01b29ac19ff6f"
 fi
 
 AC_ARG_VAR(JSONTESTSUITEURL, [JSON Testsuite git repo URL (default: https://github.com/nst/JSONTestSuite)])
@@ -341,6 +356,7 @@ echo "
     HAVE_CHECK:            ${HAVE_CHECK}
     HAVE_COMPATIBLE_CHECK: ${HAVE_COMPATIBLE_CHECK}
     HAVE_NETWORK:          ${HAVE_NETWORK}
+    HAVE_DEVMODE:          ${HAVE_DEVMODE}
     HAVE_SPHINX:           ${HAVE_SPHINX}
     GIT:                   $GIT
     DOCKER:                $DOCKER
index de17f1f8f536a64992d8478a5c743f98e5b01b51..e9d73ce1768b7f11cd28816cf1e48eb4e06081f8 100644 (file)
@@ -172,6 +172,7 @@ GIT = @GIT@
 GREP = @GREP@
 HAVE_CHECK = @HAVE_CHECK@
 HAVE_COMPATIBLE_CHECK = @HAVE_COMPATIBLE_CHECK@
+HAVE_DEVMODE = @HAVE_DEVMODE@
 HAVE_LIBYAML = @HAVE_LIBYAML@
 HAVE_NETWORK = @HAVE_NETWORK@
 HAVE_QSORT_R = @HAVE_QSORT_R@
index fd57f093384e16e0a2aa9169e915ab84cdede906..3b544e34c4f4cefa74f4c69d8af0649947347a8d 100644 (file)
@@ -293,6 +293,7 @@ GIT = @GIT@
 GREP = @GREP@
 HAVE_CHECK = @HAVE_CHECK@
 HAVE_COMPATIBLE_CHECK = @HAVE_COMPATIBLE_CHECK@
+HAVE_DEVMODE = @HAVE_DEVMODE@
 HAVE_LIBYAML = @HAVE_LIBYAML@
 HAVE_NETWORK = @HAVE_NETWORK@
 HAVE_QSORT_R = @HAVE_QSORT_R@
index 2653db52b303650dee552a880a983943052d5a59..f19861db0b66820ea6d4075090b84b1b0c9940e9 100644 (file)
 #include "fy-list.h"
 #include "fy-token.h"
 
+#if !defined(NDEBUG) && defined(HAVE_DEVMODE) && HAVE_DEVMODE
+#define FY_DEVMODE
+#else
+#undef FY_DEVMODE
+#endif
+
 /* error flags (above 0x100 is library specific) */
 #define FYEF_SOURCE    0x0001
 #define FYEF_POSITION  0x0002
@@ -94,7 +100,7 @@ void fy_diag_report(struct fy_diag *diag,
                    const char *fmt, ...)
                        __attribute__((format(printf, 3, 4)));
 
-#ifndef NDEBUG
+#ifdef FY_DEVMODE
 #define __FY_DEBUG_UNUSED__    /* nothing */
 #else
 #define __FY_DEBUG_UNUSED__    __attribute__((__unused__))
@@ -128,7 +134,7 @@ void fy_parser_diag_report(struct fy_parser *fyp,
                           const char *fmt, ...)
                __attribute__((format(printf, 3, 4)));
 
-#ifndef NDEBUG
+#ifdef FY_DEVMODE
 
 #define fyp_debug(_fyp, _module, _fmt, ...) \
        fy_parser_diag((_fyp), FYET_DEBUG | FYDF_MODULE(_module), \
@@ -276,7 +282,7 @@ void fy_reader_diag_report(struct fy_reader *fyr,
                           const char *fmt, ...)
                __attribute__((format(printf, 3, 4)));
 
-#ifndef NDEBUG
+#ifdef FY_DEVMODE
 
 #define fyr_debug(_fyr, _fmt, ...) \
        fy_reader_diag((_fyr), FYET_DEBUG, \
@@ -416,7 +422,7 @@ void fy_document_diag_report(struct fy_document *fyd,
                             const char *fmt, ...)
                        __attribute__((format(printf, 3, 4)));
 
-#ifndef NDEBUG
+#ifdef FY_DEVMODE
 
 #define fyd_debug(_fyd, _module, _fmt, ...) \
        fy_document_diag((_fyd), FYET_DEBUG | FYDF_MODULE(_module), \
@@ -518,7 +524,7 @@ void fy_composer_diag_report(struct fy_composer *fyc,
                             const char *fmt, ...)
                        __attribute__((format(printf, 3, 4)));
 
-#ifndef NDEBUG
+#ifdef FY_DEVMODE
 
 #define fyc_debug(_fyc, _module, _fmt, ...) \
        fy_composer_diag((_fyc), FYET_DEBUG | FYDF_MODULE(_module), \
@@ -603,7 +609,7 @@ void fy_document_builder_diag_report(struct fy_document_builder *fydb,
                                     const char *fmt, ...)
                                __attribute__((format(printf, 3, 4)));
 
-#ifndef NDEBUG
+#ifdef FY_DEVMODE
 
 #define fydb_debug(_fydb, _module, _fmt, ...) \
        fy_document_builder_diag((_fydb), FYET_DEBUG | FYDF_MODULE(_module), \
index b84eea162c47824c86be6bb5156c05a2499bb4ab..24fb8c9bcf46dfa00f738f2e762314f51ca55150 100644 (file)
@@ -235,7 +235,7 @@ char *fy_simple_key_list_dump_format(struct fy_parser *fyp, struct fy_simple_key
        return buf;
 }
 
-#ifndef NDEBUG
+#ifdef FY_DEVMODE
 
 void fyp_debug_dump_token_list(struct fy_parser *fyp, struct fy_token_list *fytl,
                struct fy_token *fyt_highlight, const char *banner)
@@ -292,9 +292,8 @@ void fyp_debug_dump_input(struct fy_parser *fyp, const struct fy_input_cfg *fyic
                                fyic->file.filename);
                break;
        case fyit_stream:
-               fyp_scan_debug(fyp, "%s: stream=\"%s\" fileno=%d chunk=%zu\n", banner,
-                               fyic->stream.name, fileno(fyic->stream.fp),
-                               fyic->stream.chunk);
+               fyp_scan_debug(fyp, "%s: stream=\"%s\" fileno=%d\n", banner,
+                               fyic->stream.name, fileno(fyic->stream.fp));
                break;
        case fyit_memory:
                fyp_scan_debug(fyp, "%s: start=%p size=%zu\n", banner,
index a95fe1f29c7b17b9be185b4893b186f1567f396c..13b1c9a8236c4968c0d5c00a11fa74c112716a80 100644 (file)
@@ -39,7 +39,7 @@ char *fy_simple_key_dump_format(struct fy_parser *fyp, struct fy_simple_key *fys
 char *fy_simple_key_list_dump_format(struct fy_parser *fyp, struct fy_simple_key_list *fyskl,
                struct fy_simple_key *fysk_highlight, char *buf, size_t bufsz);
 
-#ifndef NDEBUG
+#ifdef FY_DEVMODE
 
 void fyp_debug_dump_token_list(struct fy_parser *fyp, struct fy_token_list *fytl,
                               struct fy_token *fyt_highlight, const char *banner);
index c41140853f8490db4bce59a3603bf1174848c058..b7c16e062f15db9491ffc83c2e4e053be0c89b98 100644 (file)
@@ -592,13 +592,13 @@ int fy_reader_input_scan_token_mark_slow_path(struct fy_reader *fyr)
        fyr->current_input_pos = 0;
        fyr->current_ptr = fyi_new->buffer;
 
+       fyr_debug(fyr, "chop at this_input_start=%zu chop=%zu\n", fyr->this_input_start, fyi->chop);
+
        /* free the old input - while references to it exist it will hang around */
        fyi->state = FYIS_PARSED;
        fy_input_unref(fyi);
        fyi = NULL;
 
-       fyr_debug(fyr, "chop at this_input_start=%zu chop=%zu\n", fyr->this_input_start, fyi->chop);
-
        return 0;
 err_out:
        fy_input_unref(fyi_new);
index 618f3b8be0b767eca935e95d4763001b5ee54dff..6634fabd7be899a33eefbb369ea9da9374b0cae9 100644 (file)
 #include "fy-typelist.h"
 #include "fy-ctype.h"
 
-#ifndef NDEBUG
-#define __FY_DEBUG_UNUSED__    /* nothing */
-#else
-#define __FY_DEBUG_UNUSED__    __attribute__((__unused__))
-#endif
-
 struct fy_atom;
 struct fy_parser;
 
index 3c8618d277848870600e631a36a2d2304ba70ff7..df110e194b7c366a55dbcd9adc51803e3f004903 100644 (file)
@@ -1144,6 +1144,7 @@ int fy_scan_to_next_token(struct fy_parser *fyp)
                /* may start simple key (in block ctx) */
                if (!fyp->flow_level && !fyp->simple_key_allowed) {
                        fyp->simple_key_allowed = true;
+                       fyp->tab_used_for_ws = false;
                        tabs_allowed = fyp->flow_level || !fyp->simple_key_allowed || fyp_tabsize(fyp);
                        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
                }
@@ -1218,11 +1219,13 @@ static int fy_purge_stale_simple_keys(struct fy_parser *fyp, bool *did_purgep,
        *did_purgep = false;
        while ((fysk = fy_simple_key_list_head(&fyp->simple_keys)) != NULL) {
 
+#ifdef FY_DEVMODE
                fyp_scan_debug(fyp, "purge-check: flow_level=%d fysk->flow_level=%d fysk->mark.line=%d line=%d",
                                fyp->flow_level, fysk->flow_level,
                                fysk->mark.line, fyp_line(fyp));
 
                fyp_debug_dump_simple_key(fyp, fysk, "purge-check: ");
+#endif
 
                line = fysk->mark.line;
 
@@ -1246,7 +1249,9 @@ static int fy_purge_stale_simple_keys(struct fy_parser *fyp, bool *did_purgep,
                        goto err_out;
                }
 
+#ifdef FY_DEVMODE
                fyp_debug_dump_simple_key(fyp, fysk, "purging: ");
+#endif
 
                fy_simple_key_list_del(&fyp->simple_keys, fysk);
                fy_parse_simple_key_recycle(fyp, fysk);
@@ -1365,6 +1370,7 @@ void fy_remove_all_simple_keys(struct fy_parser *fyp)
                fy_parse_simple_key_recycle(fyp, fysk);
 
        fyp->simple_key_allowed = true;
+       fyp->tab_used_for_ws = false;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 }
 
@@ -1391,7 +1397,9 @@ int fy_remove_simple_key(struct fy_parser *fyp, enum fy_token_type next_type)
        while ((fysk = fy_simple_key_list_first(&fyp->simple_keys)) != NULL &&
                fysk->flow_level >= fyp->flow_level) {
 
+#ifdef FY_DEVMODE
                fyp_debug_dump_simple_key(fyp, fysk, "removing: ");
+#endif
 
                /* remove it from the list */
                fy_simple_key_list_del(&fyp->simple_keys, fysk);
@@ -1499,7 +1507,9 @@ int fy_save_simple_key(struct fy_parser *fyp, struct fy_mark *mark, struct fy_ma
                                 (fyt->type == FYTT_FLOW_MAPPING_START || fyt->type == FYTT_FLOW_SEQUENCE_START);
 
 
+#ifdef FY_DEVMODE
        fyp_debug_dump_simple_key_list(fyp, &fyp->simple_keys, fysk, "fyp->simple_keys (saved): ");
+#endif
 
        return 0;
 
@@ -1593,6 +1603,60 @@ err_out:
        return -1;
 }
 
+/* special case for allowing whitespace (including tabs) after -?: */
+static int fy_ws_indentation_check(struct fy_parser *fyp, bool *found_tabp, struct fy_mark *tab_mark)
+{
+       int c, adv, tab_adv;
+       bool indentation, found_tab;
+
+       found_tab = false;
+
+       /* not meaning in flow mode */
+       if (fyp->flow_level)
+               goto out;
+
+       /* scan forward, keeping track if we found a tab */
+       adv = 0;
+       tab_adv = -1;
+       if (tab_mark)
+               fy_get_mark(fyp, tab_mark);
+       while (fy_is_ws(c = fy_parse_peek_at(fyp, adv))) {
+               if (!found_tab && fy_is_tab(c)) {
+                       found_tab = true;
+                       tab_adv = adv;
+                       /* XXX somewhat hacky, space is 1 char only so adjust */
+                       if (tab_mark) {
+                               tab_mark->input_pos += adv;
+                               tab_mark->column += adv;
+                       }
+               }
+               adv++;
+       }
+
+       if (found_tab) {
+               indentation = fy_utf8_strchr("?:|>", c) ||
+                               (c == '-' && fyp_is_blankz(fyp, fy_parse_peek_at(fyp, adv + 1)));
+
+               /* any kind of block indentation is not allowed */
+               FYP_PARSE_ERROR_CHECK(fyp, tab_adv, 1, FYEM_SCAN,
+                               !indentation, err_out,
+                               "cannot use tab for indentation of block entry");
+               fy_advance_by(fyp, tab_adv + 1);
+       }
+
+       /* now chomp spaces only afterwards */
+       while (fy_is_space(c = fy_parse_peek(fyp)))
+               fy_advance(fyp, c);
+
+out:
+       if (found_tabp)
+               *found_tabp = found_tab;
+
+       return 0;
+
+err_out:
+       return -1;
+}
 
 int fy_fetch_stream_start(struct fy_parser *fyp)
 {
@@ -1600,6 +1664,7 @@ int fy_fetch_stream_start(struct fy_parser *fyp)
 
        /* simple key is allowed */
        fyp->simple_key_allowed = true;
+       fyp->tab_used_for_ws = false;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 
        fyt = fy_token_queue_simple(fyp, &fyp->queued_tokens, FYTT_STREAM_START, 0);
@@ -2082,6 +2147,7 @@ int fy_fetch_document_indicator(struct fy_parser *fyp, enum fy_token_type type)
        }
 
        fyp->simple_key_allowed = false;
+       fyp->tab_used_for_ws = false;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 
        fyt = fy_token_queue_simple(fyp, &fyp->queued_tokens, type, 3);
@@ -2159,6 +2225,7 @@ int fy_fetch_flow_collection_mark_start(struct fy_parser *fyp, int c)
        fyp->flow = c == '[' ? FYFT_SEQUENCE : FYFT_MAP;
 
        fyp->simple_key_allowed = true;
+       fyp->tab_used_for_ws = false;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 
        /* the comment indicator must have at least a space */
@@ -2229,6 +2296,7 @@ int fy_fetch_flow_collection_mark_end(struct fy_parser *fyp, int c)
                        "fy_parse_flow_pop() failed");
 
        fyp->simple_key_allowed = false;
+       fyp->tab_used_for_ws = false;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n",
                                fyp->simple_key_allowed ? "true" : "false");
 
@@ -2311,6 +2379,7 @@ int fy_fetch_flow_collection_entry(struct fy_parser *fyp, int c)
                        "fy_remove_simple_key() failed");
 
        fyp->simple_key_allowed = true;
+       fyp->tab_used_for_ws = false;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 
        fyt_last = fy_token_list_tail(&fyp->queued_tokens);
@@ -2356,8 +2425,6 @@ int fy_fetch_block_entry(struct fy_parser *fyp, int c)
        struct fy_mark mark;
        struct fy_simple_key *fysk;
        struct fy_token *fyt;
-       int adv, tab_adv;
-       bool indentation, found_tab;
 
        fyp_error_check(fyp, c == '-', err_out,
                        "illegal block entry");
@@ -2424,40 +2491,16 @@ int fy_fetch_block_entry(struct fy_parser *fyp, int c)
                        "fy_remove_simple_key() failed");
 
        fyp->simple_key_allowed = true;
+       fyp->tab_used_for_ws = false;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 
        fyt = fy_token_queue_simple(fyp, &fyp->queued_tokens, FYTT_BLOCK_ENTRY, 1);
        fyp_error_check(fyp, fyt, err_out,
                        "fy_token_queue_simple() failed");
 
-       /* special case for allowing whitespace (including tabs) after - */
-       found_tab = false;
-
-       /* scan forward, keeping track if we found a tab */
-       adv = 0;
-       tab_adv = -1;
-       while (fy_is_ws(c = fy_parse_peek_at(fyp, adv))) {
-               if (!found_tab && fy_is_tab(c)) {
-                       found_tab = true;
-                       tab_adv = adv;
-               }
-               adv++;
-       }
-
-       if (found_tab) {
-               indentation = fy_utf8_strchr("?:|>", c) ||
-                               (c == '-' && fyp_is_blankz(fyp, fy_parse_peek_at(fyp, adv + 1)));
-
-               /* any kind of block indentation is not allowed */
-               FYP_PARSE_ERROR_CHECK(fyp, tab_adv, 1, FYEM_SCAN,
-                               !indentation, err_out,
-                               "cannot use tab for indentation of block entry");
-               fy_advance_by(fyp, tab_adv + 1);
-       }
-
-       /* now chomp spaces only afterwards */
-       while (fy_is_space(c = fy_parse_peek(fyp)))
-               fy_advance(fyp, c);
+       rc = fy_ws_indentation_check(fyp, NULL, NULL);
+       fyp_error_check(fyp, !rc, err_out_rc,
+                       "fy_ws_indentation_check() failed");
 
        return 0;
 
@@ -2475,6 +2518,8 @@ int fy_fetch_key(struct fy_parser *fyp, int c)
        bool target_simple_key_allowed;
        struct fy_token *fyt;
        struct fy_atom *handle;
+       bool found_tab;
+       struct fy_mark tab_mark;
 
        fyp_error_check(fyp, c == '?', err_out,
                        "illegal block entry or key mark");
@@ -2524,9 +2569,16 @@ int fy_fetch_key(struct fy_parser *fyp, int c)
        fyp->simple_key_allowed = target_simple_key_allowed;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 
-       /* eat whitespace */
-       while (fy_is_blank(c = fy_parse_peek(fyp)))
-               fy_advance(fyp, c);
+       rc = fy_ws_indentation_check(fyp, &found_tab, &tab_mark);
+       fyp_error_check(fyp, !rc, err_out_rc,
+                       "fy_ws_indentation_check() failed");
+
+       /* record whether a tab was used for indentation */
+       if (fyp->simple_key_allowed && found_tab) {
+               fyp->tab_used_for_ws = true;
+               fyp->last_tab_used_for_ws_mark = tab_mark;
+       } else
+               fyp->tab_used_for_ws = false;   // XXX
 
        /* comment? */
        if (c == '#') {
@@ -2558,6 +2610,8 @@ int fy_fetch_value(struct fy_parser *fyp, int c)
        bool push_bmap_start, push_key_only, did_purge, final_complex_key;
        bool is_multiline __FY_DEBUG_UNUSED__;
        struct fy_atom *chandle;
+       bool found_tab;
+       struct fy_mark tab_mark;
        int rc;
 
        fyp_error_check(fyp, c == ':', err_out,
@@ -2669,6 +2723,12 @@ int fy_fetch_value(struct fy_parser *fyp, int c)
                goto err_out;
        }
 
+       /* special handling for ?: */
+       if (fyp->tab_used_for_ws) {
+               FYP_PARSE_ERROR(fyp, 0, 1, FYEM_SCAN, "Indentation used tabs for ':' indicator");
+               goto err_out;
+       }
+
        if (push_bmap_start) {
 
                assert(!fyp->flow_level);
@@ -2698,9 +2758,11 @@ int fy_fetch_value(struct fy_parser *fyp, int c)
                fyt->key.flow_level = fyp->flow_level;
        }
 
+#ifdef FY_DEVMODE
        fyp_debug_dump_token(fyp, fyt_insert, "insert-token: ");
        fyp_debug_dump_token_list(fyp, &fyp->queued_tokens, fyt_insert, "fyp->queued_tokens (before): ");
        fyp_debug_dump_token_list(fyp, &sk_tl, NULL, "sk_tl: ");
+#endif
 
        if (fyt_insert) {
 
@@ -2711,7 +2773,9 @@ int fy_fetch_value(struct fy_parser *fyp, int c)
        } else
                fy_token_lists_splice(&fyp->queued_tokens, &sk_tl);
 
+#ifdef FY_DEVMODE
        fyp_debug_dump_token_list(fyp, &fyp->queued_tokens, fyt_insert, "fyp->queued_tokens (after): ");
+#endif
 
        target_simple_key_allowed = fysk ? false : !fyp->flow_level;
 
@@ -2719,11 +2783,26 @@ int fy_fetch_value(struct fy_parser *fyp, int c)
        fyp_error_check(fyp, fyt, err_out,
                        "fy_token_queue_simple() failed");
 
+       if (fysk)
+               fy_parse_simple_key_recycle(fyp, fysk);
+
+
        fyp->simple_key_allowed = target_simple_key_allowed;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 
-       if (fysk)
-               fy_parse_simple_key_recycle(fyp, fysk);
+       if (is_complex) {
+               rc = fy_ws_indentation_check(fyp, &found_tab, &tab_mark);
+               fyp_error_check(fyp, !rc, err_out_rc,
+                               "fy_ws_indentation_check() failed");
+
+               /* record whether a tab was used for indentation */
+               if (fyp->simple_key_allowed && found_tab) {
+                       fyp->tab_used_for_ws = true;
+                       fyp->last_tab_used_for_ws_mark = tab_mark;
+               } else
+                       fyp->tab_used_for_ws = false;   // XXX
+       } else
+               fyp->tab_used_for_ws = false;
 
        if (final_complex_key) {
                fyp->pending_complex_key_column = -1;
@@ -2746,6 +2825,7 @@ int fy_fetch_value(struct fy_parser *fyp, int c)
                        fyp_error_check(fyp, !rc, err_out_rc,
                                        "fy_scan_comment() failed");
                }
+
        }
 
        return 0;
@@ -2866,6 +2946,7 @@ int fy_fetch_anchor_or_alias(struct fy_parser *fyp, int c)
                        "fy_save_simple_key_mark() failed");
 
        fyp->simple_key_allowed = false;
+       fyp->tab_used_for_ws = false;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 
        return 0;
@@ -2984,6 +3065,7 @@ int fy_fetch_tag(struct fy_parser *fyp, int c)
                        "fy_save_simple_key_mark() failed");
 
        fyp->simple_key_allowed = false;
+       fyp->tab_used_for_ws = false;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 
        return 0;
@@ -3110,6 +3192,7 @@ int fy_fetch_block_scalar(struct fy_parser *fyp, bool is_literal, int c)
                        "fy_remove_simple_key() failed");
 
        fyp->simple_key_allowed = true;
+       fyp->tab_used_for_ws = false;
        fyp_scan_debug(fyp, "simple_key_allowed -> %s\n", fyp->simple_key_allowed ? "true" : "false");
 
        /* skip over block scalar start */
@@ -5093,8 +5176,10 @@ struct fy_token *fy_scan(struct fy_parser *fyp)
                        (void)fy_parse_tag_directive(fyp, fyt, true);
        }
 
+#ifdef FY_DEVMODE
        if (fyt)
                fyp_debug_dump_token(fyp, fyt, "producing: ");
+#endif
        return fyt;
 }
 
@@ -5524,7 +5609,10 @@ static struct fy_eventp *fy_parse_internal(struct fy_parser *fyp)
                        fyt = fy_scan_remove_peek(fyp, fyt);
                        fyp_error_check(fyp, fyt, err_out,
                                        "failed to peek token");
+
+#ifdef FY_DEVMODE
                        fyp_debug_dump_token(fyp, fyt, "next: ");
+#endif
 
                        had_doc_end = true;
                }
@@ -5565,7 +5653,9 @@ static struct fy_eventp *fy_parse_internal(struct fy_parser *fyp)
                        fyt = fy_scan_peek(fyp);
                        fyp_error_check(fyp, fyt, err_out,
                                        "failed to peek token");
+#ifdef FY_DEVMODE
                        fyp_debug_dump_token(fyp, fyt, "next: ");
+#endif
                }
 
                /* the end */
@@ -5805,7 +5895,9 @@ static struct fy_eventp *fy_parse_internal(struct fy_parser *fyp)
                        fyt = fy_scan_remove_peek(fyp, fyt);
                        fyp_error_check(fyp, fyt, err_out,
                                        "failed to peek token");
+#ifdef FY_DEVMODE
                        fyp_debug_dump_token(fyp, fyt, "next: ");
+#endif
 
                        /* check whether it's a sequence entry or not */
                        is_seq = fyt->type != FYTT_BLOCK_ENTRY && fyt->type != FYTT_BLOCK_END;
@@ -5897,7 +5989,9 @@ static struct fy_eventp *fy_parse_internal(struct fy_parser *fyp)
                        fyt = fy_scan_remove_peek(fyp, fyt);
                        fyp_error_check(fyp, fyt, err_out,
                                        "failed to peek token");
+#ifdef FY_DEVMODE
                        fyp_debug_dump_token(fyp, fyt, "next: ");
+#endif
 
                        /* check whether it's a block entry or not */
                        is_block = fyt->type != FYTT_KEY && fyt->type != FYTT_VALUE &&
@@ -5940,7 +6034,9 @@ static struct fy_eventp *fy_parse_internal(struct fy_parser *fyp)
                        fyt = fy_scan_remove_peek(fyp, fyt);
                        fyp_error_check(fyp, fyt, err_out,
                                        "failed to peek token");
+#ifdef FY_DEVMODE
                        fyp_debug_dump_token(fyp, fyt, "next: ");
+#endif
 
                        /* check whether it's a block entry or not */
                        is_value = fyt->type != FYTT_KEY && fyt->type != FYTT_VALUE &&
@@ -5984,7 +6080,9 @@ static struct fy_eventp *fy_parse_internal(struct fy_parser *fyp)
                                fyt = fy_scan_remove_peek(fyp, fyt);
                                fyp_error_check(fyp, fyt, err_out,
                                                "failed to peek token");
+#ifdef FY_DEVMODE
                                fyp_debug_dump_token(fyp, fyt, "next: ");
+#endif
                        }
 
                        if (fyt->type == FYTT_KEY) {
@@ -6068,7 +6166,9 @@ static struct fy_eventp *fy_parse_internal(struct fy_parser *fyp)
                        fyt = fy_scan_remove_peek(fyp, fyt);
                        fyp_error_check(fyp, fyt, err_out,
                                        "failed to peek token");
+#ifdef FY_DEVMODE
                        fyp_debug_dump_token(fyp, fyt, "next: ");
+#endif
 
                        if (fyt->type != FYTT_FLOW_ENTRY && fyt->type != FYTT_FLOW_SEQUENCE_END) {
                                rc = fy_parse_state_push(fyp, FYPS_FLOW_SEQUENCE_ENTRY_MAPPING_END);
@@ -6134,7 +6234,9 @@ static struct fy_eventp *fy_parse_internal(struct fy_parser *fyp)
                                fyt = fy_scan_remove_peek(fyp, fyt);
                                fyp_error_check(fyp, fyt, err_out,
                                                "failed to peek token");
+#ifdef FY_DEVMODE
                                fyp_debug_dump_token(fyp, fyt, "next: ");
+#endif
                        }
 
                        if (fyt->type == FYTT_KEY) {
@@ -6142,7 +6244,9 @@ static struct fy_eventp *fy_parse_internal(struct fy_parser *fyp)
                                fyt = fy_scan_remove_peek(fyp, fyt);
                                fyp_error_check(fyp, fyt, err_out,
                                                "failed to peek token");
+#ifdef FY_DEVMODE
                                fyp_debug_dump_token(fyp, fyt, "next: ");
+#endif
 
                                /* JSON key checks */
                                FYP_TOKEN_ERROR_CHECK(fyp, fyt, FYEM_PARSE,
@@ -6212,7 +6316,9 @@ static struct fy_eventp *fy_parse_internal(struct fy_parser *fyp)
                        fyt = fy_scan_remove_peek(fyp, fyt);
                        fyp_error_check(fyp, fyt, err_out,
                                        "failed to peek token");
+#ifdef FY_DEVMODE
                        fyp_debug_dump_token(fyp, fyt, "next: ");
+#endif
 
                        if (fyt->type != FYTT_FLOW_ENTRY &&
                            fyt->type != FYTT_FLOW_MAPPING_END) {
index df278fc0e8ede491b4268546b67a2a603a4248ae..11e71bf619a4f675ddbf721ed1ff69ec59f5e433 100644 (file)
@@ -150,6 +150,7 @@ struct fy_parser {
        bool stream_end_produced : 1;
        bool stream_end_reached : 1;
        bool simple_key_allowed : 1;
+       bool tab_used_for_ws : 1;
        bool stream_error : 1;
        bool generated_block_map : 1;
        bool last_was_comma : 1;
@@ -165,6 +166,7 @@ struct fy_parser {
        struct fy_mark pending_complex_key_mark;
        int last_block_mapping_key_line;
        struct fy_mark last_comma_mark;
+       struct fy_mark last_tab_used_for_ws_mark;
 
        /* copy of stream_end token */
        struct fy_token *stream_end_token;
index 265d7e475a49aa0427847ec855a90a00057c79f5..9391717a6ef776d4afd7d795bb95bdfd5f581955 100644 (file)
@@ -448,6 +448,7 @@ GIT = @GIT@
 GREP = @GREP@
 HAVE_CHECK = @HAVE_CHECK@
 HAVE_COMPATIBLE_CHECK = @HAVE_COMPATIBLE_CHECK@
+HAVE_DEVMODE = @HAVE_DEVMODE@
 HAVE_LIBYAML = @HAVE_LIBYAML@
 HAVE_NETWORK = @HAVE_NETWORK@
 HAVE_QSORT_R = @HAVE_QSORT_R@
index 2f35be28762b04a90c3d5f5abf5a54b56b9988fd..a6f931f5b7aad4e00da6223ddc41a7f164f08cdb 100755 (executable)
@@ -2,7 +2,7 @@
 
 count=0
 for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
-       for tst in ${basetst} ${basetst}[0-9][0-9]/; do
+       for tst in ${basetst} ${basetst}[0-9][0-9]/ ${basetst}[0-9][0-9][0-9]/; do
                # there must be a test there
                if [ ! -e "$tst/===" ]; then
                        continue
@@ -24,7 +24,7 @@ xfaillist=""
 i=0
 for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
 
-       for tst in ${basetst} ${basetst}[0-9][0-9]/; do
+       for tst in ${basetst} ${basetst}[0-9][0-9]/ ${basetst}[0-9][0-9][0-9]/; do
 
                # there must be a test there
                if [ ! -e "$tst/===" ]; then
index 794d5152fba97f123b8db6febe5d48924ba13521..503f9930b7ed2d8f5fa04617db91b6f1893e1a6b 100755 (executable)
@@ -2,7 +2,7 @@
 
 count=0
 for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
-       for tst in ${basetst} ${basetst}[0-9][0-9]/; do
+       for tst in ${basetst} ${basetst}[0-9][0-9]/ ${basetst}[0-9][0-9][0-9]/; do
                # there must be a test there
                if [ ! -e "$tst/===" ]; then
                        continue
@@ -28,7 +28,7 @@ xfaillist=""
 i=0
 for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
 
-       for tst in ${basetst} ${basetst}[0-9][0-9]/; do
+       for tst in ${basetst} ${basetst}[0-9][0-9]/ ${basetst}[0-9][0-9][0-9]/; do
 
                # ignore tests which are expected to fail
                if [ -e "$tst/error" ]; then
index 1883d00f9da319e909522691a32cabe7780b33e4..4f82f4d3543975063adbfb2aa600a6c581100b41 100755 (executable)
@@ -2,7 +2,7 @@
 
 count=0
 for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
-       for tst in ${basetst} ${basetst}[0-9][0-9]/; do
+       for tst in ${basetst} ${basetst}[0-9][0-9]/ ${basetst}[0-9][0-9][0-9]/; do
                # there must be a test there
                if [ ! -e "$tst/===" ]; then
                        continue
@@ -20,7 +20,7 @@ xfaillist=""
 i=0
 for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
 
-       for tst in ${basetst} ${basetst}[0-9][0-9]/; do
+       for tst in ${basetst} ${basetst}[0-9][0-9]/ ${basetst}[0-9][0-9][0-9]/; do
 
                # there must be a test there
                if [ ! -e "$tst/===" ]; then