diff --git a/CSharpTranslator/antlr3/src/cs2j/CSharp/PreProcessor.cs b/CSharpTranslator/antlr3/src/cs2j/CSharp/PreProcessor.cs index e5770ae..3503e0b 100644 --- a/CSharpTranslator/antlr3/src/cs2j/CSharp/PreProcessor.cs +++ b/CSharpTranslator/antlr3/src/cs2j/CSharp/PreProcessor.cs @@ -76,6 +76,13 @@ namespace RusticiSoftware.Translator.CSharp return Tokens.Dequeue(); } + public override void ReportError(RecognitionException e) { + // Ignore lexer errors in parts of the file that the preprocessor is omitting + // So, only report error if we are processing at the moment + if (Processing.Peek()) + base.ReportError(e); + } + /// /// These two functions prints a stack of rules for a failure. It sounds really useful but it's mostly noise and didn't /// help me locate errors any quicker (mostly slower). Feel free to comment out.