58 }
else if(isspace(ch)) {
79 }
else if(ch1 ==
'*') {
85 "Comment not closed.");
90 if(ch ==
'"' || ch ==
'\'') {
93 }
else if(isalpha(ch)) {
96 }
else if(isdigit(ch) ||
132 "Comment not closed.");
155 value = 10.0 * value + double(
line[curr_char] -
'0');
160 if(digit &&
line[curr_char] !=
'.' &&
161 toupper(
line[curr_char]) !=
'E') {
163 std::string lexeme(
line.data() + lex_pos, curr_char - lex_pos);
168 if(
line[curr_char] ==
'.') {
172 while(isdigit(
line[curr_char])) {
173 value = 10.0 * value + double(
line[curr_char++] -
'0');
179 if(! digit) eflag =
true;
182 if(toupper(
line[curr_char]) ==
'E') {
186 if(
line[curr_char] ==
'+') {
188 }
else if(
line[curr_char] ==
'-') {
193 while(isdigit(
line[curr_char])) {
194 expval = 10 * expval + (
line[curr_char++] -
'0');
198 if(! digit) eflag =
true;
203 while(! isspace(ch) && ! ispunct(ch)) {
211 std::string lexeme(
line.data() + lex_pos, curr_char - lex_pos);
215 "Invalid numeric token \"" + lexeme +
"\".");
217 int power = expsig * expval - places;
220 for(places = power; places > 0; places--)
223 for(places = - power; places > 0; places--)
242 lexeme +
"\" not terminated at end of line.");
265 lexeme += toupper(ch);
268 while(isalnum(ch) || ch ==
'_' || ch ==
'.') {
269 lexeme += toupper(ch);
virtual bool fillLine()=0
Read next input line.
virtual Token readToken()
Read single token from file.
Abstract interface for a stream of input tokens.
Representation of a single input token.