From e49a1794e6d93c227e311348cf85b0f4812eeb93 Mon Sep 17 00:00:00 2001 From: Hare Date: Mon, 9 Dec 2024 04:58:26 +0900 Subject: [PATCH] add demo text; made executable for the demo --- resources/test/example_1.sil | 18 ++++++++++++++++++ src/om/tokenizer.rs | 12 +++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 resources/test/example_1.sil diff --git a/resources/test/example_1.sil b/resources/test/example_1.sil new file mode 100644 index 0000000..f7f6f51 --- /dev/null +++ b/resources/test/example_1.sil @@ -0,0 +1,18 @@ +(container [] + (header [] + (title [] |Demo #1|) + ) + (main [] + (std [alt="hoge" ref="./upload/hoge.jpg"]) + (section [lang=md ] |\ + # Hello, world!\ + This is a simple example of SIL.\ + |) + ) + (footer [] + (card [] + (icon [src="/icon.png" alt="Cute icon" on:click="alert('Hello!')"]) + (copyright [] |Copyright here.|) + ) + ) +) \ No newline at end of file diff --git a/src/om/tokenizer.rs b/src/om/tokenizer.rs index 10e8433..52ed73e 100644 --- a/src/om/tokenizer.rs +++ b/src/om/tokenizer.rs @@ -164,7 +164,9 @@ impl Iterator for Tokenizer { return self.latest.take(); } x => { - if !x.is_ascii_alphanumeric() && x != '=' && x != ':' { + if !x.is_ascii_alphanumeric() + && !vec!['=', ':', '"', '\'', '.', '/', '(', ')', '!'].contains(&x) + { panic!("Unexpected character: {}", x); } self.buffer.push(x); @@ -210,6 +212,11 @@ impl Iterator for Tokenizer { } } }, + State::InQuote => match c { + '"' => todo!(), + _ => todo!(), + }, + State::InDoubleQuote => todo!(), } } } @@ -224,6 +231,9 @@ enum State { AfterDefine, Behavior, BehaviorSeparator, + + InQuote, + InDoubleQuote, } #[derive(Debug, Clone, PartialEq, Eq)]