lark
lark copied to clipboard
Is it possible to parse parts of the input?
What is your question?
I'm interested in writing a transformer for certain parts of input programs that wouldn't require a full language grammar. So let's say I have the below sample cpp code:
void function(int a, int b) {
// body
}
I want to parse just function signatures and transform them e.g. by adding the '_' suffix to all argument names. I.e. the output for the above input program should be:
void function(int _a, int _b) {
// body (unchanged)
}
How could I possibly achieve this using Lark?