From c71ed3429cf925d2cdeedd5c0aa7cbe8cda61c5b Mon Sep 17 00:00:00 2001 From: d0cd Date: Wed, 8 Feb 2023 16:20:07 -0800 Subject: [PATCH] Add inline keyword --- compiler/parser/src/tokenizer/lexer.rs | 3 ++- compiler/parser/src/tokenizer/mod.rs | 3 ++- compiler/parser/src/tokenizer/token.rs | 6 +++++- compiler/span/src/symbol.rs | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index ccfea1595f..073ffd8584 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -425,9 +425,10 @@ impl Token { "i64" => Token::I64, "i128" => Token::I128, "if" => Token::If, + "import" => Token::Import, "in" => Token::In, "increment" => Token::Increment, - "import" => Token::Import, + "inline" => Token::Inline, "let" => Token::Let, "leo" => Token::Leo, "mapping" => Token::Mapping, diff --git a/compiler/parser/src/tokenizer/mod.rs b/compiler/parser/src/tokenizer/mod.rs index 89c513935a..4667d01d79 100644 --- a/compiler/parser/src/tokenizer/mod.rs +++ b/compiler/parser/src/tokenizer/mod.rs @@ -103,6 +103,7 @@ mod tests { i8 if in + inline input let mut @@ -167,7 +168,7 @@ mod tests { assert_eq!( output, - r#""test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" test_ident 12345 address assert assert_eq assert_neq async bool const else false field finalize for function group i128 i64 i32 i16 i8 if in input let mut private program public return scalar self string struct test then transition true u128 u64 u32 u16 u8 console ! != && ( ) * ** + , - -> => _ . .. / : ; < <= = == > >= [ ] { { } } || ? @ // test + r#""test" "test{}test" "test{}" "{}test" "test{" "test}" "test{test" "test}test" "te{{}}" test_ident 12345 address assert assert_eq assert_neq async bool const else false field finalize for function group i128 i64 i32 i16 i8 if in inline input let mut private program public return scalar self string struct test then transition true u128 u64 u32 u16 u8 console ! != && ( ) * ** + , - -> => _ . .. / : ; < <= = == > >= [ ] { { } } || ? @ // test /* test */ // "# ); }); diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index 14fe06289b..fc6e648a3b 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -127,6 +127,7 @@ pub enum Token { Import, In, Increment, + Inline, Let, Mapping, Private, @@ -177,6 +178,7 @@ pub const KEYWORD_TOKENS: &[Token] = &[ Token::Import, Token::In, Token::Increment, + Token::Inline, Token::Let, Token::Mapping, Token::Private, @@ -231,9 +233,10 @@ impl Token { Token::I64 => sym::i64, Token::I128 => sym::i128, Token::If => sym::If, + Token::Import => sym::import, Token::In => sym::In, Token::Increment => sym::increment, - Token::Import => sym::import, + Token::Inline => sym::inline, Token::Let => sym::Let, Token::Leo => sym::leo, Token::Mapping => sym::mapping, @@ -361,6 +364,7 @@ impl fmt::Display for Token { Import => write!(f, "import"), In => write!(f, "in"), Increment => write!(f, "increment"), + Inline => write!(f, "inline"), Let => write!(f, "let"), Mapping => write!(f, "mapping"), Private => write!(f, "private"), diff --git a/compiler/span/src/symbol.rs b/compiler/span/src/symbol.rs index 2e44138144..97c91430c6 100644 --- a/compiler/span/src/symbol.rs +++ b/compiler/span/src/symbol.rs @@ -199,6 +199,7 @@ symbols! { In: "in", import, increment, + inline, input, Let: "let", leo,