I'm working on a mini project for my semester for the course Compiler Construction.
I'm designing the Scanner part as of now for Java Language in the Java Language. This scanner will produce tokens which will be later used for the parser...
Most of the work I've done is using the Java Regular Expressions. The problem i'm currently facing is that when i pre process the code to remove inline & multi line comments, it also removes the comments inside string literals if there are any. I'm using the following regex:
String regExPreProcess = "((?s)(/\\*.*?\\*/|/\\*.*))|(//.*)"
Could someone please shed some light to solve the issue. I've tried lookahead & lookbehind functionality as well, but the issue is still persisting.