diff --git a/bin/fypp b/bin/fypp index 85d5662..8ec0c4a 100755 --- a/bin/fypp +++ b/bin/fypp @@ -103,19 +103,19 @@ _LINE_DIRECTIVES_PATTERN = r''' | # line control directive (with optional continuation lines) ^[ \t]*\#:[ \t]*(?P[^ \t\n]+) -(?:[ \t]+(?P.*?(?:&[ \t]*\n[ \t]*&.*?)*))?[ \t]*\n +(?:[ \t]+(?P[^ \t].*?(?:&[ \t]*\n[ \t]*&.*?)*))?[ \t]*\n | # line eval directive (with optional continuation lines) ^[ \t]*\$:[ \t]*(?P.*?(?:&[ \t]*\n(?:[ \t]*&)?.*?)*)[ \t]*\n | # direct call directive (with optional continuation lines) ^[ \t]*@:[ \t]*(?P[^ \t\n]+) -(?:[ \t]+(?P.*?(?:&[ \t]*\n[ \t]*&.*?)*))?[ \t]*\n +(?:[ \t]+(?P[^ \t].*?(?:&[ \t]*\n[ \t]*&.*?)*))?[ \t]*\n ''' _INLINE_DIRECTIVES_PATTERN = r''' # inline control directive -\#\{[ \t]*(?P[^ \t\n]+?)(?:[ \t]+(?P.*?))?[ \t]*\}\# +\#\{[ \t]*(?P[^ \t\n]+?)(?:[ \t]+(?P[^ \t].*?))?[ \t]*\}\# | # inline eval directive \$\{[ \t]*(?P.*?)[ \t]*\}\$ diff --git a/test/test_fypp.py b/test/test_fypp.py index 54a5e50..932d370 100644 --- a/test/test_fypp.py +++ b/test/test_fypp.py @@ -714,6 +714,18 @@ def _linenumbering(nummode): '123\n' ) ), + ('whitespace_but_no_param', + ([], + '#:if True\nOK\n#:endif \n', + 'OK\n' + ) + ), + ('whitespace_but_no_param_inline', + ([], + '#{if True}#OK#{endif }#', + 'OK' + ) + ), ]