@@ -10,7 +10,7 @@ const SELECT_OTHER_TARGETS = choice(
1010
1111/*
1212CASE
13- WHEN REGEX r"print\((.*?)\)" THEN REPLACE r"logger.debug(\1)"
13+ WHEN REGEX r"print\((.*?)\)" THEN SUB r"logger.debug(\1)"
1414 WHEN REGEX r"raise" THEN DELETE
1515 WHEN PREFIX "try" THEN RELINDENT 1
1616 WHEN SUFFIX ";" THEN CONTENT '''xxx''' ELSE CONTENT '''No match'''
@@ -33,7 +33,7 @@ WHEN MATCHES_FILE "*.py" -- File pattern match
3333WHEN LENGTH > <n> -- Line length condition
3434
3535-- Actions (THEN clause):
36- THEN REPLACE r"pattern" -- Replace with regex capture groups
36+ THEN SUB r"pattern" r"replacement " -- Replace with regex capture groups
3737THEN DELETE -- Remove the line
3838THEN CONTENT '''text''' -- Replace with specific content
3939THEN CONTINUE -- Skip this line
@@ -403,7 +403,7 @@ module.exports = grammar({
403403 case_action : $ => choice (
404404 $ . loop_control ,
405405 seq ( field ( 'remove' , 'REMOVE' ) , optional ( $ . loop_control ) ) , // Remove line
406- seq ( 'REPLACE ' , field ( 'replace ' , $ . string ) , optional ( $ . loop_control ) ) , // Replace with regex capture groups
406+ seq ( 'SUB ' , field ( 'pattern' , $ . string ) , field ( 'repl ', $ . string ) , optional ( $ . loop_control ) ) , // Replace with regex capture groups
407407 seq ( 'INDENT' , field ( 'indent' , $ . number ) , optional ( $ . loop_control ) ) , // Change indentation
408408 seq ( choice ( $ . content_literal , $ . content_from_segment ) , optional ( $ . loop_control ) ) // Replace with specific content
409409 ) ,
0 commit comments