]> git.sur5r.net Git - cc65/commitdiff
Enable use of new C like comments only if the new feature "c_comments" is
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 21 Aug 2008 19:35:39 +0000 (19:35 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 21 Aug 2008 19:35:39 +0000 (19:35 +0000)
enabled.

git-svn-id: svn://svn.cc65.org/cc65/trunk@3889 b7a2c559-68d2-44c3-8de9-860c34a00d81

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

index fbd5e1561107857f20b34dfbbe69f9a4a9e602de..e138bfe74a83e65bae7acfd4239c7793eb365911 100644 (file)
@@ -60,6 +60,7 @@ static const char* FeatureKeys[FEAT_COUNT] = {
     "pc_assignment",
     "missing_char_term",
     "ubiquitous_idents",
+    "c_comments",
 };
 
 
@@ -113,6 +114,7 @@ feature_t SetFeature (const StrBuf* Key)
        case FEAT_PC_ASSIGNMENT:              PCAssignment      = 1;    break;
         case FEAT_MISSING_CHAR_TERM:          MissingCharTerm   = 1;    break;
         case FEAT_UBIQUITOUS_IDENTS:          UbiquitousIdents  = 1;    break;
+        case FEAT_C_COMMENTS:                 CComments         = 1;    break;
        default:                         /* Keep gcc silent */          break;
     }
 
index d3bf08e06a26a3805f42a69f6cfb1e0b3789a006..31ebae223e112feb8ebecd3f3adedff61e910f27 100644 (file)
@@ -62,6 +62,7 @@ typedef enum {
     FEAT_PC_ASSIGNMENT,
     FEAT_MISSING_CHAR_TERM,
     FEAT_UBIQUITOUS_IDENTS,
+    FEAT_C_COMMENTS,
 
     /* Special value: Number of features available */
     FEAT_COUNT
index dea1dc69099a704ac8a1332ae1fa045473db7a19..91041d067d40baf35b44e1fb1d3723978acb83bc 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2007 Ullrich von Bassewitz                                       */
+/* (C) 1998-2008 Ullrich von Bassewitz                                       */
 /*               Roemerstrasse 52                                            */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -65,7 +65,7 @@ unsigned char DbgSyms          = 0;   /* Add debug symbols */
 unsigned char Listing                   = 0;   /* Create listing file */
 unsigned char LineCont          = 0;   /* Allow line continuation */
 
-/* Emulation features */                
+/* Emulation features */
 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 */
@@ -77,6 +77,7 @@ unsigned char PCAssignment       = 0; /* Allow "* = $XXX" or "$ = $XXX" */
 unsigned char MissingCharTerm    = 0;   /* Allow lda #'a (no closing term) */
 unsigned char UbiquitousIdents   = 0;   /* Allow ubiquitous identifiers */
 unsigned char OrgPerSeg          = 0;   /* Make .org local to current seg */
+unsigned char CComments          = 0;   /* Allow C like comments */
 
 /* Misc stuff */
 const char Copyright[]           = "(C) Copyright 1998-2005 Ullrich von Bassewitz";
index 3d286c408aebc028d0dfd195d39bd3e58ea11403..92d83b9afe04e9b74ec9e9109f0c1eb2b1a58ff7 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2007 Ullrich von Bassewitz                                       */
+/* (C) 1998-2008 Ullrich von Bassewitz                                       */
 /*               Roemerstrasse 52                                            */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
@@ -74,6 +74,7 @@ extern unsigned char          PCAssignment;       /* Allow "* = $XXX" or "$ = $XXX" */
 extern unsigned char    MissingCharTerm;    /* Allow lda #'a (no closing term) */
 extern unsigned char    UbiquitousIdents;   /* Allow ubiquitous identifiers */
 extern unsigned char    OrgPerSeg;          /* Make .org local to current seg */
+extern unsigned char    CComments;          /* Allow C like comments */
 
 /* Misc stuff */
 extern const char       Copyright[];        /* Copyright string */
index 51cc998bc32d362598ee7c66befdc3d2871b073b..c1fe251897596aadeb8f77bdd6da3b0471874351 100644 (file)
@@ -1063,7 +1063,7 @@ CharAgain:
            NextChar ();
             if (C != '*') {
                 Tok = TOK_DIV;
-            } else {
+            } else if (CComments) {
                 /* Remember the position, then skip the '*' */
                 FilePos Pos = CurPos;
                 NextChar ();
@@ -1071,14 +1071,14 @@ CharAgain:
                     while (C !=  '*') {
                         if (C == EOF) {
                             PError (&Pos, "Unterminated comment");
-                            goto Again;
+                            goto CharAgain;
                         }
                         NextChar ();
                     }
                     NextChar ();
                 } while (C != '/');
                 NextChar ();
-                goto Again;  
+                goto Again;
             }
            return;