| 2339 | // |
| 2340 | |
| 2341 | static SLONG pass1(const TEXT* base_directory) |
| 2342 | { |
| 2343 | // FSG 14.Nov.2000 |
| 2344 | if (sw_verbose) { |
| 2345 | fprintf(stderr, "*********************** PASS 1 ***************************\n"); |
| 2346 | } |
| 2347 | |
| 2348 | while (CPR_token()) |
| 2349 | { |
| 2350 | while (gpreGlob.token_global.tok_symbol) |
| 2351 | { |
| 2352 | const SLONG start = gpreGlob.token_global.tok_position; |
| 2353 | act* action = PAR_action(base_directory); |
| 2354 | if (action) |
| 2355 | { |
| 2356 | action->act_position = start; |
| 2357 | if (!(action->act_flags & ACT_back_token)) { |
| 2358 | action->act_length = last_position - start; |
| 2359 | } |
| 2360 | else |
| 2361 | { |
| 2362 | action->act_length = |
| 2363 | gpreGlob.prior_token.tok_position + |
| 2364 | gpreGlob.prior_token.tok_length - 1 - start; |
| 2365 | } |
| 2366 | if (global_first_action) { |
| 2367 | global_last_action->act_rest = action; |
| 2368 | } |
| 2369 | else { |
| 2370 | global_first_action = action; |
| 2371 | } |
| 2372 | |
| 2373 | // Allow for more than one action to be generated by a token. |
| 2374 | |
| 2375 | do |
| 2376 | { |
| 2377 | global_last_action = action; |
| 2378 | if (action = action->act_rest) |
| 2379 | { |
| 2380 | if (action->act_type == ACT_database) |
| 2381 | { |
| 2382 | // CREATE DATABASE has two actions, the second one |
| 2383 | // is to generate global decl at the start of the |
| 2384 | // program file. |
| 2385 | |
| 2386 | global_last_action->act_rest = NULL; |
| 2387 | action->act_rest = global_first_action; |
| 2388 | global_first_action = action; |
| 2389 | action->act_position = -1; |
| 2390 | action->act_length = -1; |
| 2391 | break; |
| 2392 | } |
| 2393 | |
| 2394 | action->act_position = global_last_action->act_position; |
| 2395 | action->act_length = 0; |
| 2396 | } |
| 2397 | } while (action); |
| 2398 |
no test coverage detected