1
0
mirror of https://github.com/cc65/cc65.git synced 2024-09-27 19:55:09 +00:00

Added new emulation feature: loose_char_term

git-svn-id: svn://svn.cc65.org/cc65/trunk@316 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-09-02 12:01:40 +00:00
parent a41de0ea3f
commit d27cd62465
6 changed files with 15 additions and 4 deletions

View File

@ -609,8 +609,13 @@ static ExprNode* Factor (void)
break;
default:
N = LiteralExpr (0); /* Dummy */
Error (ERR_SYNTAX);
if (LooseCharTerm && Tok == TOK_STRCON && strlen(SVal) == 1) {
/* A character constant */
N = LiteralExpr (TgtTranslateChar (SVal[0]));
} else {
N = LiteralExpr (0); /* Dummy */
Error (ERR_SYNTAX);
}
NextTok ();
break;
}

View File

@ -52,6 +52,7 @@ static const char* FeatureKeys[FEAT_COUNT] = {
"dollar_is_pc",
"labels_without_colons",
"loose_string_term",
"loose_char_term",
"at_in_identifiers",
"dollar_in_identifiers",
"pc_assignment",
@ -100,11 +101,12 @@ feature_t SetFeature (const char* Key)
case FEAT_DOLLAR_IS_PC: DollarIsPC = 1; break;
case FEAT_LABELS_WITHOUT_COLONS: NoColonLabels = 1; break;
case FEAT_LOOSE_STRING_TERM: LooseStringTerm= 1; break;
case FEAT_LOOSE_CHAR_TERM: LooseCharTerm = 1; break;
case FEAT_AT_IN_IDENTIFIERS: AtInIdents = 1; break;
case FEAT_DOLLAR_IN_IDENTIFIERS: DollarInIdents = 1; break;
case FEAT_PC_ASSIGNMENT: PCAssignment = 1; break;
default: /* Keep gcc silent */ break;
}
}
/* Return the value found */
return Feature;

View File

@ -49,10 +49,11 @@ typedef enum {
FEAT_DOLLAR_IS_PC,
FEAT_LABELS_WITHOUT_COLONS,
FEAT_LOOSE_STRING_TERM,
FEAT_LOOSE_CHAR_TERM,
FEAT_AT_IN_IDENTIFIERS,
FEAT_DOLLAR_IN_IDENTIFIERS,
FEAT_PC_ASSIGNMENT,
/* Special value: Number of features available */
FEAT_COUNT
} feature_t;

View File

@ -66,6 +66,7 @@ unsigned char LineCont = 0; /* Allow line continuation */
unsigned char DollarIsPC = 0; /* Allow the $ symbol as current PC */
unsigned char NoColonLabels = 0; /* Allow labels without a colon */
unsigned char LooseStringTerm = 0; /* Allow ' as string terminator */
unsigned char LooseCharTerm = 0; /* Allow " for char constants */
unsigned char AtInIdents = 0; /* Allow '@' in identifiers */
unsigned char DollarInIdents = 0; /* Allow '$' in identifiers */
unsigned char PCAssignment = 0; /* Allow "* = $XXX" or "$ = $XXX" */

View File

@ -67,6 +67,7 @@ extern unsigned char LineCont; /* Allow line continuation */
extern unsigned char DollarIsPC; /* Allow the $ symbol as current PC */
extern unsigned char NoColonLabels; /* Allow labels without a colon */
extern unsigned char LooseStringTerm;/* Allow ' as string terminator */
extern unsigned char LooseCharTerm; /* Allow " for char constants */
extern unsigned char AtInIdents; /* Allow '@' in identifiers */
extern unsigned char DollarInIdents; /* Allow '$' in identifiers */
extern unsigned char PCAssignment; /* Allow "* = $XXX" or "$ = $XXX" */

View File

@ -128,6 +128,7 @@ struct DotKeyword {
{ "BITXOR", TOK_XOR },
{ "BLANK", TOK_BLANK },
{ "BSS", TOK_BSS },
{ "BYT", TOK_BYTE },
{ "BYTE", TOK_BYTE },
{ "CASE", TOK_CASE },
{ "CODE", TOK_CODE },