From 7d5787c84ce953dd750ccf731a74bc024e4a822d Mon Sep 17 00:00:00 2001 From: bronku Date: Tue, 25 Nov 2025 17:39:17 +0100 Subject: [PATCH] test 10 --- src/lexer.l | 7 +++++++ src/parser.y | 4 ++-- test/lexer/09.out | 2 +- test/lexer/10.out | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lexer.l b/src/lexer.l index 838f80c..f38a5ba 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -37,6 +37,8 @@ return { return yy::parser::token::TOK_KW_RETURN; } for { return yy::parser::token::TOK_KW_FOR; } in { return yy::parser::token::TOK_KW_IN; } not { return yy::parser::token::TOK_KW_NOT; } +and { return yy::parser::token::TOK_KW_AND; } +or { return yy::parser::token::TOK_KW_OR; } \=\= { return yy::parser::token::TOK_EQ; } \!\= { return yy::parser::token::TOK_NE; } @@ -51,6 +53,11 @@ not { return yy::parser::token::TOK_KW_NOT; } \/ { return yy::parser::token::TOK_DIVIDE; } \% { return yy::parser::token::TOK_MODULO; } \~ { return yy::parser::token::TOK_BIT_NOT; } +\& { return yy::parser::token::TOK_BIT_AND; } +\| { return yy::parser::token::TOK_BIT_OR; } +\^ { return yy::parser::token::TOK_BIT_XOR; } +\<\< { return yy::parser::token::TOK_LSHIFT; } +\>\> { return yy::parser::token::TOK_RSHIFT; } \( { return yy::parser::token::TOK_L_PAREN; } \) { return yy::parser::token::TOK_R_PAREN; } \[ { return yy::parser::token::TOK_L_BRACKET; } diff --git a/src/parser.y b/src/parser.y index f9ca281..37e33f3 100644 --- a/src/parser.y +++ b/src/parser.y @@ -27,8 +27,8 @@ %token IDENTIFIER %token STRING %token NUMBER -%token ASSIGN PLUS MINUS L_PAREN R_PAREN COLON EQ NE LT GT LTE GTE MULTIPLY DIVIDE MODULO L_BRACKET L_BRACE R_BRACKET R_BRACE DOT SEMICOLON COMMA BIT_NOT -%token KW_DEF KW_IF KW_RETURN KW_FOR KW_IN KW_NOT +%token ASSIGN PLUS MINUS L_PAREN R_PAREN COLON EQ NE LT GT LTE GTE MULTIPLY DIVIDE MODULO L_BRACKET L_BRACE R_BRACKET R_BRACE DOT SEMICOLON COMMA BIT_NOT BIT_AND BIT_OR BIT_XOR LSHIFT RSHIFT +%token KW_DEF KW_IF KW_RETURN KW_FOR KW_IN KW_NOT KW_AND KW_OR %token EOF NEWLINE INDENT DEDENT diff --git a/test/lexer/09.out b/test/lexer/09.out index cde813d..d16fc8f 100644 --- a/test/lexer/09.out +++ b/test/lexer/09.out @@ -10,4 +10,4 @@ INDENT IDENTIFIER pass NEWLINE DEDENT -EOF +EOF \ No newline at end of file diff --git a/test/lexer/10.out b/test/lexer/10.out index f6c1508..17d5191 100644 --- a/test/lexer/10.out +++ b/test/lexer/10.out @@ -10,4 +10,4 @@ IDENTIFIER e RSHIFT IDENTIFIER f NEWLINE -EOF +EOF \ No newline at end of file