It assumes that assert_value is preceded by whitespace. Otherwise it won't match anything.
I'd assume that parsing would be more robustly done by first converting the source code to the AST representation and then just looking for the call to :assert_value and manipulating the AST. But without having much more context, I can't comment further.
Problem
I have code that looks like this:
This throws the error on the context argument as:
But it works as expected when I make sure that
assert_value
call has whitespace up until the margin:Cause
Looks like it's due to this code in
lib/assert_value/parser.ex:60
:It assumes that assert_value is preceded by whitespace. Otherwise it won't match anything.
I'd assume that parsing would be more robustly done by first converting the source code to the AST representation and then just looking for the call to
:assert_value
and manipulating the AST. But without having much more context, I can't comment further.