From 8c69ada5b534e909aea642b6b15fcbfb670914bf Mon Sep 17 00:00:00 2001 From: Brian Taylor Date: Tue, 7 Mar 2023 17:16:38 -0800 Subject: [PATCH] The logicexp example in the PSpice ref. manual has a name with a '+' character (LCN+4). Update lexer_scan. --- src/frontend/logicexp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/frontend/logicexp.c b/src/frontend/logicexp.c index 6dc47c680..e25b89a5c 100644 --- a/src/frontend/logicexp.c +++ b/src/frontend/logicexp.c @@ -347,7 +347,7 @@ static int lex_gate_op(int c) static int lex_ident(int c) { /* Pspice and MicroCap are vague about what defines an identifier */ - if (isalnum(c) || c == '_' || c == '/' || c == '-') + if (isalnum(c) || c == '_' || c == '/' || c == '-' || c == '+') return c; else return 0; @@ -369,6 +369,11 @@ static int lexer_scan(LEXER lx) return c; else if (lex_ident(c)) { size_t i = 0; + if (c == '+') { // an identifier does not begin with '+' + lx->lexer_buf[0] = (char) c; + lx->lexer_buf[1] = '\0'; + return LEX_OTHER; + } while (lex_ident(c)) { if (i >= lx->lexer_blen) { lx->lexer_blen *= 2;