cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit 61a51797ed1b372f76d318cf328870b718dd61e2
parent db4b798e1fbd032b46fbd2a39d3c9797aa1dd34a
Author: Michael Forney <mforney@mforney.org>
Date:   Tue, 13 Aug 2019 20:25:00 -0700

scan: Add `::` operator

This is needed for attributes, added in C2X (n2335).

Diffstat:
Mcc.h | 1+
Mscan.c | 5++++-
Mtoken.c | 1+
3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/cc.h b/cc.h @@ -93,6 +93,7 @@ enum tokenkind { TLOR, TQUESTION, TCOLON, + TCOLONCOLON, TSEMICOLON, TELLIPSIS, TASSIGN, diff --git a/scan.c b/scan.c @@ -367,7 +367,10 @@ again: return TQUESTION; case ':': nextchar(s); - return TCOLON; + if (s->chr != ':') + return TCOLON; + nextchar(s); + return TCOLONCOLON; case ';': nextchar(s); return TSEMICOLON; diff --git a/token.c b/token.c @@ -92,6 +92,7 @@ const char *tokstr[] = { [TLOR] = "||", [TQUESTION] = "?", [TCOLON] = ":", + [TCOLONCOLON] = "::", [TSEMICOLON] = ";", [TELLIPSIS] = "...", [TASSIGN] = "=",