diff options
author | Michael Forney <mforney@mforney.org> | 2019-08-13 20:25:00 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-08-13 20:25:00 -0700 |
commit | 61a51797ed1b372f76d318cf328870b718dd61e2 (patch) | |
tree | 2958e8951de9642ef5ff596472eee48b3e2d746e | |
parent | db4b798e1fbd032b46fbd2a39d3c9797aa1dd34a (diff) | |
download | cproc-61a51797ed1b372f76d318cf328870b718dd61e2.tar.xz |
scan: Add `::` operator
This is needed for attributes, added in C2X (n2335).
-rw-r--r-- | cc.h | 1 | ||||
-rw-r--r-- | scan.c | 5 | ||||
-rw-r--r-- | token.c | 1 |
3 files changed, 6 insertions, 1 deletions
@@ -93,6 +93,7 @@ enum tokenkind { TLOR, TQUESTION, TCOLON, + TCOLONCOLON, TSEMICOLON, TELLIPSIS, TASSIGN, @@ -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; @@ -92,6 +92,7 @@ const char *tokstr[] = { [TLOR] = "||", [TQUESTION] = "?", [TCOLON] = ":", + [TCOLONCOLON] = "::", [TSEMICOLON] = ";", [TELLIPSIS] = "...", [TASSIGN] = "=", |