diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-06-29 01:23:37 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-06-29 01:23:37 +0200 |
commit | adcd9a6f349f3f2715a586b45fb27350b37cf1e5 (patch) | |
tree | 8d37943a51525a75c79fff7df27c220b6f14b0bf | |
parent | 832cb4fcb98d2845bd3f9d244593fc1b5f362ca0 (diff) | |
download | busybox-w32-adcd9a6f349f3f2715a586b45fb27350b37cf1e5.tar.gz busybox-w32-adcd9a6f349f3f2715a586b45fb27350b37cf1e5.tar.bz2 busybox-w32-adcd9a6f349f3f2715a586b45fb27350b37cf1e5.zip |
awk: use TS_foo for combined token classes. No code changes
Confusion with "simple" classes was the cause of a bug fixed by previous commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/awk.c | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/editors/awk.c b/editors/awk.c index 418bda160..764a3dd49 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -281,39 +281,39 @@ if ((n) & TC_NUMBER ) debug_printf_parse(" NUMBER" ); \ | |||
281 | } while (0) | 281 | } while (0) |
282 | #endif | 282 | #endif |
283 | 283 | ||
284 | /* combined token classes */ | 284 | /* combined token classes ("token [class] sets") */ |
285 | #define TC_UOPPRE (TC_UOPPRE1 | TC_UOPPRE2) | 285 | #define TS_UOPPRE (TC_UOPPRE1 | TC_UOPPRE2) |
286 | 286 | ||
287 | #define TC_BINOP (TC_BINOPX | TC_COMMA | TC_PIPE | TC_IN) | 287 | #define TS_BINOP (TC_BINOPX | TC_COMMA | TC_PIPE | TC_IN) |
288 | //#define TC_UNARYOP (TC_UOPPRE | TC_UOPPOST) | 288 | //#define TS_UNARYOP (TS_UOPPRE | TC_UOPPOST) |
289 | #define TC_OPERAND (TC_VARIABLE | TC_ARRAY | TC_FUNCTION \ | 289 | #define TS_OPERAND (TC_VARIABLE | TC_ARRAY | TC_FUNCTION \ |
290 | | TC_BUILTIN | TC_LENGTH | TC_GETLINE \ | 290 | | TC_BUILTIN | TC_LENGTH | TC_GETLINE \ |
291 | | TC_SEQSTART | TC_STRING | TC_NUMBER) | 291 | | TC_SEQSTART | TC_STRING | TC_NUMBER) |
292 | #define TC_LVALUE (TC_VARIABLE | TC_ARRAY) | ||
293 | 292 | ||
294 | #define TC_STATEMNT (TC_STATX | TC_WHILE) | 293 | #define TS_LVALUE (TC_VARIABLE | TC_ARRAY) |
295 | #define TC_OPTERM (TC_SEMICOL | TC_NEWLINE) | 294 | #define TS_STATEMNT (TC_STATX | TC_WHILE) |
295 | #define TS_OPTERM (TC_SEMICOL | TC_NEWLINE) | ||
296 | 296 | ||
297 | /* word tokens, cannot mean something else if not expected */ | 297 | /* word tokens, cannot mean something else if not expected */ |
298 | #define TC_WORD (TC_IN | TC_STATEMNT | TC_ELSE \ | 298 | #define TS_WORD (TC_IN | TS_STATEMNT | TC_ELSE \ |
299 | | TC_BUILTIN | TC_LENGTH | TC_GETLINE \ | 299 | | TC_BUILTIN | TC_LENGTH | TC_GETLINE \ |
300 | | TC_FUNCDECL | TC_BEGIN | TC_END) | 300 | | TC_FUNCDECL | TC_BEGIN | TC_END) |
301 | 301 | ||
302 | /* discard newlines after these */ | 302 | /* discard newlines after these */ |
303 | #define TC_NOTERM (TC_COMMA | TC_GRPSTART | TC_GRPTERM \ | 303 | #define TS_NOTERM (TC_COMMA | TC_GRPSTART | TC_GRPTERM \ |
304 | | TC_BINOP | TC_OPTERM) | 304 | | TS_BINOP | TS_OPTERM) |
305 | 305 | ||
306 | /* what can expression begin with */ | 306 | /* what can expression begin with */ |
307 | #define TC_OPSEQ (TC_OPERAND | TC_UOPPRE | TC_REGEXP) | 307 | #define TS_OPSEQ (TS_OPERAND | TS_UOPPRE | TC_REGEXP) |
308 | /* what can group begin with */ | 308 | /* what can group begin with */ |
309 | #define TC_GRPSEQ (TC_OPSEQ | TC_OPTERM | TC_STATEMNT | TC_GRPSTART) | 309 | #define TS_GRPSEQ (TS_OPSEQ | TS_OPTERM | TS_STATEMNT | TC_GRPSTART) |
310 | 310 | ||
311 | /* if previous token class is CONCAT1 and next is CONCAT2, concatenation */ | 311 | /* if previous token class is CONCAT_L and next is CONCAT_R, concatenation */ |
312 | /* operator is inserted between them */ | 312 | /* operator is inserted between them */ |
313 | #define TC_CONCAT1 (TC_VARIABLE | TC_ARRTERM | TC_SEQTERM \ | 313 | #define TS_CONCAT_L (TC_VARIABLE | TC_ARRTERM | TC_SEQTERM \ |
314 | | TC_STRING | TC_NUMBER | TC_UOPPOST \ | 314 | | TC_STRING | TC_NUMBER | TC_UOPPOST \ |
315 | | TC_LENGTH) | 315 | | TC_LENGTH) |
316 | #define TC_CONCAT2 (TC_OPERAND | TC_UOPPRE) | 316 | #define TS_CONCAT_R (TS_OPERAND | TS_UOPPRE) |
317 | 317 | ||
318 | #define OF_RES1 0x010000 | 318 | #define OF_RES1 0x010000 |
319 | #define OF_RES2 0x020000 | 319 | #define OF_RES2 0x020000 |
@@ -614,7 +614,7 @@ struct globals2 { | |||
614 | #define rsplitter (G.rsplitter ) | 614 | #define rsplitter (G.rsplitter ) |
615 | #define INIT_G() do { \ | 615 | #define INIT_G() do { \ |
616 | SET_PTR_TO_GLOBALS((char*)xzalloc(sizeof(G1)+sizeof(G)) + sizeof(G1)); \ | 616 | SET_PTR_TO_GLOBALS((char*)xzalloc(sizeof(G1)+sizeof(G)) + sizeof(G1)); \ |
617 | t_tclass = TC_OPTERM; \ | 617 | t_tclass = TS_OPTERM; \ |
618 | G.evaluate__seed = 1; \ | 618 | G.evaluate__seed = 1; \ |
619 | } while (0) | 619 | } while (0) |
620 | 620 | ||
@@ -1107,7 +1107,7 @@ static uint32_t next_token(uint32_t expected) | |||
1107 | const uint32_t *ti; | 1107 | const uint32_t *ti; |
1108 | uint32_t tc, last_token_class; | 1108 | uint32_t tc, last_token_class; |
1109 | 1109 | ||
1110 | last_token_class = t_tclass; /* t_tclass is initialized to TC_OPTERM */ | 1110 | last_token_class = t_tclass; /* t_tclass is initialized to TS_OPTERM */ |
1111 | 1111 | ||
1112 | debug_printf_parse("%s() expected(%x):", __func__, expected); | 1112 | debug_printf_parse("%s() expected(%x):", __func__, expected); |
1113 | debug_parse_print_tc(expected); | 1113 | debug_parse_print_tc(expected); |
@@ -1198,9 +1198,9 @@ static uint32_t next_token(uint32_t expected) | |||
1198 | * token matches, | 1198 | * token matches, |
1199 | * and it's not a longer word, | 1199 | * and it's not a longer word, |
1200 | */ | 1200 | */ |
1201 | if ((tc & (expected | TC_WORD | TC_NEWLINE)) | 1201 | if ((tc & (expected | TS_WORD | TC_NEWLINE)) |
1202 | && strncmp(p, tl, l) == 0 | 1202 | && strncmp(p, tl, l) == 0 |
1203 | && !((tc & TC_WORD) && isalnum_(p[l])) | 1203 | && !((tc & TS_WORD) && isalnum_(p[l])) |
1204 | ) { | 1204 | ) { |
1205 | /* then this is what we are looking for */ | 1205 | /* then this is what we are looking for */ |
1206 | t_info = *ti; | 1206 | t_info = *ti; |
@@ -1244,14 +1244,14 @@ static uint32_t next_token(uint32_t expected) | |||
1244 | g_pos = p; | 1244 | g_pos = p; |
1245 | 1245 | ||
1246 | /* skipping newlines in some cases */ | 1246 | /* skipping newlines in some cases */ |
1247 | if ((last_token_class & TC_NOTERM) && (tc & TC_NEWLINE)) | 1247 | if ((last_token_class & TS_NOTERM) && (tc & TC_NEWLINE)) |
1248 | goto readnext; | 1248 | goto readnext; |
1249 | 1249 | ||
1250 | /* insert concatenation operator when needed */ | 1250 | /* insert concatenation operator when needed */ |
1251 | debug_printf_parse("%s: concat_inserted if all nonzero: %x %x %x %x\n", __func__, | 1251 | debug_printf_parse("%s: concat_inserted if all nonzero: %x %x %x %x\n", __func__, |
1252 | (last_token_class & TC_CONCAT1), (tc & TC_CONCAT2), (expected & TC_BINOP), | 1252 | (last_token_class & TS_CONCAT_L), (tc & TS_CONCAT_R), (expected & TS_BINOP), |
1253 | !(last_token_class == TC_LENGTH && tc == TC_SEQSTART)); | 1253 | !(last_token_class == TC_LENGTH && tc == TC_SEQSTART)); |
1254 | if ((last_token_class & TC_CONCAT1) && (tc & TC_CONCAT2) && (expected & TC_BINOP) | 1254 | if ((last_token_class & TS_CONCAT_L) && (tc & TS_CONCAT_R) && (expected & TS_BINOP) |
1255 | && !(last_token_class == TC_LENGTH && tc == TC_SEQSTART) /* but not for "length(..." */ | 1255 | && !(last_token_class == TC_LENGTH && tc == TC_SEQSTART) /* but not for "length(..." */ |
1256 | ) { | 1256 | ) { |
1257 | concat_inserted = TRUE; | 1257 | concat_inserted = TRUE; |
@@ -1317,7 +1317,7 @@ static node *parse_expr(uint32_t term_tc) | |||
1317 | node sn; | 1317 | node sn; |
1318 | node *cn = &sn; | 1318 | node *cn = &sn; |
1319 | node *vn, *glptr; | 1319 | node *vn, *glptr; |
1320 | uint32_t tc, xtc; | 1320 | uint32_t tc, expected_tc; |
1321 | var *v; | 1321 | var *v; |
1322 | 1322 | ||
1323 | debug_printf_parse("%s() term_tc(%x):", __func__, term_tc); | 1323 | debug_printf_parse("%s() term_tc(%x):", __func__, term_tc); |
@@ -1326,20 +1326,20 @@ static node *parse_expr(uint32_t term_tc) | |||
1326 | 1326 | ||
1327 | sn.info = PRIMASK; | 1327 | sn.info = PRIMASK; |
1328 | sn.r.n = sn.a.n = glptr = NULL; | 1328 | sn.r.n = sn.a.n = glptr = NULL; |
1329 | xtc = TC_OPERAND | TC_UOPPRE | TC_REGEXP | term_tc; | 1329 | expected_tc = TS_OPERAND | TS_UOPPRE | TC_REGEXP | term_tc; |
1330 | 1330 | ||
1331 | while (!((tc = next_token(xtc)) & term_tc)) { | 1331 | while (!((tc = next_token(expected_tc)) & term_tc)) { |
1332 | 1332 | ||
1333 | if (glptr && (t_info == TI_LESS)) { | 1333 | if (glptr && (t_info == TI_LESS)) { |
1334 | /* input redirection (<) attached to glptr node */ | 1334 | /* input redirection (<) attached to glptr node */ |
1335 | debug_printf_parse("%s: input redir\n", __func__); | 1335 | debug_printf_parse("%s: input redir\n", __func__); |
1336 | cn = glptr->l.n = new_node(OC_CONCAT | SS | P(37)); | 1336 | cn = glptr->l.n = new_node(OC_CONCAT | SS | P(37)); |
1337 | cn->a.n = glptr; | 1337 | cn->a.n = glptr; |
1338 | xtc = TC_OPERAND | TC_UOPPRE; | 1338 | expected_tc = TS_OPERAND | TS_UOPPRE; |
1339 | glptr = NULL; | 1339 | glptr = NULL; |
1340 | 1340 | ||
1341 | } else if (tc & (TC_BINOP | TC_UOPPOST)) { | 1341 | } else if (tc & (TS_BINOP | TC_UOPPOST)) { |
1342 | debug_printf_parse("%s: TC_BINOP | TC_UOPPOST tc:%x\n", __func__, tc); | 1342 | debug_printf_parse("%s: TS_BINOP | TC_UOPPOST tc:%x\n", __func__, tc); |
1343 | /* for binary and postfix-unary operators, jump back over | 1343 | /* for binary and postfix-unary operators, jump back over |
1344 | * previous operators with higher priority */ | 1344 | * previous operators with higher priority */ |
1345 | vn = cn; | 1345 | vn = cn; |
@@ -1353,19 +1353,19 @@ static node *parse_expr(uint32_t term_tc) | |||
1353 | t_info += P(6); | 1353 | t_info += P(6); |
1354 | cn = vn->a.n->r.n = new_node(t_info); | 1354 | cn = vn->a.n->r.n = new_node(t_info); |
1355 | cn->a.n = vn->a.n; | 1355 | cn->a.n = vn->a.n; |
1356 | if (tc & TC_BINOP) { | 1356 | if (tc & TS_BINOP) { |
1357 | cn->l.n = vn; | 1357 | cn->l.n = vn; |
1358 | xtc = TC_OPERAND | TC_UOPPRE | TC_REGEXP; | 1358 | expected_tc = TS_OPERAND | TS_UOPPRE | TC_REGEXP; |
1359 | if ((t_info & OPCLSMASK) == OC_PGETLINE) { | 1359 | if ((t_info & OPCLSMASK) == OC_PGETLINE) { |
1360 | /* it's a pipe */ | 1360 | /* it's a pipe */ |
1361 | next_token(TC_GETLINE); | 1361 | next_token(TC_GETLINE); |
1362 | /* give maximum priority to this pipe */ | 1362 | /* give maximum priority to this pipe */ |
1363 | cn->info &= ~PRIMASK; | 1363 | cn->info &= ~PRIMASK; |
1364 | xtc = TC_OPERAND | TC_UOPPRE | TC_BINOP | term_tc; | 1364 | expected_tc = TS_OPERAND | TS_UOPPRE | TS_BINOP | term_tc; |
1365 | } | 1365 | } |
1366 | } else { | 1366 | } else { |
1367 | cn->r.n = vn; | 1367 | cn->r.n = vn; |
1368 | xtc = TC_OPERAND | TC_UOPPRE | TC_BINOP | term_tc; | 1368 | expected_tc = TS_OPERAND | TS_UOPPRE | TS_BINOP | term_tc; |
1369 | } | 1369 | } |
1370 | vn->a.n = cn; | 1370 | vn->a.n = cn; |
1371 | 1371 | ||
@@ -1377,14 +1377,14 @@ static node *parse_expr(uint32_t term_tc) | |||
1377 | cn = vn->r.n = new_node(t_info); | 1377 | cn = vn->r.n = new_node(t_info); |
1378 | cn->a.n = vn; | 1378 | cn->a.n = vn; |
1379 | 1379 | ||
1380 | xtc = TC_OPERAND | TC_UOPPRE | TC_REGEXP; | 1380 | expected_tc = TS_OPERAND | TS_UOPPRE | TC_REGEXP; |
1381 | if (t_info == TI_PREINC || t_info == TI_PREDEC) | 1381 | if (t_info == TI_PREINC || t_info == TI_PREDEC) |
1382 | xtc = TC_LVALUE | TC_UOPPRE1; | 1382 | expected_tc = TS_LVALUE | TC_UOPPRE1; |
1383 | if (tc & (TC_OPERAND | TC_REGEXP)) { | 1383 | if (tc & (TS_OPERAND | TC_REGEXP)) { |
1384 | debug_printf_parse("%s: TC_OPERAND | TC_REGEXP\n", __func__); | 1384 | debug_printf_parse("%s: TS_OPERAND | TC_REGEXP\n", __func__); |
1385 | xtc = TC_UOPPRE | TC_UOPPOST | TC_BINOP | TC_OPERAND | term_tc; | 1385 | expected_tc = TS_UOPPRE | TC_UOPPOST | TS_BINOP | TS_OPERAND | term_tc; |
1386 | /* one should be very careful with switch on tclass - | 1386 | /* one should be very careful with switch on tclass - |
1387 | * only simple tclasses should be used! */ | 1387 | * only simple tclasses should be used (TC_xyz, not TS_xyz) */ |
1388 | switch (tc) { | 1388 | switch (tc) { |
1389 | case TC_VARIABLE: | 1389 | case TC_VARIABLE: |
1390 | case TC_ARRAY: | 1390 | case TC_ARRAY: |
@@ -1412,7 +1412,7 @@ static node *parse_expr(uint32_t term_tc) | |||
1412 | setvar_i(v, t_double); | 1412 | setvar_i(v, t_double); |
1413 | else { | 1413 | else { |
1414 | setvar_s(v, t_string); | 1414 | setvar_s(v, t_string); |
1415 | xtc &= ~TC_UOPPOST; /* "str"++ is not allowed */ | 1415 | expected_tc &= ~TC_UOPPOST; /* "str"++ is not allowed */ |
1416 | } | 1416 | } |
1417 | break; | 1417 | break; |
1418 | 1418 | ||
@@ -1439,7 +1439,7 @@ static node *parse_expr(uint32_t term_tc) | |||
1439 | case TC_GETLINE: | 1439 | case TC_GETLINE: |
1440 | debug_printf_parse("%s: TC_GETLINE\n", __func__); | 1440 | debug_printf_parse("%s: TC_GETLINE\n", __func__); |
1441 | glptr = cn; | 1441 | glptr = cn; |
1442 | xtc = TC_OPERAND | TC_UOPPRE | TC_BINOP | term_tc; | 1442 | expected_tc = TS_OPERAND | TS_UOPPRE | TS_BINOP | term_tc; |
1443 | break; | 1443 | break; |
1444 | 1444 | ||
1445 | case TC_BUILTIN: | 1445 | case TC_BUILTIN: |
@@ -1450,7 +1450,7 @@ static node *parse_expr(uint32_t term_tc) | |||
1450 | case TC_LENGTH: | 1450 | case TC_LENGTH: |
1451 | debug_printf_parse("%s: TC_LENGTH\n", __func__); | 1451 | debug_printf_parse("%s: TC_LENGTH\n", __func__); |
1452 | next_token(TC_SEQSTART /* length(...) */ | 1452 | next_token(TC_SEQSTART /* length(...) */ |
1453 | | TC_OPTERM /* length; (or newline)*/ | 1453 | | TS_OPTERM /* length; (or newline)*/ |
1454 | | TC_GRPTERM /* length } */ | 1454 | | TC_GRPTERM /* length } */ |
1455 | | TC_BINOPX /* length <op> NUM */ | 1455 | | TC_BINOPX /* length <op> NUM */ |
1456 | | TC_COMMA /* print length, 1 */ | 1456 | | TC_COMMA /* print length, 1 */ |
@@ -1464,7 +1464,7 @@ static node *parse_expr(uint32_t term_tc) | |||
1464 | } | 1464 | } |
1465 | } | 1465 | } |
1466 | } | 1466 | } |
1467 | } | 1467 | } /* while() */ |
1468 | 1468 | ||
1469 | debug_printf_parse("%s() returns %p\n", __func__, sn.r.n); | 1469 | debug_printf_parse("%s() returns %p\n", __func__, sn.r.n); |
1470 | return sn.r.n; | 1470 | return sn.r.n; |
@@ -1497,7 +1497,7 @@ static void chain_expr(uint32_t info) | |||
1497 | 1497 | ||
1498 | n = chain_node(info); | 1498 | n = chain_node(info); |
1499 | 1499 | ||
1500 | n->l.n = parse_expr(TC_OPTERM | TC_GRPTERM); | 1500 | n->l.n = parse_expr(TS_OPTERM | TC_GRPTERM); |
1501 | if ((info & OF_REQUIRED) && !n->l.n) | 1501 | if ((info & OF_REQUIRED) && !n->l.n) |
1502 | syntax_error(EMSG_TOO_FEW_ARGS); | 1502 | syntax_error(EMSG_TOO_FEW_ARGS); |
1503 | 1503 | ||
@@ -1535,12 +1535,12 @@ static void chain_group(void) | |||
1535 | node *n, *n2, *n3; | 1535 | node *n, *n2, *n3; |
1536 | 1536 | ||
1537 | do { | 1537 | do { |
1538 | c = next_token(TC_GRPSEQ); | 1538 | c = next_token(TS_GRPSEQ); |
1539 | } while (c & TC_NEWLINE); | 1539 | } while (c & TC_NEWLINE); |
1540 | 1540 | ||
1541 | if (c & TC_GRPSTART) { | 1541 | if (c & TC_GRPSTART) { |
1542 | debug_printf_parse("%s: TC_GRPSTART\n", __func__); | 1542 | debug_printf_parse("%s: TC_GRPSTART\n", __func__); |
1543 | while (next_token(TC_GRPSEQ | TC_GRPTERM) != TC_GRPTERM) { | 1543 | while (next_token(TS_GRPSEQ | TC_GRPTERM) != TC_GRPTERM) { |
1544 | debug_printf_parse("%s: !TC_GRPTERM\n", __func__); | 1544 | debug_printf_parse("%s: !TC_GRPTERM\n", __func__); |
1545 | if (t_tclass & TC_NEWLINE) | 1545 | if (t_tclass & TC_NEWLINE) |
1546 | continue; | 1546 | continue; |
@@ -1548,13 +1548,13 @@ static void chain_group(void) | |||
1548 | chain_group(); | 1548 | chain_group(); |
1549 | } | 1549 | } |
1550 | debug_printf_parse("%s: TC_GRPTERM\n", __func__); | 1550 | debug_printf_parse("%s: TC_GRPTERM\n", __func__); |
1551 | } else if (c & (TC_OPSEQ | TC_OPTERM)) { | 1551 | } else if (c & (TS_OPSEQ | TS_OPTERM)) { |
1552 | debug_printf_parse("%s: TC_OPSEQ | TC_OPTERM\n", __func__); | 1552 | debug_printf_parse("%s: TS_OPSEQ | TS_OPTERM\n", __func__); |
1553 | rollback_token(); | 1553 | rollback_token(); |
1554 | chain_expr(OC_EXEC | Vx); | 1554 | chain_expr(OC_EXEC | Vx); |
1555 | } else { | 1555 | } else { |
1556 | /* TC_STATEMNT */ | 1556 | /* TS_STATEMNT */ |
1557 | debug_printf_parse("%s: TC_STATEMNT(?)\n", __func__); | 1557 | debug_printf_parse("%s: TS_STATEMNT(?)\n", __func__); |
1558 | switch (t_info & OPCLSMASK) { | 1558 | switch (t_info & OPCLSMASK) { |
1559 | case ST_IF: | 1559 | case ST_IF: |
1560 | debug_printf_parse("%s: ST_IF\n", __func__); | 1560 | debug_printf_parse("%s: ST_IF\n", __func__); |
@@ -1563,7 +1563,7 @@ static void chain_group(void) | |||
1563 | chain_group(); | 1563 | chain_group(); |
1564 | n2 = chain_node(OC_EXEC); | 1564 | n2 = chain_node(OC_EXEC); |
1565 | n->r.n = seq->last; | 1565 | n->r.n = seq->last; |
1566 | if (next_token(TC_GRPSEQ | TC_GRPTERM | TC_ELSE) == TC_ELSE) { | 1566 | if (next_token(TS_GRPSEQ | TC_GRPTERM | TC_ELSE) == TC_ELSE) { |
1567 | chain_group(); | 1567 | chain_group(); |
1568 | n2->a.n = seq->last; | 1568 | n2->a.n = seq->last; |
1569 | } else { | 1569 | } else { |
@@ -1616,10 +1616,10 @@ static void chain_group(void) | |||
1616 | case OC_PRINTF: | 1616 | case OC_PRINTF: |
1617 | debug_printf_parse("%s: OC_PRINT[F]\n", __func__); | 1617 | debug_printf_parse("%s: OC_PRINT[F]\n", __func__); |
1618 | n = chain_node(t_info); | 1618 | n = chain_node(t_info); |
1619 | n->l.n = parse_expr(TC_OPTERM | TC_OUTRDR | TC_GRPTERM); | 1619 | n->l.n = parse_expr(TS_OPTERM | TC_OUTRDR | TC_GRPTERM); |
1620 | if (t_tclass & TC_OUTRDR) { | 1620 | if (t_tclass & TC_OUTRDR) { |
1621 | n->info |= t_info; | 1621 | n->info |= t_info; |
1622 | n->r.n = parse_expr(TC_OPTERM | TC_GRPTERM); | 1622 | n->r.n = parse_expr(TS_OPTERM | TC_GRPTERM); |
1623 | } | 1623 | } |
1624 | if (t_tclass & TC_GRPTERM) | 1624 | if (t_tclass & TC_GRPTERM) |
1625 | rollback_token(); | 1625 | rollback_token(); |
@@ -1658,11 +1658,11 @@ static void parse_program(char *p) | |||
1658 | 1658 | ||
1659 | g_pos = p; | 1659 | g_pos = p; |
1660 | t_lineno = 1; | 1660 | t_lineno = 1; |
1661 | while ((tclass = next_token(TC_EOF | TC_OPSEQ | TC_GRPSTART | | 1661 | while ((tclass = next_token(TC_EOF | TS_OPSEQ | TC_GRPSTART | |
1662 | TC_OPTERM | TC_BEGIN | TC_END | TC_FUNCDECL)) != TC_EOF) { | 1662 | TS_OPTERM | TC_BEGIN | TC_END | TC_FUNCDECL)) != TC_EOF) { |
1663 | 1663 | ||
1664 | if (tclass & TC_OPTERM) { | 1664 | if (tclass & TS_OPTERM) { |
1665 | debug_printf_parse("%s: TC_OPTERM\n", __func__); | 1665 | debug_printf_parse("%s: TS_OPTERM\n", __func__); |
1666 | continue; | 1666 | continue; |
1667 | } | 1667 | } |
1668 | 1668 | ||
@@ -1706,11 +1706,11 @@ static void parse_program(char *p) | |||
1706 | seq = &f->body; | 1706 | seq = &f->body; |
1707 | chain_group(); | 1707 | chain_group(); |
1708 | clear_array(ahash); | 1708 | clear_array(ahash); |
1709 | } else if (tclass & TC_OPSEQ) { | 1709 | } else if (tclass & TS_OPSEQ) { |
1710 | debug_printf_parse("%s: TC_OPSEQ\n", __func__); | 1710 | debug_printf_parse("%s: TS_OPSEQ\n", __func__); |
1711 | rollback_token(); | 1711 | rollback_token(); |
1712 | cn = chain_node(OC_TEST); | 1712 | cn = chain_node(OC_TEST); |
1713 | cn->l.n = parse_expr(TC_OPTERM | TC_EOF | TC_GRPSTART); | 1713 | cn->l.n = parse_expr(TS_OPTERM | TC_EOF | TC_GRPSTART); |
1714 | if (t_tclass & TC_GRPSTART) { | 1714 | if (t_tclass & TC_GRPSTART) { |
1715 | debug_printf_parse("%s: TC_GRPSTART\n", __func__); | 1715 | debug_printf_parse("%s: TC_GRPSTART\n", __func__); |
1716 | rollback_token(); | 1716 | rollback_token(); |