commit aaceda710f77c7337c774278bd99cc91495a5976
parent e85e5df216cbd26cc9a9b2ab79bf7638251d6ebd
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 1 Nov 2020 14:44:41 -0500
Add logical XOR operator (^^)
Diffstat:
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/lex.h b/include/lex.h
@@ -78,6 +78,7 @@ enum lexical_token {
T_LPAREN,
T_LSHIFT,
T_LSHIFTEQ,
+ T_LXOR,
T_MINUS,
T_MINUSEQ,
T_MINUSMINUS,
diff --git a/src/lex.c b/src/lex.c
@@ -83,6 +83,7 @@ static const char *tokens[] = {
[T_LPAREN] = "(",
[T_LSHIFT] = "<<",
[T_LSHIFTEQ] = "<<=",
+ [T_LXOR] = "^^",
[T_MINUS] = "-",
[T_MINUSEQ] = "-=",
[T_MINUSMINUS] = "--",
@@ -489,6 +490,9 @@ lex2(struct lexer *lexer, struct token *out, uint32_t c)
switch (c) {
case '^':
switch ((c = next(lexer, false))) {
+ case '^':
+ out->token = T_LXOR;
+ break;
case '=':
out->token = T_XOREQ;
break;