1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-10 19:29:45 +00:00

Allow comments inside of macro calls that are spread over more than one line

git-svn-id: svn://svn.cc65.org/cc65/trunk@1141 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2001-12-12 21:45:05 +00:00
parent 5f7ca4b2f4
commit 6b654255ba

View File

@ -160,8 +160,8 @@ static void keepstr (const char* S)
static void Comment (void)
/* Remove a C comment from line. */
static void OldStyleComment (void)
/* Remove an old style C comment from line. */
{
/* Remember the current line number, so we can output better error
* messages if the comment is not terminated in the current file.
@ -195,6 +195,24 @@ static void Comment (void)
static void NewStyleComment (void)
/* Remove a new style C comment from line. */
{
/* Beware: Because line continuation chars are handled when reading
* lines, we may only skip til the end of the source line, which
* may not be the same as the end of the input line. The end of the
* source line is denoted by a lf (\n) character.
*/
do {
NextChar ();
} while (CurC != '\n' && CurC != '\0');
if (CurC == '\n') {
NextChar ();
}
}
static void SkipBlank (void)
/* Skip blanks and tabs in the input stream. */
{
@ -382,6 +400,12 @@ static int MacroCall (Macro* M)
/* Squeeze runs of blanks */
*B++ = ' ';
SkipBlank ();
} else if (CurC == '/' && NextC == '*') {
*B++ = ' ';
OldStyleComment ();
} else if (ANSI == 0 && CurC == '/' && NextC == '/') {
*B++ = ' ';
NewStyleComment ();
} else if (CurC == '\0') {
/* End of line inside macro argument list - read next line */
if (NextLine () == 0) {
@ -570,20 +594,10 @@ static int Pass1 (const char* From, char* To)
mptr = CopyQuotedString (mptr);
} else if (CurC == '/' && NextC == '*') {
keepch (' ');
Comment ();
OldStyleComment ();
} else if (ANSI == 0 && CurC == '/' && NextC == '/') {
keepch (' ');
/* Beware: Because line continuation chars are handled when reading
* lines, we may only skip til the end of the source line, which
* may not be the same as the end of the input line. The end of the
* source line is denoted by a lf (\n) character.
*/
do {
NextChar ();
} while (CurC != '\n' && CurC != '\0');
if (CurC == '\n') {
NextChar ();
}
NewStyleComment ();
} else {
*mptr++ = CurC;
NextChar ();