From b447f2670343ad869b258672120ef13c9e711c34 Mon Sep 17 00:00:00 2001 From: rlar Date: Mon, 5 Oct 2015 21:23:09 +0200 Subject: [PATCH] `E..table {expr} {pairs}', `G..', allow an optional `=' after `table' --- src/frontend/inpcom.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index ec948115d..d28cfffc0 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -4251,14 +4251,18 @@ inp_compat(struct line *card) // Exxx n1 n2 int1 0 1 ckt_array[0] = tprintf("%s %s %s %s_int1 0 1", title_tok, node1, node2, title_tok); - // get the expression - str_ptr = gettok(&cut_line); /* ignore 'table' */ - if (!cieq(str_ptr, "table")) { + // skip "table" + cut_line = skip_ws(cut_line); + if (!ciprefix("table", cut_line)) { fprintf(stderr, "Error: bad syntax in line %d\n %s\n", card->li_linenum_orig, card->li_line); controlled_exit(EXIT_BAD); } - tfree(str_ptr); + cut_line += 5; + // compatibility, allow table = {expr} {pairs} + if (*cut_line == '=') + *cut_line++ = ' '; + // get the expression str_ptr = gettok_char(&cut_line, '{', FALSE, FALSE); expression = gettok_char(&cut_line, '}', TRUE, TRUE); /* expression */ if (!expression || !str_ptr) { @@ -4437,14 +4441,18 @@ inp_compat(struct line *card) m_token = copy("1"); ckt_array[0] = tprintf("%s %s %s %s_int1 0 %s", title_tok, node1, node2, title_tok, m_token); - // get the expression - str_ptr = gettok(&cut_line); /* ignore 'table' */ - if (!cieq(str_ptr, "table")) { + // skip "table" + cut_line = skip_ws(cut_line); + if (!ciprefix("table", cut_line)) { fprintf(stderr, "Error: bad syntax in line %d\n %s\n", card->li_linenum_orig, card->li_line); controlled_exit(EXIT_BAD); } - tfree(str_ptr); + cut_line += 5; + // compatibility, allow table = {expr} {pairs} + if (*cut_line == '=') + *cut_line++ = ' '; + // get the expression str_ptr = gettok_char(&cut_line, '{', FALSE, FALSE); expression = gettok_char(&cut_line, '}', TRUE, TRUE); /* expression */ if (!expression || !str_ptr) {