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

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

testlens-app[bot] commented on PR #2848:
URL: https://github.com/apache/groovy/pull/2848#issuecomment-5469689495

   ## ✅ All tests passed ✅
   
   🏷️ Commit: 922c146bf21226d03cea28b144498e35b9e140a9
   ▶️ Tests:  113957 executed
   ⚪️ Checks: 31/31 completed
   
   ---
   _Learn more about TestLens at 
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
   




> Inline the nls parser rule
> --------------------------
>
>                 Key: GROOVY-12322
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12322
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Daniel Sun
>            Priority: Major
>
> h3. Motivation
> {{GroovyParser.g4}} used a shared helper for optional newlines:
> {noformat}
> nls : NL* ;
> sep : (NL | SEMI)+ ;
> {noformat}
> Because {{sep}} can start with {{NL}}, {{FOLLOW(nls)}} contains {{NL}}. The 
> star inside {{nls}} is therefore not LL(1) at the rule level: generated 
> {{nls()}} always uses adaptivePredict, even at call sites where a simple 
> {{while (LA(1)==NL)}} would be correct. The rule also allocates a 
> {{NlsContext}} for every invocation, including the empty match.
> {{classOrInterfaceModifiersOpt}} already inlined {{NL*}} for this reason, 
> with a comment not to put {{nls}} back.
> Same class of prediction-cost reduction as GROOVY-12173, applied to newline 
> handling.
> h3. Changes
> * Delete the {{nls}} rule and write {{NL*}} at every former call site, so 
> each site has its own star decision.
> * Teach {{GroovydocManager}} to read {{NL}} terminals as direct children 
> (comments are lexed as {{NL}}). {{sep}} still wraps mixed {{NL}} / {{SEMI}} 
> sequences.
> h3. Compatibility
> * Language and AST for correct programs are unchanged.
> * Parse-tree shape changes: no {{NlsContext}}; empty matches produce no 
> child. {{NlsContext}} is generated parser API, not a stability covenant.
> * No public API additions.



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

Reply via email to