summaryrefslogtreecommitdiff
path: root/gas/app.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2005-09-29 02:20:50 +0000
committerAlan Modra <amodra@bigpond.net.au>2005-09-29 02:20:50 +0000
commit9038068aeb9edc97958f8b8fb5e966fa37668705 (patch)
treef45c6ce19af4251159cc10124470d35a64ec9d91 /gas/app.c
parent36141d5e966c6b9cc09619ac200bde7c9ef9a149 (diff)
downloadbinutils-redhat-9038068aeb9edc97958f8b8fb5e966fa37668705.tar.gz
* app.c (do_scrub_chars): Match open and close quote of strings.
Remove redundant EOF test in case 7.
Diffstat (limited to 'gas/app.c')
-rw-r--r--gas/app.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/gas/app.c b/gas/app.c
index d33089a10a..14f2f14b66 100644
--- a/gas/app.c
+++ b/gas/app.c
@@ -345,6 +345,8 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
char *fromend;
int fromlen;
register int ch, ch2 = 0;
+ /* Character that started the string we're working on. */
+ static char quotechar;
/*State 0: beginning of normal line
1: After first whitespace on line (flush more white)
@@ -536,11 +538,8 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
for (s = from; s < fromend; s++)
{
ch = *s;
- /* This condition must be changed if the type of any
- other character can be LEX_IS_STRINGQUOTE. */
if (ch == '\\'
- || ch == '"'
- || ch == '\''
+ || ch == quotechar
|| ch == '\n')
break;
}
@@ -558,12 +557,12 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
ch = GET ();
if (ch == EOF)
{
- as_warn (_("end of file in string; inserted '\"'"));
+ as_warn (_("end of file in string; '%c' inserted"), quotechar);
state = old_state;
UNGET ('\n');
- PUT ('"');
+ PUT (quotechar);
}
- else if (lex[ch] == LEX_IS_STRINGQUOTE)
+ else if (ch == quotechar)
{
state = old_state;
PUT (ch);
@@ -603,8 +602,8 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
continue;
case EOF:
- as_warn (_("end of file in string; '\"' inserted"));
- PUT ('"');
+ as_warn (_("end of file in string; '%c' inserted"), quotechar);
+ PUT (quotechar);
continue;
case '"':
@@ -638,10 +637,9 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
case 7:
ch = GET ();
+ quotechar = ch;
state = 5;
old_state = 8;
- if (ch == EOF)
- goto fromeof;
PUT (ch);
continue;
@@ -975,6 +973,7 @@ do_scrub_chars (int (*get) (char *, int), char *tostart, int tolen)
break;
case LEX_IS_STRINGQUOTE:
+ quotechar = ch;
if (state == 10)
{
/* Preserve the whitespace in foo "bar". */