]> git.sur5r.net Git - cc65/commitdiff
New feature missing_char_term
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 29 Mar 2004 15:58:34 +0000 (15:58 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 29 Mar 2004 15:58:34 +0000 (15:58 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2964 b7a2c559-68d2-44c3-8de9-860c34a00d81

doc/ca65.sgml
src/ca65/feature.c
src/ca65/feature.h
src/ca65/global.c
src/ca65/global.h
src/ca65/scanner.c

index debbc4cd01800261d0e8d72f824f115e0a201274..72679f3233689441cd43eacfbf4d3480e0105098 100644 (file)
@@ -908,7 +908,7 @@ if you want to access the "other" symbol <tt/bar/, you would have to write:
         .endscope
 </verb></tscreen>
 
-       
+
 <sect>Address sizes<label id="address-sizes"><p>
 
 
@@ -2075,6 +2075,16 @@ Here's a list of all control commands and a description, what they do:
     removing the lines with the assignments may also be an option when porting
     code written for older assemblers).
 
+  <tag><tt>missing_char_term</tt></tag>
+
+    Accept single quoted character constants where the terminating quote is
+    missing.
+    <tscreen><verb>
+        lda     #'a
+    </verb></tscreen>
+    <bf/Note:/ This does not work in conjunction with <tt/.FEATURE
+    loose_string_term/, since in this case the input would be ambigous.
+
   </descrip>
 
   It is also possible to specify features on the command line using the
index b19c0a07dcd3970fd1730c94456c26fe025dc491..3983270ecfde6f892fd2944ad84189f69ce8e81e 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2002 Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* (C) 2000-2003 Ullrich von Bassewitz                                       */
+/*               Römerstraße 52                                              */
+/*               D-70794 Filderstadt                                         */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -57,6 +57,7 @@ static const char* FeatureKeys[FEAT_COUNT] = {
     "dollar_in_identifiers",
     "leading_dot_in_identifiers",
     "pc_assignment",
+    "missing_char_term",
 };
 
 
@@ -107,6 +108,7 @@ feature_t SetFeature (const char* Key)
        case FEAT_DOLLAR_IN_IDENTIFIERS:      DollarInIdents    = 1;    break;
                case FEAT_LEADING_DOT_IN_IDENTIFIERS: LeadingDotInIdents= 1;    break;
        case FEAT_PC_ASSIGNMENT:              PCAssignment      = 1;    break;
+        case FEAT_MISSING_CHAR_TERM:          MissingCharTerm   = 1;    break;
        default:                         /* Keep gcc silent */          break;
     }
 
index 2766396dcb1485f5a2fc34bad6790e1c865ea247..df91e77f133ea6ee3f7ebc695f6e8ae5231c097a 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000-2002 Ullrich von Bassewitz                                       */
-/*               Wacholderweg 14                                             */
-/*               D-70597 Stuttgart                                           */
-/* EMail:        uz@musoftware.de                                            */
+/* (C) 2000-2003 Ullrich von Bassewitz                                       */
+/*               Römerstraße 52                                              */
+/*               D-70794 Filderstadt                                         */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -54,6 +54,7 @@ typedef enum {
     FEAT_DOLLAR_IN_IDENTIFIERS,
     FEAT_LEADING_DOT_IN_IDENTIFIERS,
     FEAT_PC_ASSIGNMENT,
+    FEAT_MISSING_CHAR_TERM,
 
     /* Special value: Number of features available */
     FEAT_COUNT
index 8da92298f2ac2a7f23be23ab77cf57df5ebcb155..f9d29bea95aa6692b7d652f1a7164d24538f9350 100644 (file)
@@ -74,6 +74,7 @@ unsigned char AtInIdents         = 0; /* Allow '@' in identifiers */
 unsigned char DollarInIdents     = 0;   /* Allow '$' in identifiers */
 unsigned char LeadingDotInIdents = 0;   /* Allow '.' to start an identifier */
 unsigned char PCAssignment       = 0;  /* Allow "* = $XXX" or "$ = $XXX" */
+unsigned char MissingCharTerm    = 0;   /* Allow lda #'a (no closing term) */
 
 /* Misc stuff */
 const char Copyright[]           = "(C) Copyright 1998-2004 Ullrich von Bassewitz";
index 68670ad9bc50f57ac1f02ba972658b9f0f865c43..f75d12335982a9bb2c44f76cfced7dd72112806b 100644 (file)
@@ -71,6 +71,7 @@ extern unsigned char    AtInIdents;               /* Allow '@' in identifiers */
 extern unsigned char           DollarInIdents;     /* Allow '$' in identifiers */
 extern unsigned char    LeadingDotInIdents; /* Allow '.' to start an identifier */
 extern unsigned char           PCAssignment;       /* Allow "* = $XXX" or "$ = $XXX" */
+extern unsigned char    MissingCharTerm;    /* Allow lda #'a (no closing term) */
 
 /* Misc stuff */
 extern const char       Copyright[];        /* Copyright string */
index c33edcb386ca0c391a750a4c91ebd4b0711635b3..6c0e06d9c0172902077ea2df92a6327aaa511591 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2003 Ullrich von Bassewitz                                       */
+/* (C) 1998-2004 Ullrich von Bassewitz                                       */
 /*               Römerstraße 52                                              */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -469,8 +469,8 @@ static void NextChar (void)
            /* End of current line reached, read next line */
            if (fgets (IFile->Line, sizeof (IFile->Line), IFile->F) == 0) {
                /* End of file. Add an empty line to the listing. This is a
-                * small hack needed to keep the PC output in sync.
-                */
+                * small hack needed to keep the PC output in sync.
+                */
                NewListingLine ("", IFile->Pos.Name, ICount);
                C = EOF;
                return;
@@ -617,7 +617,7 @@ static unsigned ReadStringConst (int StringTerm)
 
     /* Return the length of the string */
     return I;
-}
+}               
 
 
 
@@ -1043,7 +1043,7 @@ CharAgain:
            } else {
                /* Always a character constant */
                NextChar ();
-               if (C == '\n' || C == EOF) {
+               if (C == EOF || IsControl (C)) {
                    Error ("Illegal character constant");
                    goto CharAgain;
                }
@@ -1051,7 +1051,9 @@ CharAgain:
                Tok = TOK_CHARCON;
                NextChar ();
                if (C != '\'') {
-                   Error ("Illegal character constant");
+                    if (!MissingCharTerm) {
+                        Error ("Illegal character constant");
+                    }
                } else {
                    NextChar ();
                }