aboutsummaryrefslogtreecommitdiff
path: root/compiler/lexer.cup
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-07 23:07:57 -0500
committerMustafa Quraish <[email protected]>2022-02-08 02:07:18 -0500
commite5f2fac8c5ae5a1b74335816836872c2e24904e6 (patch)
treeed131049d39320967d8d18f65749c08ebb2f79a0 /compiler/lexer.cup
parentMark bootstrap files as binary in `.gitattributes` (diff)
downloadcup-master.tar.xz
cup-master.zip
[cup] Add `>>` and `<<` operators, `fork()` buildin and `SYS_execve`HEADmaster
Diffstat (limited to 'compiler/lexer.cup')
-rw-r--r--compiler/lexer.cup4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/lexer.cup b/compiler/lexer.cup
index 9e967f8..e6d0c0b 100644
--- a/compiler/lexer.cup
+++ b/compiler/lexer.cup
@@ -138,12 +138,16 @@ fn lexer_next(lexer: Lexer*, token: Token*) {
}
else if (c == '<') {
+ if (lexer_peek_char(lexer, 1) == '<')
+ return lexer_make_token(lexer, token, TOKEN_LSHIFT, 2);
if (lexer_peek_char(lexer, 1) == '=')
return lexer_make_token(lexer, token, TOKEN_LEQ, 2);
return lexer_make_token(lexer, token, TOKEN_LT, 1);
}
else if (c == '>') {
+ if (lexer_peek_char(lexer, 1) == '>')
+ return lexer_make_token(lexer, token, TOKEN_RSHIFT, 2);
if (lexer_peek_char(lexer, 1) == '=')
return lexer_make_token(lexer, token, TOKEN_GEQ, 2);
return lexer_make_token(lexer, token, TOKEN_GT, 1);