Question: Implement the method , only make changes after the / / TODO lineToken LexicalAnalyzer::ScanNumber ( ) { char c; input.GetChar ( c ) ; if

Implement the method , only make changes after the //TODO lineToken LexicalAnalyzer::ScanNumber()
{
char c;
input.GetChar(c);
if (isdigit(c)){
if (c =='0'){
tmp.lexeme ="0";
} else {
tmp.lexeme ="";
while (!input.EndOfInput() && isdigit(c)){
tmp.lexeme += c;
input.GetChar(c);
}
if (!input.EndOfInput()){
input.UngetChar(c);
}
}
// TODO: You can check for REALNUM, BASE08NUM and BASE16NUM here!
tmp.token_type = NUM;
tmp.line_no = line_no;
return tmp;
} else {
if (!input.EndOfInput()){
input.UngetChar(c);
}
tmp.lexeme ="";
tmp.token_type = ERROR;
tmp.line_no = line_no;
return tmp;
}
}
 Implement the method , only make changes after the //TODO lineToken

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!