bool comment = false; //for this kind of comment--"/**/"
char prech = '@'; //pre char for /**/ comment
ansistring pretoken = ""; //pre token for judging pointee and multi '*'
while(scanfile.getline(buffer,bflength)) //get each line of the .cpp file
{
int lnscptr = 0;
while(buffer[lnscptr]==' ') //trim left space
lnscptr++;
ch = buffer[lnscptr];
/*scan:important arithmetic*/
if(comment)
{
prech = ch;
goto flag1;
}
else
{
while(ch!='\0') //while not the line finish symbol do analyse
{
if(isalpha(ch) || ch=='_') // id or keyword
{
while(isalpha(ch) || isdigit(ch) || ch=='_')
{
strtoken = strtoken + ch;
ch = buffer[++lnscptr];
}
if(isreserveword(strtoken)) //is reserveword
{
print(linecount,strtoken,strgrdline,"保留字");
maketl(linecount,strtoken,"保留字");
}
else //is id
{
print(linecount,strtoken,strgrdline,"标识符");
maketl(linecount,strtoken,"标识符");
}
pretoken = strtoken;
strgrdline++;
strtoken.delete(1,strtoken.length());
}
else if(isdigit(ch)) // numerci
{
while(isdigit(ch) || ch=='.')
{
strtoken = strtoken + ch;
ch = buffer[++lnscptr];
}