From 11cf6e709bab83a8a70e99cc8b7f58968fef0e37 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 8 Mar 2020 19:59:09 +0100 Subject: [PATCH] third trial: get the token i(vss) as a whole in the lexer, this prevents the parser from generating the spurious vector vss. No need to do an extra translation i(vss) -> vss#branch. --- src/frontend/parse.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/frontend/parse.c b/src/frontend/parse.c index cc86903d0..2dba28d34 100644 --- a/src/frontend/parse.c +++ b/src/frontend/parse.c @@ -709,10 +709,8 @@ int PPlex(YYSTYPE *lvalp, struct PPltype *llocp, char **line) * * what is valid here ? * foo dc1.foo dc1.@m1[vth] - * this too ? * vthing#branch - * should we convert the pseudo identifier ? - * i(v5) --> v5#branch + * i(vthing) */ for (; *sbuf && !strchr(specials, *sbuf); sbuf++) if (*sbuf == '@') { @@ -727,6 +725,14 @@ int PPlex(YYSTYPE *lvalp, struct PPltype *llocp, char **line) } break; } + /* keep the identifier i(vss) as a single token, even as dc1.i(vss) */ + else if (prefix("i(v", sbuf)) { + if (get_r_paren(&sbuf) == 1) { + fprintf(stderr, "Error: missing ')' in token\n %s\n", start); + break; + } + sbuf--; + } lvalp->str = copy_substring(start, sbuf); lexer_return(TOK_STR, 0);