/
test.cpp
executable file
·33 lines (32 loc) · 1.37 KB
/
test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Context handle_code(ifstream& inFile, ofstream& outFile) {
char ch;
while(inFile.get(ch)) {
switch(ch) {
case '/':
if(!inFile.get(ch)) {
outFile.put('/');
return file_end;
}
else
{
if(ch == '*')
return c_comment;
else if(ch == '/')
return cpp_comment;
else {
outFile.put('/');
inFile.putback(ch);
break;
}
}
case '\"' : return string_literal;
case '\'' : return char_literal;
case '\n' : return newline;
default:
{
keyMatch(ch, outFile);
}
}
}
return file_end;
}