diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/CSharp/CSharp.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/CSharp/CSharp.stg index 3fe028749..07b9f8b35 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/CSharp/CSharp.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/CSharp/CSharp.stg @@ -720,6 +720,7 @@ if ( \<= 0 || !() ) { = }>ErrorHandler.RecoverInline(this); } else { + ErrorHandler.ReportMatch(this); Consume(); } >> diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg index a058355e4..1d5e80c44 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg @@ -816,7 +816,9 @@ setState(); if ( == 0 || == Token::EOF || !()) { = }>_errHandler->recoverInline(this); -} else { +} +else { + _errHandler->reportMatch(this); consume(); } >> diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg index 8c8154724..7559f01d6 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Go/Go.stg @@ -405,7 +405,7 @@ func (p *) ( } }() - + var _alt int @@ -808,6 +808,7 @@ var _lt = p.GetTokenStream().LT(1) } else { + p.GetErrorHandler().ReportMatch(p) p.Consume() } >> diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg index 295b7ac16..a1b18fc65 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg @@ -643,7 +643,10 @@ setState(); if ( \<= 0 || !() ) { = (Token)}>_errHandler.recoverInline(this); -} else { +} +else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); consume(); } >> diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/JavaScript/JavaScript.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/JavaScript/JavaScript.stg index 3cc2f62eb..501e117a6 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/JavaScript/JavaScript.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/JavaScript/JavaScript.stg @@ -523,6 +523,7 @@ this.state = ; = }>this._errHandler.recoverInline(this); } else { + this._errHandler.reportMatch(this); this.consume(); } >> diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Python2/Python2.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Python2/Python2.stg index ff6c237d1..287f3660a 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Python2/Python2.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Python2/Python2.stg @@ -493,6 +493,7 @@ self.state = if \<= 0 or if not(): = }> self._errHandler.recoverInline(self) else: + self._errHandler.reportMatch(self) self.consume() >> diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Python3/Python3.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Python3/Python3.stg index de8af1975..643cec719 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Python3/Python3.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Python3/Python3.stg @@ -501,6 +501,7 @@ self.state = if \<= 0 or if not(): = }> self._errHandler.recoverInline(self) else: + self._errHandler.reportMatch(self) self.consume() >> diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Swift/Swift.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Swift/Swift.stg index 47846f36a..3fcdf38b5 100755 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Swift/Swift.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Swift/Swift.stg @@ -696,7 +696,9 @@ setState() if ( \<= 0 || !()) { = }>try _errHandler.recoverInline(self) as Token -} else { +} +else { + _errHandler.reportMatch(self) try consume() } >>