@@ -154,11 +154,11 @@ std::vector<Token> tokenize(const std::string &source)
154154 }
155155 } else if (isalpha (c)) {
156156 t.type = IDENTIFIER;
157- std::string::size_type j = i;
158- while (j < source.length () && (isalnum (source.at (j )) || source.at (j ) == ' _' )) {
159- j ++;
157+ auto const start = i;
158+ while (i < source.length () && (isalnum (source.at (i )) || source.at (i ) == ' _' )) {
159+ i ++;
160160 }
161- t.text = source.substr (i, j-i );
161+ t.text = source.substr (start, i-start );
162162 if (t.text == " IF" ) t.type = IF;
163163 else if (t.text == " THEN" ) t.type = THEN;
164164 else if (t.text == " ELSE" ) t.type = ELSE;
@@ -190,7 +190,6 @@ std::vector<Token> tokenize(const std::string &source)
190190 else if (t.text == " CASE" ) t.type = CASE;
191191 else if (t.text == " WHEN" ) t.type = WHEN;
192192 else if (t.text == " EXTERNAL" ) t.type = EXTERNAL;
193- i = j;
194193 } else if (isdigit (c)) {
195194 t.type = NUMBER;
196195 if (c == ' 0' && (i+1 < source.length ()) && source.at (i+1 ) != ' .' && tolower (source.at (i+1 )) != ' e' && not isdigit (source.at (i+1 ))) {
@@ -213,16 +212,16 @@ std::vector<Token> tokenize(const std::string &source)
213212 if (base < 2 || base > 36 ) {
214213 error (1001 , t, " invalid base" );
215214 }
216- auto j = i + (end - (source.c_str () + i));
217- if (source.at (j ) != ' #' ) {
215+ i += (end - (source.c_str () + i));
216+ if (source.at (i ) != ' #' ) {
218217 error (1002 , t, " '#' expected" );
219218 }
220- i = j + 1 ;
219+ i++ ;
221220 } else {
222221 error (1003 , t, " invalid base character" );
223222 }
224223 Number value = number_from_uint32 (0 );
225- auto start = i;
224+ const auto start = i;
226225 while (i < source.length ()) {
227226 c = static_cast <char >(tolower (source.at (i)));
228227 if (c == ' .' ) {
@@ -247,27 +246,26 @@ std::vector<Token> tokenize(const std::string &source)
247246 i++;
248247 }
249248 } else {
250- auto j = i;
251- while (j < source.length () && isdigit (source.at (j ))) {
252- j ++;
249+ const auto start = i;
250+ while (i < source.length () && isdigit (source.at (i ))) {
251+ i ++;
253252 }
254- if (j < source.length () && source.at (j ) == ' .' && source.at (j +1 ) != ' .' ) {
255- j ++;
256- while (j < source.length () && isdigit (source.at (j ))) {
257- j ++;
253+ if (i < source.length () && source.at (i ) == ' .' && source.at (i +1 ) != ' .' ) {
254+ i ++;
255+ while (i < source.length () && isdigit (source.at (i ))) {
256+ i ++;
258257 }
259258 }
260- if (j < source.length () && tolower (source.at (j )) == ' e' ) {
261- j ++;
262- if (j < source.length () && (source.at (j ) == ' +' || source.at (j ) == ' -' )) {
263- j ++;
259+ if (i < source.length () && tolower (source.at (i )) == ' e' ) {
260+ i ++;
261+ if (i < source.length () && (source.at (i ) == ' +' || source.at (i ) == ' -' )) {
262+ i ++;
264263 }
265- while (j < source.length () && isdigit (source.at (j ))) {
266- j ++;
264+ while (i < source.length () && isdigit (source.at (i ))) {
265+ i ++;
267266 }
268267 }
269- t.value = number_from_string (source.substr (i, j-i));
270- i = j;
268+ t.value = number_from_string (source.substr (start, i-start));
271269 }
272270 } else if (c == ' "' ) {
273271 i++;
0 commit comments