Hi ! I’m currently working on writing a grammar taken from a language specifications to a format supported by the parser I’m using. In this frame, I often (I have a ~1000 lines file typically) have the same highly repetitive tasks to perform:
- Copy a snippet from the manual
- Paste it into my grammar file
- Replace all the lines starting with
"([a-zA-Z-]+) = "
with"\1: "
, sostart-statement = expression
becomesstart-statement: expression
- Replace all the quoted strings with their upper case content:
"Function"
becomesFUNCTION
- Replace all the dash-separated identifiers with underscore-separated identifiers:
start-statement
becomesstart_statement
- And so on, with similar find/replace commands
I’ve thought of using macros, however you can’t use find/replace with them. I can simply use multicursor edition and regexp find/replace by hand, but it is highly repetitive and inefficient.
Can Sublime Text help in improving this kind of tasks ?