OSSP CVS Repository

ossp - Check-in [2303]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2303
Date: 2002-Jul-17 16:48:08 (local)
2002-Jul-17 14:48:08 (UTC)
User:rse
Branch:
Comment: allow C-style block comments to nest
Tickets:
Inspections:
Files:
ossp-pkg/cfg/cfg_syn_scan.l      1.8 -> 1.9     8 inserted, 1 deleted
ossp-pkg/cfg/sample.cfg      1.3 -> 1.4     2 inserted, 1 deleted

ossp-pkg/cfg/cfg_syn_scan.l 1.8 -> 1.9

--- cfg_syn_scan.l       2002/07/10 12:00:23     1.8
+++ cfg_syn_scan.l       2002/07/17 14:48:08     1.9
@@ -82,6 +82,7 @@
     /* local variables */
     char  caStr[1024];
     char *cpStr = NULL;
+    int   nCommentOpen = 0;
     int   nQuoteOpen = 0;
     char  cQuoteOpen = '\0';
     char  cQuoteClose = '\0';
@@ -93,10 +94,16 @@
 
     /* C-style block comment */
 "/*" {
+    nCommentOpen = 1;
     BEGIN(SS_CO_C);
 }
+<SS_CO_C>"/*" {
+    nCommentOpen++;
+}
 <SS_CO_C>"*/" {
-    BEGIN(INITIAL);
+    nCommentOpen--;
+    if (nCommentOpen == 0)
+        BEGIN(INITIAL);
 }
 <SS_CO_C>(.|\n) {
     /* no-op */


ossp-pkg/cfg/sample.cfg 1.3 -> 1.4

--- sample.cfg   2002/07/08 13:45:28     1.3
+++ sample.cfg   2002/07/17 14:48:08     1.4
@@ -30,7 +30,8 @@
 ;
 /* a C/C++ style block comment which 
    goes over multiple lines and even includes 
-   some special /* ** * / characters */
+   some special / * ** * / characters and
+   a nested /* co/**/mment */, too. */
 
 "==== Single-Quoted Strings ====";
 'foo';

CVSTrac 2.0.1