「auto」{count();回報(AUTO); }計數函數的用法
「break」{count();返回(BREAK); }
「case」{count();返回(CASE); }
「char」{count();返回(CHAR); }
count()在lex中的作用是什麼?
另外,語句「column + = 8 - (column%8);」在下面的函數中不清楚
void count()
{
int i;
for (i = 0; yytext[i] != '\0'; i++)
if (yytext[i] == '\n')
column = 0;
else if (yytext[i] == '\t')
column += 8 - (column % 8);
else
column++;
ECHO;
}
問題是什麼? –
column + = 8 - (column%8);這個聲明有什麼用?這可以寫成列+ = 8; –
@Venkatesan:只有在列%8爲0的情況下。只需看看你寫的內容即可。表達式將列移動到8的下一個倍數。 – rici