X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Flexer%2Flexer.c;h=1c35642f874daa9ef8447522af7428a34f89d023;hb=f550aee00a62fe1d8baf62d83cd7efef6cc2ee92;hp=16195b0dd22303a92f5c3075488f58ec8da5d088;hpb=8953baa61127d6d3b91f763663ea647bf3e4e793;p=pspp diff --git a/src/language/lexer/lexer.c b/src/language/lexer/lexer.c index 16195b0dd2..1c35642f87 100644 --- a/src/language/lexer/lexer.c +++ b/src/language/lexer/lexer.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009 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 @@ -32,6 +32,7 @@ #include #include #include +#include #include "xalloc.h" @@ -384,10 +385,10 @@ lex_get (struct lexer *lexer) } else { - if (c_isgraph ((unsigned char) *lexer->prog)) - msg (SE, _("Bad character in input: `%c'."), *lexer->prog++); - else - msg (SE, _("Bad character in input: `\\%o'."), *lexer->prog++); + unsigned char c = *lexer->prog++; + char *c_name = xasprintf (c_isgraph (c) ? "%c" : "\\%o", c); + msg (SE, _("Bad character in input: `%s'."), c_name); + free (c_name); continue; } } @@ -873,16 +874,16 @@ lex_preprocess_line (struct string *line, } } -/* Reads a line, without performing any preprocessing. - Sets *SYNTAX, if SYNTAX is non-null, to the line's syntax - mode. */ +/* Reads a line, without performing any preprocessing. */ bool lex_get_line_raw (struct lexer *lexer) { bool ok = getl_read_line (lexer->ss, &lexer->line_buffer); - enum syntax_mode mode = lex_current_syntax_mode (lexer); - journal_write (mode == GETL_BATCH, ds_cstr (&lexer->line_buffer)); - + if (ok) + { + const char *line = ds_cstr (&lexer->line_buffer); + text_item_submit (text_item_create (TEXT_ITEM_SYNTAX, line)); + } return ok; }