diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-08-18 11:47:03 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-08-18 11:47:03 -0700 |
commit | 564fd080c753f20ce16c321c6ff94ae28a468df4 (patch) | |
tree | 1cd8738c011a6ffec77fa1f157001d6dd88f615d | |
parent | f35b7f1f7df5b61ab54674f88c1eea1ffbe6b908 (diff) | |
download | txr-564fd080c753f20ce16c321c6ff94ae28a468df4.tar.gz txr-564fd080c753f20ce16c321c6ff94ae28a468df4.tar.bz2 txr-564fd080c753f20ce16c321c6ff94ae28a468df4.zip |
parser: rename circ_suppress flag.
* parser.h (struct parser): eof flag changed to unsigned char.
circ_suppress flag renamed to ignore, changed to unsigned char
and relocated next to eof to compact together.
* parser.c (parser_circ_ref): Follow rename.
* parser.y (hash_semi_or_n_expr, hash_semi_or_i_expr, n_exprs,
parse): Likewise.
-rw-r--r-- | parser.c | 2 | ||||
-rw-r--r-- | parser.h | 4 | ||||
-rw-r--r-- | parser.y | 26 |
3 files changed, 16 insertions, 16 deletions
@@ -424,7 +424,7 @@ val parser_circ_ref(parser_t *p, val num) if (!obj) yyerrorf(p->scanner, lit("dangling #~s# ref"), num, nao); - if (obj == unique_s && !p->circ_suppress) { + if (obj == unique_s && !p->ignore) { p->circ_count++; return cons(circref_s, cons(num, nil)); } @@ -50,7 +50,8 @@ struct parser { val parser; cnum lineno; int errors; - int eof; + unsigned char eof; + unsigned char ignore; val stream; val name; val prepared_msg; @@ -58,7 +59,6 @@ struct parser { int quasi_level; val circ_ref_hash; cnum circ_count; - int circ_suppress; scanner_t *scanner; struct yy_token recent_tok; struct yy_token tok_pushback[4]; @@ -198,21 +198,21 @@ spec : clauses_opt { parser->syntax_tree = $1; } ; -hash_semi_or_n_expr : HASH_SEMI { parser->circ_suppress = 1; } - n_expr { parser->circ_suppress = 0; +hash_semi_or_n_expr : HASH_SEMI { parser->ignore = 1; } + n_expr { parser->ignore = 0; $$ = nao; } - | HASH_SEMI '.' { parser->circ_suppress = 1; } - n_expr { parser->circ_suppress = 0; + | HASH_SEMI '.' { parser->ignore = 1; } + n_expr { parser->ignore = 0; $$ = nao; } | n_expr { $$ = $1; } | '.' n_expr { $$ = uref_helper(parser, $2); } ; -hash_semi_or_i_expr : HASH_SEMI { parser->circ_suppress = 1; } - i_expr { parser->circ_suppress = 0; +hash_semi_or_i_expr : HASH_SEMI { parser->ignore = 1; } + i_expr { parser->ignore = 0; $$ = nao; } - | HASH_SEMI '.' { parser->circ_suppress = 1; } - i_expr { parser->circ_suppress = 0; + | HASH_SEMI '.' { parser->ignore = 1; } + i_expr { parser->ignore = 0; $$ = nao; } | i_expr { $$ = $1; } | '.' i_expr { $$ = uref_helper(parser, $2); } @@ -910,11 +910,11 @@ n_exprs : r_exprs { val term_atom = pop(&$1); r_exprs : n_expr { val exprs = cons($1, nil); rlc(exprs, $1); $$ = rlc(cons(unique_s, exprs), exprs); } - | HASH_SEMI { parser->circ_suppress = 1; } - n_expr { parser->circ_suppress = 0; + | HASH_SEMI { parser->ignore = 1; } + n_expr { parser->ignore = 0; $$ = cons(unique_s, nil); } - | r_exprs HASH_SEMI { parser->circ_suppress = 1; } - n_expr { parser->circ_suppress = 0; + | r_exprs HASH_SEMI { parser->ignore = 1; } + n_expr { parser->ignore = 0; $$ = $1; } | r_exprs n_expr { uses_or2; val term_atom_cons = $1; @@ -1882,10 +1882,10 @@ int parse(parser_t *parser, val name, enum prime_parser prim) parser->errors = 0; parser->eof = 0; + parser->ignore = 0; parser->prepared_msg = nil; parser->circ_ref_hash = nil; parser->circ_count = 0; - parser->circ_suppress = 0; parser->syntax_tree = nil; parser->quasi_level = 0; |