TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALL
from: JARI LAAKSONEN
date: 1997-03-28 21:57:00
subject: 11/16 Comment utilities

========== CSplit: Version 2.0 ==========
========== CSplit: Begin part 11/16 ==========
        }
        break;
    case InCComment:
        switch (theEvent)
        {
        case FOUND_STAR:
            itsState = StarInCComment;  // to be investigated: end of \
\
comment.
            break;
        }
        break;
    // '*' in C++ comment: action processors can use this to check
    // e.g. C comments inside C++ comment.
    case StarInCppComment:
        switch (theEvent)
        {
        case FOUND_STAR:
            itsState = StarInCppComment; // another '*' -- don't change \
\
state.
            break;
        case FOUND_NL:
            itsState = NormalInput;     // Newline is end of C++ comment.
            break;
        default:
            itsState = InCppComment;
            break;
        }
        break;
    // We are inside a C comment, and there is a '*';
    // maybe this is the end of the comment...
    case StarInCComment:
        switch (theEvent)
        {
        case FOUND_STAR:
            itsState = StarInCComment;  // another '*' -- don't change \
\
state.
            break;
        case FOUND_SLASH:
            itsState = NormalInput;     // Yes, it's end of the C \
\
comment.
            break;
        default:
            itsState = InCComment;      // No, we are still in C comment.
            break;
        }
        break;
    }
}
/* CommentParser::getEvent
 *  Selects the next event according to the read character.
 */
CommentParser::Event CommentParser::getEvent()
{
    switch (ReadCh)
    {
    case ' ':
    case '\t':
        return FOUND_WHITESPACE;
    case '\"':
        return FOUND_QUOTE;
    case '\'':
        return FOUND_SINGLEQUOTE;
    case '\\':
        return FOUND_BACKSLASH;
    case '\n':
        lines++;          // count processed lines, if someone needs \
\
it...
        return FOUND_NL;
    case '/':
        return FOUND_SLASH;
    case '*':
        return FOUND_STAR;
    default:
        return ANY_CHAR;
    }
}
/* CommentParser::readChar
 *  Read character from input file.
 */
int CommentParser::readChar()
{
    ReadCh = fgetc (InFile);
    return ReadCh;
}
/* CommentParser::getReadChar
 *  Return read character.
 */
int CommentParser::getReadChar()
{
    return ReadCh;
}
/* CommentParser::printChar
 *  Print current character which can be the last read from the input \
\
file
 *  or changed by the action processor.
 */
void CommentParser::printChar()
{
    if (ReadCh != EOF)
        fputc (ReadCh, OutFile);
}
/* CommentParser::printLineNumber
 *  Print current line number.
 */
void CommentParser::printLineNumber()
{
    fprintf (OutFile, "\n%05lu:\n", lines);
}
/* CommentParser::run
 *  Loop that reads the input file and calls the action processor and
 *  the state processor.
 */
int CommentParser::run()
{
    Event theEvent;
    while (readChar() != EOF)
    {
        theEvent = getEvent();
        processActions (theEvent);
        processState (theEvent);
========== CSplit: End part 11/16 crc: 16c8 ==========
        // Albert                      email: jla@to.icl.fi
--- GoldED/2 2.50+
---------------
* Origin: Albert's Point/2 in Finland, Europe (2:221/360.20)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.