+
+ struct msg m = {
+ .category = m_->category,
+ .severity = m_->severity,
+ .stack = m_->stack,
+ .n_stack = m_->n_stack,
+ .location = location,
+ .command_name = output_get_uppercase_command_name (),
+ .text = m_->text,
+ };
+
+ output_item_submit (message_item_create (&m));
+
+ free (m.command_name);
+ if (m.location != m_->location)
+ msg_location_destroy (m.location);
+}
+
+static void
+add_syntax_reader (struct lexer *lexer, const char *file_name,
+ const char *encoding, enum segmenter_mode syntax_mode)
+{
+ struct lex_reader *reader;
+
+ reader = (!strcmp (file_name, "-") && isatty (STDIN_FILENO)
+ ? terminal_reader_create ()
+ : lex_reader_for_file (file_name, encoding, syntax_mode,
+ LEX_ERROR_CONTINUE));
+
+ if (reader)
+ lex_append (lexer, reader);