• R/O
  • SSH
  • HTTPS

yash: Commit


Commit MetaInfo

Revision3853 (tree)
Time2018-09-15 00:57:07
Authormagicant

Log Message

Simplify conditionals in if command parser

Change Summary

Incremental Difference

--- yash/trunk/parser.c (revision 3852)
+++ yash/trunk/parser.c (revision 3853)
@@ -2112,23 +2112,16 @@
21122112 serror(ps, Ngt("commands are missing after `%ls'"),
21132113 after_else ? L"else" : L"then");
21142114 ensure_buffer(ps, 5);
2115- if (!after_else) {
2116- if (has_token(ps, L"else")) {
2117- ps->index += 4;
2118- after_else = true;
2119- } else if (has_token(ps, L"elif")) {
2120- ps->index += 4;
2121- } else if (has_token(ps, L"fi")) {
2122- ps->index += 2;
2123- break;
2124- } else {
2125- print_errmsg_token_missing(ps, L"fi");
2126- }
2115+ if (!after_else && has_token(ps, L"else")) {
2116+ ps->index += 4;
2117+ after_else = true;
2118+ } else if (!after_else && has_token(ps, L"elif")) {
2119+ ps->index += 4;
2120+ } else if (has_token(ps, L"fi")) {
2121+ ps->index += 2;
2122+ break;
21272123 } else {
2128- if (has_token(ps, L"fi"))
2129- ps->index += 2;
2130- else
2131- print_errmsg_token_missing(ps, L"fi");
2124+ print_errmsg_token_missing(ps, L"fi");
21322125 break;
21332126 }
21342127 }
Show on old repository browser