diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-05-09 16:21:31 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-05-09 16:21:31 +0100 |
| commit | c6d531df9597253ee95593c56e61039fe4e40ba2 (patch) | |
| tree | 8469ee00657577f4909891e8773231351f54b3cd /src/tokenizer.c | |
| parent | 8677c81da7ca8af37c49a203a18fd7beab74f023 (diff) | |
Add %% operator (divisor modulo)
Diffstat (limited to 'src/tokenizer.c')
| -rw-r--r-- | src/tokenizer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tokenizer.c b/src/tokenizer.c index bc979a784..08496a6d1 100644 --- a/src/tokenizer.c +++ b/src/tokenizer.c @@ -25,6 +25,7 @@ TOKEN_KIND(Token__OperatorBegin, "_OperatorBegin"), \ TOKEN_KIND(Token_Mul, "*"), \ TOKEN_KIND(Token_Quo, "/"), \ TOKEN_KIND(Token_Mod, "%"), \ + TOKEN_KIND(Token_ModMod, "%%"), \ TOKEN_KIND(Token_And, "&"), \ TOKEN_KIND(Token_Or, "|"), \ TOKEN_KIND(Token_Xor, "~"), \ @@ -41,6 +42,7 @@ TOKEN_KIND(Token__AssignOpBegin, "_AssignOpBegin"), \ TOKEN_KIND(Token_MulEq, "*="), \ TOKEN_KIND(Token_QuoEq, "/="), \ TOKEN_KIND(Token_ModEq, "%="), \ + TOKEN_KIND(Token_ModModEq, "%%="), \ TOKEN_KIND(Token_AndEq, "&="), \ TOKEN_KIND(Token_OrEq, "|="), \ TOKEN_KIND(Token_XorEq, "~="), \ @@ -892,8 +894,9 @@ Token tokenizer_get_token(Tokenizer *t) { case '}': token.kind = Token_CloseBrace; break; case '\\': token.kind = Token_BackSlash; break; + case '%': token.kind = token_kind_dub_eq(t, '%', Token_Mod, Token_ModEq, Token_ModMod, Token_ModModEq); break; + case '*': token.kind = token_kind_variant2(t, Token_Mul, Token_MulEq); break; - case '%': token.kind = token_kind_variant2(t, Token_Mod, Token_ModEq); break; case '=': token.kind = token_kind_variant2(t, Token_Eq, Token_CmpEq); break; case '~': token.kind = token_kind_variant2(t, Token_Xor, Token_XorEq); break; case '!': token.kind = token_kind_variant2(t, Token_Not, Token_NotEq); break; |