weggli
weggli copied to clipboard
Using regular expressions to match boolean operators.
I am having some trouble getting my query to work the way I intend to.
I want to match:
if (_ X _($atomic.fetch_sub())) {
}
where X is either && or ||, however, I cannot get the query right.
-l -R 'op=$\|\|^' -X '{
if (_ $op; _($atomic.fetch_sub())) { _; }
}'
Doesn't return anything, and
weggli/target/release/weggli -l -R 'op=$\|\|^' -X '{
if (_ $op _($atomic.fetch_sub())) { _; }
}'
Fails with:
Error! Query parsing failed: {
if (_ $op [MISSING ; ] _($atomic.fetch_sub())) { _; }
}
I don't know if this is a bug or if I am not writing the query correctly.
Using variables in place of operators is not supported (and it would be pretty hard to implement as it requires significant changes to the used C and C++ grammars).
I have to think about the best way to implement something like this. For now you need to write and run two queries unfortunately.