From e5f2fac8c5ae5a1b74335816836872c2e24904e6 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Mon, 7 Feb 2022 23:07:57 -0500 Subject: [cup] Add `>>` and `<<` operators, `fork()` buildin and `SYS_execve` --- compiler/lexer.cup | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compiler/lexer.cup') 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); -- cgit v1.2.3