diff options
author | Rory Dudley | 2024-03-28 21:01:49 -0600 |
---|---|---|
committer | Rory Dudley | 2024-03-28 21:01:49 -0600 |
commit | 527cc04ffb9ea627ca678fe8fb07fe9330420eab (patch) | |
tree | 823bdf5d034def38e07c5299a8758ef616bc488a /src/poem/read | |
parent | 9b2fcdb6bb6598786827e9f211df3db09de54567 (diff) | |
download | dwarvish-527cc04ffb9ea627ca678fe8fb07fe9330420eab.tar.gz |
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.
Diffstat (limited to 'src/poem/read')
-rw-r--r-- | src/poem/read/parse.rs | 15 |
1 files changed, 15 insertions, 0 deletions
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 { |