From fe24a4135c54f8b2d5203af968fcd5ba28a963f3 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 4 Dec 2020 17:29:24 +0100 Subject: [PATCH] spice2g6 poly(19 compat: When counting token, count an expression {...} for the gain as a single token, even if it contains spaces. --- src/frontend/inpcom.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 024186f6f..5d15bc2a7 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -9157,7 +9157,14 @@ static void inp_poly_2g6_compat(struct card* deck) { case 'e': curr_line = nexttok(curr_line); curr_line = nexttok(curr_line); - curr_line = nexttok(curr_line); + /* The next token may be a simple text token or an expression + enclosed in brackets */ + if (*curr_line == '{') { + char* tmptok = gettok_char(&curr_line, '}', TRUE, TRUE); + tfree(tmptok); + } + else + curr_line = nexttok(curr_line); if (!curr_line) { fprintf(stderr, "Error: not enough parameters in line\n %s\n", thisline); controlled_exit(1); @@ -9168,7 +9175,14 @@ static void inp_poly_2g6_compat(struct card* deck) { case 'f': case 'h': curr_line = nexttok(curr_line); - curr_line = nexttok(curr_line); + /* The next token may be a simple text token or an expression + enclosed in brackets */ + if (*curr_line == '{') { + char* tmptok = gettok_char(&curr_line, '}', TRUE, TRUE); + tfree(tmptok); + } + else + curr_line = nexttok(curr_line); if (!curr_line) { fprintf(stderr, "Error: not enough parameters in line\n %s\n", thisline); controlled_exit(1);