]> git.sur5r.net Git - cc65/commitdiff
Added new emulation feature: loose_char_term
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 2 Sep 2000 12:01:40 +0000 (12:01 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 2 Sep 2000 12:01:40 +0000 (12:01 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@316 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/ca65/expr.c
src/ca65/feature.c
src/ca65/feature.h
src/ca65/global.c
src/ca65/global.h
src/ca65/scanner.c

index 0675a8c7b50c9bb8c968b7ad24f414c8cc687add..4ada4317a24870ec14e01b22ffb2611e2f928374 100644 (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;
     }
index 71f5f055b6f841512e303c52e107d4c1f8a21539..3059757b58946d868148481778819549b3e4d9d9 100644 (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;
index c366cd9d721e7226f6dc7b67bae8013d2f4e3e55..2f46cfc7723d05e651bcd66247f49184f8253993 100644 (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;
index ac3227d80e38b40b184cf227574a8870ee81a978..0bd7a54ee45b94fb68cf4a581bd8f18ab8458c8c 100644 (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" */
index 75920212245aff8c42fc08f54088ff727bfdd1cb..7288bb61c909745713c380309906fa82d258bb23 100644 (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" */
index 69733a3cd0ae900f17de6ad95e5702312c5d8d7a..fb5212a3c2cedeaccd16897250fb0496ec968598 100644 (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        },