mirror of
https://github.com/cc65/cc65.git
synced 2024-11-19 06:31:31 +00:00
Added missing 'simple escape sequences'
git-svn-id: svn://svn.cc65.org/cc65/trunk@2891 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
9bf337a37b
commit
98e3d2815e
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static char ParseChar (StrBuf* B)
|
static int ParseChar (StrBuf* B)
|
||||||
/* Parse a character. Converts \n into EOL, etc. */
|
/* Parse a character. Converts \n into EOL, etc. */
|
||||||
{
|
{
|
||||||
unsigned I;
|
unsigned I;
|
||||||
@ -61,6 +61,9 @@ static char ParseChar (StrBuf* B)
|
|||||||
/* Check for escape chars */
|
/* Check for escape chars */
|
||||||
if ((C = SB_Get (B)) == '\\') {
|
if ((C = SB_Get (B)) == '\\') {
|
||||||
switch (SB_Get (B)) {
|
switch (SB_Get (B)) {
|
||||||
|
case 'a':
|
||||||
|
C = '\a';
|
||||||
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
C = '\b';
|
C = '\b';
|
||||||
break;
|
break;
|
||||||
@ -76,6 +79,9 @@ static char ParseChar (StrBuf* B)
|
|||||||
case 't':
|
case 't':
|
||||||
C = '\t';
|
C = '\t';
|
||||||
break;
|
break;
|
||||||
|
case 'v':
|
||||||
|
C = '\v';
|
||||||
|
break;
|
||||||
case '\"':
|
case '\"':
|
||||||
C = '\"';
|
C = '\"';
|
||||||
break;
|
break;
|
||||||
@ -85,14 +91,17 @@ static char ParseChar (StrBuf* B)
|
|||||||
case '\\':
|
case '\\':
|
||||||
C = '\\';
|
C = '\\';
|
||||||
break;
|
break;
|
||||||
|
case '\?':
|
||||||
|
C = '\?';
|
||||||
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'X':
|
case 'X':
|
||||||
/* Hex character constant */
|
/* Hex character constant */
|
||||||
C = HexVal (SB_Get (B)) << 4;
|
C = HexVal (SB_Get (B)) << 4;
|
||||||
C |= HexVal (SB_Get (B));
|
C |= HexVal (SB_Get (B));
|
||||||
break;
|
break;
|
||||||
case '0':
|
case '0':
|
||||||
/* Octal constant */
|
/* Octal constant */
|
||||||
C = 0;
|
C = 0;
|
||||||
goto Octal;
|
goto Octal;
|
||||||
case '1':
|
case '1':
|
||||||
@ -101,12 +110,12 @@ static char ParseChar (StrBuf* B)
|
|||||||
Octal: I = 0;
|
Octal: I = 0;
|
||||||
while (SB_Peek (B) >= '0' && SB_Peek (B) <= '7' && I++ < 4) {
|
while (SB_Peek (B) >= '0' && SB_Peek (B) <= '7' && I++ < 4) {
|
||||||
C = (C << 3) | (SB_Get (B) - '0');
|
C = (C << 3) | (SB_Get (B) - '0');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Error ("Illegal character constant");
|
Error ("Illegal character constant");
|
||||||
C = ' ';
|
C = ' ';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,10 +125,6 @@ Octal: I = 0;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Code */
|
/* Code */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@ -139,7 +144,7 @@ void SB_SkipWhite (StrBuf* B)
|
|||||||
int SB_GetSym (StrBuf* B, char* S)
|
int SB_GetSym (StrBuf* B, char* S)
|
||||||
/* Get a symbol from the string buffer. S must be able to hold MAX_IDENTLEN
|
/* 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.
|
* characters. Returns 1 if a symbol was found and 0 otherwise.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if (IsIdent (SB_Peek (B))) {
|
if (IsIdent (SB_Peek (B))) {
|
||||||
unsigned I = 0;
|
unsigned I = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user