========== 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)
|