https://astgrep.com/playground.html#eyJtb2RlIjoiQ29uZmlnIiwibGFuZyI6InB5dGhvbiIsInF1ZXJ5IjoiY29uc29sZS5sb2coJE1BVENIKSIsInJld3JpdGUiOiJsb2dnZXIubG9nKCRNQVRDSCkiLCJzdHJpY3RuZXNzIjoic21hcnQiLCJzZWxlY3RvciI6IiIsImNvbmZpZyI6Imxhbmd1YWdlOiBweXRob25cbnJ1bGU6XG4gIHBhdHRlcm46ICRBICsgJEJcbi0tLVxubGFuZ3VhZ2U6IHB5dGhvblxucnVsZTpcbiAgcGF0dGVybjogJEEgaWYgJEIgZWxzZSAkQyIsInNvdXJjZSI6ImEgPSAxIFxcXG4gICAgKyAyXG5iID0gMSArIFxcXG4gICAgMlxuYyA9IDEgXFxcbiAgICBpZiAyIGVsc2UgM1xuZCA9IDEgaWYgXFxcbiAgICAyIGVsc2UgM1xuZSA9IDEgaWYgMiBcXFxuICAgIGVsc2UgM1xuZiA9IDEgaWYgMiBlbHNlIFxcXG4gICAgMyJ9
Rules:
language: python rule: pattern: $A + $B --- language: python rule: pattern: $A if $B else $C
Python code:
a = 1 \ + 2 b = 1 + \ 2 c = 1 \ if 2 else 3 d = 1 if \ 2 else 3 e = 1 if 2 \ else 3 f = 1 if 2 else \ 3
Only the second and the last out of 6 expressions are matched.
All expressions should be matched - it shouldn't matter where the line continuation is.
No response
Please read the FAQ for the bug you encountered.
⏯ Playground Link
https://astgrep.com/playground.html#eyJtb2RlIjoiQ29uZmlnIiwibGFuZyI6InB5dGhvbiIsInF1ZXJ5IjoiY29uc29sZS5sb2coJE1BVENIKSIsInJld3JpdGUiOiJsb2dnZXIubG9nKCRNQVRDSCkiLCJzdHJpY3RuZXNzIjoic21hcnQiLCJzZWxlY3RvciI6IiIsImNvbmZpZyI6Imxhbmd1YWdlOiBweXRob25cbnJ1bGU6XG4gIHBhdHRlcm46ICRBICsgJEJcbi0tLVxubGFuZ3VhZ2U6IHB5dGhvblxucnVsZTpcbiAgcGF0dGVybjogJEEgaWYgJEIgZWxzZSAkQyIsInNvdXJjZSI6ImEgPSAxIFxcXG4gICAgKyAyXG5iID0gMSArIFxcXG4gICAgMlxuYyA9IDEgXFxcbiAgICBpZiAyIGVsc2UgM1xuZCA9IDEgaWYgXFxcbiAgICAyIGVsc2UgM1xuZSA9IDEgaWYgMiBcXFxuICAgIGVsc2UgM1xuZiA9IDEgaWYgMiBlbHNlIFxcXG4gICAgMyJ9
💻 Code
Rules:
Python code:
🙁 Actual behavior
Only the second and the last out of 6 expressions are matched.
🙂 Expected behavior
All expressions should be matched - it shouldn't matter where the line continuation is.
Additional information about the issue
No response