[ 
https://issues.apache.org/jira/browse/GROOVY-9192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18097427#comment-18097427
 ] 

ASF GitHub Bot commented on GROOVY-9192:
----------------------------------------

codecov-commenter commented on PR #2724:
URL: https://github.com/apache/groovy/pull/2724#issuecomment-5016115318

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2724?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `78.57143%` with `12 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 69.2174%. Comparing base 
([`cb27031`](https://app.codecov.io/gh/apache/groovy/commit/cb27031d8e432f868d54b19ac290d0e61769c78e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`0fb62e4`](https://app.codecov.io/gh/apache/groovy/commit/0fb62e46f9bc68e0e1d8082563a264f3be19a724?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2724?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...antlr4/internal/AbstractFriendlyErrorStrategy.java](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FAbstractFriendlyErrorStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL0Fic3RyYWN0RnJpZW5kbHlFcnJvclN0cmF0ZWd5LmphdmE=)
 | 80.0000% | [4 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...va/org/apache/groovy/parser/antlr4/AstBuilder.java](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2FAstBuilder.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L0FzdEJ1aWxkZXIuamF2YQ==)
 | 80.0000% | [1 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...rser/antlr4/internal/DescriptiveErrorStrategy.java](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FDescriptiveErrorStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL0Rlc2NyaXB0aXZlRXJyb3JTdHJhdGVneS5qYXZh)
 | 62.5000% | [3 Missing :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   | 
[...n/java/org/codehaus/groovy/control/SourceUnit.java](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FSourceUnit.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvU291cmNlVW5pdC5qYXZh)
 | 66.6667% | [0 Missing and 1 partial :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/2724/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2724        +/-   ##
   ==================================================
   + Coverage     69.2109%   69.2174%   +0.0065%     
   - Complexity      34491      34506        +15     
   ==================================================
     Files            1539       1541         +2     
     Lines          129913     129937        +24     
     Branches        23669      23673         +4     
   ==================================================
   + Hits            89914      89939        +25     
   + Misses          31942      31939         -3     
   - Partials         8057       8059         +2     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2724?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...4/internal/RecoveringDescriptiveErrorStrategy.java](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FRecoveringDescriptiveErrorStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL1JlY292ZXJpbmdEZXNjcmlwdGl2ZUVycm9yU3RyYXRlZ3kuamF2YQ==)
 | `100.0000% <100.0000%> (ø)` | |
   | 
[...codehaus/groovy/control/CompilerConfiguration.java](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FCompilerConfiguration.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvQ29tcGlsZXJDb25maWd1cmF0aW9uLmphdmE=)
 | `72.8188% <100.0000%> (+0.1837%)` | :arrow_up: |
   | 
[...n/java/org/codehaus/groovy/control/SourceUnit.java](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FSourceUnit.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvU291cmNlVW5pdC5qYXZh)
 | `66.6667% <66.6667%> (ø)` | |
   | 
[...va/org/apache/groovy/parser/antlr4/AstBuilder.java](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2FAstBuilder.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L0FzdEJ1aWxkZXIuamF2YQ==)
 | `87.2078% <80.0000%> (+0.3163%)` | :arrow_up: |
   | 
[...rser/antlr4/internal/DescriptiveErrorStrategy.java](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FDescriptiveErrorStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL0Rlc2NyaXB0aXZlRXJyb3JTdHJhdGVneS5qYXZh)
 | `66.6667% <62.5000%> (+4.5045%)` | :arrow_up: |
   | 
[...antlr4/internal/AbstractFriendlyErrorStrategy.java](https://app.codecov.io/gh/apache/groovy/pull/2724?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fparser%2Fantlr4%2Finternal%2FAbstractFriendlyErrorStrategy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9wYXJzZXIvYW50bHI0L2ludGVybmFsL0Fic3RyYWN0RnJpZW5kbHlFcnJvclN0cmF0ZWd5LmphdmE=)
 | `80.0000% <80.0000%> (ø)` | |
   
   ... and [5 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2724/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> Implement optional parser error recovery for Parrot parser
> ----------------------------------------------------------
>
>                 Key: GROOVY-9192
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9192
>             Project: Groovy
>          Issue Type: Improvement
>          Components: parser-antlr4
>            Reporter: Daniel Sun
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> h2. Summary
> Add *optional* ANTLR error recovery to the Parrot (antlr4) parser so IDE 
> hosts (e.g. Groovy Eclipse) can collect *multiple* syntax diagnostics in one 
> pass. Default remains fail-fast (current production behaviour).
> h2. Motivation
>  * Groovy Eclipse and similar tools reuse the Parrot parser for editing.
>  * Today recognition failures fail-fast: the first syntax error stops 
> parsing, so the editor often shows only one diagnostic per save/rebuild.
>  * Editors need resynchronization after a fault so further errors in the same 
> file can be reported without a full redesign of the grammar.
> h2. Requirements
>  # *Opt-in only* — recovery is {*}disabled by default{*}; production 
> {{groovyc}} stays fail-fast.
>  # *Enable via configuration* — compiler option {{errorRecovery}} and/or 
> system property {{{}groovy.parser.error.recovery{}}}.
>  # *Multi-error collection* — with recovery on, recognition errors accumulate 
> in {{ErrorCollector}} instead of aborting on the first fatal parse error.
>  # *Preserve friendly diagnostics* — keep delimiter messages such as "Missing 
> ')'", "Missing ']'", "Missing '}'" (via existing 
> {{{}MissingDelimiterDiagnostic{}}}).
>  # *Preserve fail-fast performance path* — SLL to LL two-stage parsing and 
> bail-style cancel remain the default.
>  # *No dual throwable hierarchy* — semantic failures continue to use 
> {{{}GroovySyntaxError{}}}; recovery is owned by the error strategy and error 
> collection path.
> h2. Proposed design
> h3. Configuration
>  * {{CompilerConfiguration.ERROR_RECOVERY}} (value {{{}errorRecovery{}}}) 
> stored in {{getOptimizationOptions()}} (same map as other feature flags such 
> as {{{}groovydoc{}}}).
>  * {{CompilerConfiguration#isErrorRecoveryEnabled()}} — returns true only 
> when the option is explicitly {{{}Boolean.TRUE{}}}.
>  * System property: {{groovy.parser.error.recovery}} (optional bootstrap).
> {code:java}
> CompilerConfiguration config = new CompilerConfiguration();
> config.getOptimizationOptions().put(CompilerConfiguration.ERROR_RECOVERY, 
> Boolean.TRUE);
> // or: -Dgroovy.parser.error.recovery=true
> {code}
> h3. Error strategies
>  * Shared reporting: package-private {{AbstractFriendlyErrorStrategy}} 
> ({{{}MissingDelimiterDiagnostic{}}} plus NVAE/IME messages).
>  * Fail-fast (default): {{DescriptiveErrorStrategy}} — cancel with 
> {{{}ParseCancellationException{}}}; {{sync}} is a no-op (SLL-friendly).
>  * Recovery: {{RecoveringDescriptiveErrorStrategy}} — ANTLR default resync / 
> single-token repair.
>  * Factory: {{{}DescriptiveErrorStrategy.create(CharStream, boolean){}}}.
> h3. AstBuilder / compilation pipeline
>  * Wire strategy from {{{}isErrorRecoveryEnabled(){}}}.
>  * When recovery is on: parse with *LL only* plus error listeners (skip the 
> SLL probe so recovery cannot "succeed" on a degraded tree without re-running 
> LL).
>  * When recovery is on: {{collectSyntaxError}} uses 
> {{ErrorCollector#addErrorAndContinue}} so diagnostics accumulate; fail-fast 
> still uses {{{}addFatalError{}}}.
>  * After CST/AST under recovery, if errors exist, surface 
> {{CompilationFailedException}} so the compile still fails with a full error 
> list.
>  * {{SourceUnit#buildAST}} catches {{CompilationFailedException}} as well as 
> {{{}SyntaxException{}}}, keeps an empty {{ModuleNode}} when needed, so 
> multi-error collection is not aborted mid-stream.
> h3. Host contract
>  * *Source of truth for multi-error UI:* {{ErrorCollector}} (not a partial 
> AST).
>  * Recovery may still produce an incomplete tree; later AST building can add 
> further diagnostics. IDEs should display all collector errors.
> h2. Compatibility
>  * Default off: existing scripts, CLI, and fail-fast tests keep current 
> behaviour and cost model.
>  * Public additive API: {{{}ERROR_RECOVERY{}}}, {{isErrorRecoveryEnabled()}} 
> (no removal of existing APIs).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to