summaryrefslogtreecommitdiff
path: root/cmd2/parsing.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2/parsing.py')
-rw-r--r--cmd2/parsing.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py
index 696904ff..e1d7b76b 100644
--- a/cmd2/parsing.py
+++ b/cmd2/parsing.py
@@ -30,11 +30,13 @@ class MacroArg:
is_escaped = attr.ib(validator=attr.validators.instance_of(bool), type=bool)
# Pattern used to find normal argument
+ # Digits surrounded by exactly 1 brace on a side and 1 or more braces on the opposite side
# Match strings like: {5}, {{{{{4}, {2}}}}}
macro_normal_arg_pattern = re.compile(r'(?<!\{)\{\d+\}|\{\d+\}(?!\})')
- # Pattern used to find escaped arguments (2 or more braces on each side of digit)
- # Match strings like: {{5}}, {{{{{4}}, {{2}}}}}, {{{4}}}
+ # Pattern used to find escaped arguments
+ # Digits surrounded by 2 or more braces on both sides
+ # Match strings like: {{5}}, {{{{{4}}, {{2}}}}}
macro_escaped_arg_pattern = re.compile(r'\{{2}\d+\}{2}')
# Finds a string of digits