From 98e3d2815ea06882bab848ed186640e511075951 Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 2 Mar 2004 19:27:59 +0000 Subject: [PATCH] Added missing 'simple escape sequences' git-svn-id: svn://svn.cc65.org/cc65/trunk@2891 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/scanstrbuf.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/cc65/scanstrbuf.c b/src/cc65/scanstrbuf.c index 39c15e4e5..b441ae309 100644 --- a/src/cc65/scanstrbuf.c +++ b/src/cc65/scanstrbuf.c @@ -52,7 +52,7 @@ -static char ParseChar (StrBuf* B) +static int ParseChar (StrBuf* B) /* Parse a character. Converts \n into EOL, etc. */ { unsigned I; @@ -61,6 +61,9 @@ static char ParseChar (StrBuf* B) /* Check for escape chars */ if ((C = SB_Get (B)) == '\\') { switch (SB_Get (B)) { + case 'a': + C = '\a'; + break; case 'b': C = '\b'; break; @@ -76,6 +79,9 @@ static char ParseChar (StrBuf* B) case 't': C = '\t'; break; + case 'v': + C = '\v'; + break; case '\"': C = '\"'; break; @@ -85,14 +91,17 @@ static char ParseChar (StrBuf* B) case '\\': C = '\\'; break; + case '\?': + C = '\?'; + break; case 'x': case 'X': /* Hex character constant */ C = HexVal (SB_Get (B)) << 4; C |= HexVal (SB_Get (B)); - break; + break; case '0': - /* Octal constant */ + /* Octal constant */ C = 0; goto Octal; case '1': @@ -101,12 +110,12 @@ static char ParseChar (StrBuf* B) Octal: I = 0; while (SB_Peek (B) >= '0' && SB_Peek (B) <= '7' && I++ < 4) { C = (C << 3) | (SB_Get (B) - '0'); - } + } break; default: Error ("Illegal character constant"); - C = ' '; - break; + C = ' '; + break; } } @@ -116,10 +125,6 @@ Octal: I = 0; - - - - /*****************************************************************************/ /* Code */ /*****************************************************************************/ @@ -139,7 +144,7 @@ void SB_SkipWhite (StrBuf* B) int SB_GetSym (StrBuf* B, char* S) /* Get a symbol from the string buffer. S must be able to hold MAX_IDENTLEN * characters. Returns 1 if a symbol was found and 0 otherwise. - */ + */ { if (IsIdent (SB_Peek (B))) { unsigned I = 0; -- 2.39.5