Skip to content
Snippets Groups Projects
Commit 52f21834 authored by Антон Фетисов's avatar Антон Фетисов
Browse files

refactor: optimize parsing of whitespace

parent 9d69e774
No related branches found
No related tags found
1 merge request!1614Draft: fix: properly parse block & line comments
......@@ -451,9 +451,9 @@ NotFlag = { ^"not" }
// REPEATING_RULES = _{ REPEATING_RULE ~ (WO ~ "," ~ WO ~ REPEATING_RULE)* }
// * Note: Keep in mind that rule like `!{ RULE_1 ~ ("," ~ RULE_2)* }` will consume possible
// whitespaces that follow the `RULE_1` rule.
EOL_COMMENT = @{ "--" ~ (!("\n") ~ ANY)* ~ "\n" }
EOL_COMMENT = @{ "--" ~ (!NEWLINE ~ ANY)* ~ NEWLINE? }
BLOCK_COMMENT = @{ "/*" ~ (!("*/") ~ ANY)* ~ "*/" }
WHITESPACE = _{ " " | "\t" | "\n" | "\r\n" | EOL_COMMENT | BLOCK_COMMENT }
WHITESPACE = _{ " "+ | NEWLINE | "\t" | EOL_COMMENT | BLOCK_COMMENT }
W = _{ WHITESPACE+ }
WO = _{ WHITESPACE* }
EOF = { EOI | ";" }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment