Single Line Comments in JavaCC [SOLVED]
To be able to skip single-line comments starting with # in JavaCC, I found the following snippet:
This snippet works well except when the comment is placed on the last line of input file; because EOF cannot be matched with any of "\n" | "\r" | "\r\n". I tried to add <EOF> at the end of the regular expression but JavaCC gave me an error saying that it cannot identify <EOF>.
<"#" (~["\n","\r"])* ("\n" | "\r" | "\r\n")>
Does anyone know how to handle this problem?