So I am writing a program that tokenizes a C program, and so far I have managed to handle most cases that I have been able to think of with one exception. If I have a variable declared as such:
char a[] = "Hello World";
The line gets separated into the tokens char
a
[
]
=
"Hello
World"
and ;
as I ensure that there are always spaces where necessary before I split the string based on spaces. Is there a way to use regexes to split the string only if it has seen an even (0 is even) amount of quotations marks since the last split so that the tokens are char
a
[
]
=
"Hello World"
;
?