From 527cc04ffb9ea627ca678fe8fb07fe9330420eab Mon Sep 17 00:00:00 2001 From: Rory Dudley Date: Thu, 28 Mar 2024 21:01:49 -0600 Subject: Add comments (`#`) to the parser The parser will now interpret the '#' character as a single-line comment string, which works on it's own line, or at the end of an existing line. --- src/poem/read/parse.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/poem/read/parse.rs') diff --git a/src/poem/read/parse.rs b/src/poem/read/parse.rs index c4d59e6..c1dec44 100644 --- a/src/poem/read/parse.rs +++ b/src/poem/read/parse.rs @@ -41,6 +41,21 @@ macro_rules! string { }; } +/// Same as [string!] macro, but look for newline or EOF +#[macro_export] +macro_rules! remark { + ($chars:expr) => { + loop { + match $chars.next() { + None => break, + Some(c) if c == '\n' => break, + Some(_) => {} + } + } + continue; + }; +} + /// Same as the [string!] macro, but don't `continue` #[macro_export] macro_rules! poem { -- cgit v1.2.3