Update of /cvsroot/plib/plib/src/psl
In directory usw-pr-cvs1:/tmp/cvs-serv15961/plib/src/psl
Modified Files:
pslToken.cxx
Log Message:
Comments (both C and C++ style) now work. This is **FUN** !
Index: pslToken.cxx
===================================================================
RCS file: /cvsroot/plib/plib/src/psl/pslToken.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pslToken.cxx 6 Sep 2002 13:50:51 -0000 1.6
+++ pslToken.cxx 6 Sep 2002 17:50:06 -0000 1.7
@@ -58,6 +58,48 @@
res [ 0 ] = '\0' ;
return ;
}
+
+ if ( c == '/' )
+ {
+ int d = getc ( fd ) ;
+
+ if ( d == '/' ) /* C++ style comment */
+ {
+ do
+ {
+ d = getc ( fd ) ;
+ } while ( d != '\n' && d != -1 ) ;
+
+ c = ' ' ;
+ }
+ else
+ if ( d == '*' ) /* C style comment */
+ {
+ /*
+ YUK! This is *so* horrible to get right.
+ Just think about this case! ==> **/
+
+ do
+ {
+ /* Search for a star or an EOF */
+
+ do
+ {
+ d = getc ( fd ) ;
+ } while ( d != '*' && d != -1 ) ;
+
+ c = getc ( fd ) ;
+
+ /* If you get two stars in a row - unget the second one */
+
+ if ( c == '*' )
+ ungetc ( '*', fd ) ;
+
+ } while ( c != '/' ) ;
+
+ c = ' ' ;
+ }
+ }
} while ( isspace ( c ) ) ;
int tp = 0 ;
|