This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 3fb84c1ff0eafa7fd5aa0acdf477655bfb66213b
Author: Andy Seaborne <[email protected]>
AuthorDate: Mon Jan 26 14:24:06 2026 +0000

    Fix for SPARQL BNF output
---
 jena-arq/Grammar/jj2bnf | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/jena-arq/Grammar/jj2bnf b/jena-arq/Grammar/jj2bnf
index 0403e6e7dc..6e0299f62a 100755
--- a/jena-arq/Grammar/jj2bnf
+++ b/jena-arq/Grammar/jj2bnf
@@ -53,10 +53,12 @@ $grammar =~ s!^[\n\s]*!\n! ;
 # Merge alts
 $grammar =~ s!\n\s*\|!\ |!g ;
 
+# Tab after |
+$grammar =~ s!\|\t!\| !g ;
+
 $tokens =~ s!//.*!!g ;
 $tokens =~ s!\r!!g ;
 
-
 ## Grammar
 
 @g = split(/\n\s*/, $grammar) ;
@@ -254,13 +256,15 @@ sub fixupRule {
        print STDERR "A:",$body,"\n" if $p ;
 
        ## Fix up for BNODE that uses "|" - put in marker.
-       $body =~ s%'BNODE' \( '\(' Expression '\)' \| \<NIL\> \)%XXX-BNODE-XXX%;
-
-       ## | followed by <NIL>
+       $body =~ s%'BNODE' \( '\(' Expression '\)' \| NIL \)%XXX-BNODE-XXX%;
+       
+       ## Alternative more general removal: NB space-) - matched the BNF parens
+       ##$body =~ s%'BNODE'.*? \)%XXX-BNODE-XXX%;
+       
        $body =~ s%\|\s*%\n                          |   %g ;
        
        ## Replace marker
-       $body =~ s%XXX-BNODE-XXX%'BNODE' \( '(' Expression ')' \| \<NIL\> \)%;
+       $body =~ s%XXX-BNODE-XXX%'BNODE' \( '(' Expression ')' \| NIL \)%;
     }
 
      if ( $head eq "Aggregate" )

Reply via email to