From 603ea89b9830f4b3710a7714d988102f72099185 Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 20 Sep 2019 18:19:29 -0700 Subject: [PATCH] Start adding import keyword --- schala-lang/language/src/parsing.rs | 8 +++++--- schala-lang/language/src/tokenizing.rs | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/schala-lang/language/src/parsing.rs b/schala-lang/language/src/parsing.rs index 24fcc67..a7d164c 100644 --- a/schala-lang/language/src/parsing.rs +++ b/schala-lang/language/src/parsing.rs @@ -13,7 +13,7 @@ //! ```text //! program := (statement delimiter)* EOF //! delimiter := NEWLINE | ";" -//! statement := expression | declaration +//! statement := expression | declaration | import //! block := "{" (statement delimiter)* "}" //! declaration := type_declaration | func_declaration | binding_declaration | impl_declaration //! ``` @@ -141,8 +141,10 @@ //! enumerators := enumerator ("," enumerators)* //! enumerator := identifier "<-" expression | identifier "=" expression //TODO add guards, etc. //! ``` -//! - +//! ## Imports +//! ```text +//! import := 'import' +//! ``` mod test; use std::rc::Rc; diff --git a/schala-lang/language/src/tokenizing.rs b/schala-lang/language/src/tokenizing.rs index f08071d..7939f31 100644 --- a/schala-lang/language/src/tokenizing.rs +++ b/schala-lang/language/src/tokenizing.rs @@ -55,7 +55,7 @@ pub enum Kw { Alias, Type, SelfType, SelfIdent, Interface, Impl, True, False, - Module + Module, Import } lazy_static! { @@ -82,6 +82,7 @@ lazy_static! { "true" => Kw::True, "false" => Kw::False, "module" => Kw::Module, + "import" => Kw::Import, }; }