From d833f56657ced7e374ca61dd018cce0909f563df Mon Sep 17 00:00:00 2001 From: tsauerbeck Date: Mon, 11 Oct 2004 17:49:59 +0000 Subject: [PATCH] Implemented string concatenation. For example, "pants""off" becomes "pantsoff". SVN revision: 11831 --- legacy/embryo/src/bin/embryo_cc_sc2.c | 35 ++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/legacy/embryo/src/bin/embryo_cc_sc2.c b/legacy/embryo/src/bin/embryo_cc_sc2.c index 0244a40134..4877ed1255 100644 --- a/legacy/embryo/src/bin/embryo_cc_sc2.c +++ b/legacy/embryo/src/bin/embryo_cc_sc2.c @@ -1,4 +1,7 @@ -/* Small compiler - File input, preprocessing and lexical analysis functions +/* + * vim:ts=8:sw=3:sts=3:noexpandtab + * + * Small compiler - File input, preprocessing and lexical analysis functions * * Copyright (c) ITB CompuPhase, 1997-2003 * @@ -1738,8 +1741,21 @@ preprocess(void) static char * unpackedstring(char *lptr, int rawstring) { - while (*lptr != '\"' && *lptr != '\0') + while (*lptr != '\0') { + /* check for doublequotes indicating the end of the string */ + if (*lptr == '\"') + { + /* check whether there's another pair of quotes following. + * If so, paste the two strings together, thus + * "pants""off" becomes "pantsoff" + */ + if (*(lptr + 1) == '\"') + lptr += 2; + else + break; + } + if (*lptr == '\a') { /* ignore '\a' (which was inserted at a line concatenation) */ lptr++; @@ -1759,8 +1775,21 @@ packedstring(char *lptr, int rawstring) i = sizeof(ucell) - (charbits / 8); /* start at most significant byte */ val = 0; - while (*lptr != '\"' && *lptr != '\0') + while (*lptr != '\0') { + /* check for doublequotes indicating the end of the string */ + if (*lptr == '\"') + { + /* check whether there's another pair of quotes following. + * If so, paste the two strings together, thus + * "pants""off" becomes "pantsoff" + */ + if (*(lptr + 1) == '\"') + lptr += 2; + else + break; + } + if (*lptr == '\a') { /* ignore '\a' (which was inserted at a line concatenation) */ lptr++;