+static void
+flush_deferred_syntax (void)
+{
+ if (!ds_is_empty (&deferred_syntax))
+ {
+ char *syntax = ds_steal_cstr (&deferred_syntax);
+ output_submit__ (text_item_super (
+ text_item_create_nocopy (TEXT_ITEM_SYNTAX, syntax)));
+ }
+}
+
+static bool
+is_syntax_item (const struct output_item *item)
+{
+ return (is_text_item (item)
+ && text_item_get_type (to_text_item (item)) == TEXT_ITEM_SYNTAX);
+}
+
+/* Submits ITEM to the configured output drivers, and transfers ownership to
+ the output subsystem. */
+void
+output_submit (struct output_item *item)
+{
+ if (is_syntax_item (item))
+ {
+ ds_put_cstr (&deferred_syntax, text_item_get_text (to_text_item (item)));
+ output_item_unref (item);
+ return;
+ }
+
+ flush_deferred_syntax ();
+ output_submit__ (item);
+}
+