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


The following commit(s) were added to refs/heads/main by this push:
     new 778d5822a9 GH-2665: SHACL-C HTML generator
778d5822a9 is described below

commit 778d5822a9d6906b02dd51b35e208d1ad68a4913
Author: Andy Seaborne <a...@apache.org>
AuthorDate: Fri Aug 23 10:33:17 2024 +0100

    GH-2665: SHACL-C HTML generator
---
 jena-arq/Grammar/jj2tokens                         |  35 +-
 jena-shacl/shaclc/.gitignore                       |   3 +
 jena-shacl/shaclc/README                           |  14 +
 .../shaclc/{shaclc-parser => grammarExtracts}      |  52 +--
 jena-shacl/shaclc/jj2html                          | 420 +++++++++++++++++++++
 jena-shacl/shaclc/jj2tokens                        |  72 ++++
 jena-shacl/shaclc/shaclc-parser                    |   3 +
 jena-shacl/shaclc/shaclc.jj                        |   7 +-
 jena-shacl/shaclc/shaclc.txt                       | 166 ++++++++
 jena-shacl/shaclc/shaclc2html                      |  12 +
 jena-shacl/shaclc/tokens.txt                       |  93 +++++
 .../reader/parser/ShaclCompactParserJJ.java        |   2 +-
 .../parser/ShaclCompactParserJJConstants.java      |  18 +-
 .../parser/ShaclCompactParserJJTokenManager.java   | 267 ++++++-------
 .../shacl/compact/reader/parser/TokenMgrError.java |   5 +-
 15 files changed, 993 insertions(+), 176 deletions(-)

diff --git a/jena-arq/Grammar/jj2tokens b/jena-arq/Grammar/jj2tokens
old mode 100644
new mode 100755
index 5b9398a2ea..c4a298de22
--- a/jena-arq/Grammar/jj2tokens
+++ b/jena-arq/Grammar/jj2tokens
@@ -2,45 +2,70 @@
 ## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
 
 # Extract tokens (will need more editting)
+# Fixes:
+##  IRIref
+##  Replace " for '
+
+## WARNING: This script will do the bulk work of translation but it is 
imperfect.
+## The output will need editing for us in HTML as W3C BNF
 
 $/ = undef ;
 $_ = <> ;
+
+## JavaCC Comments
 s!//.*!!g ;
 
+## Find TOKEN { } blocks, terminated by } at start of line.
+# A block is \WTOKEN { ... }
 # Not greedy to find end brace
-@t = m/TOKEN\s*(?:\[IGNORE_CASE\])?\s*:\s*\n\{(.*?)\n\}/sg ;
+@t = m/[^_]TOKEN\s*(?:\[IGNORE_CASE\])?\s*:\s*\n\{(.*?)\n\}/sg ;
 
 #{\s*([^{}]*)}/sg ;
 
-# Fixups:
-
+## For each block of TOKENS
 for $t (@t)
 {
     $t =~ s/\r//g ;
 
     #print "\nTEXT:\nT:",$t,":\n" ;
 
-
+    ## Split on | to get individual tokens
+    
     @s = split(/\n\|/,$t) ;
     for $s (@s)
     {
+       ## Trim
+       $s =~ s/^\s+//s;
+       $s =~ s/\s+$//s;
+       
        ($name, $rule) = split(/:/,$s,2) ;
 
+
        ## Leading < and excess whitespace
        $name =~ s/^\s*\<\s*// ;
        $name =~ s/\s+$// ;
+
+       ## Remove # for internal tokens
+       $name =~ s/^#// ;
        
        ## Trailing > and excess whitespace
        $rule =~ s/^\s+// ;
        $rule =~ s/\s*\>\s*$// ;
 
+       ## Flatten around |
        $rule =~ s/\|\s*\n\s*/\|/sg ;
        $rule =~ s/\n\s*\|/\|/sg ;
 
+       ## Replace wrapping " with '
+       ## This may corrupt a token but cover the majority of cases - check 
output
+       $rule =~ s/^"/'/;
+       $rule =~ s/"$/'/;
+
 ##     print "NAME: /",$name , "/\n" ;
 ##     print "-->   ", $rule , "\n" ;
 
-       $spc = ' ' x (10-length($name)) ;
+       ## Format and output
+       $spc = ' ' x (15-length($name)) ;
 
        print "<",$name,">", $spc, " ::= ",$rule,"\n" ;
     }
diff --git a/jena-shacl/shaclc/.gitignore b/jena-shacl/shaclc/.gitignore
new file mode 100644
index 0000000000..dedb2eaa64
--- /dev/null
+++ b/jena-shacl/shaclc/.gitignore
@@ -0,0 +1,3 @@
+## Intermediate files.
+X.html
+Y.html
diff --git a/jena-shacl/shaclc/README b/jena-shacl/shaclc/README
index 6b3f0860f5..6bfda7fb77 100644
--- a/jena-shacl/shaclc/README
+++ b/jena-shacl/shaclc/README
@@ -17,3 +17,17 @@ and cleans up the output files to remove or surpress Java 
warnings.
 
 The generated javacc java is checked into git so you don't need to install
 javacc to build this module unless you want to change the parser.
+
+== To produce BNF HTML
+
+Run the parser generator - shaclc-parser
+
+Produce the tokens.txt file.
+
+The script 'jj2tokens' will do bulk translation but the output needs fixup and
+replacing some rules with better format.
+
+Run shaclc2html
+
+This produces X.html, the HTML table between HTML comments for GRAMMAR and
+Y.html a displayable HTML file with styling.
diff --git a/jena-shacl/shaclc/shaclc-parser b/jena-shacl/shaclc/grammarExtracts
similarity index 53%
copy from jena-shacl/shaclc/shaclc-parser
copy to jena-shacl/shaclc/grammarExtracts
index 3a2a3aaa05..fe19903d33 100755
--- a/jena-shacl/shaclc/shaclc-parser
+++ b/jena-shacl/shaclc/grammarExtracts
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/perl
 ## Licensed to the Apache Software Foundation (ASF) under one
 ## or more contributor license agreements.  See the NOTICE file
 ## distributed with this work for additional information
@@ -15,29 +15,35 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 
-DIR=../src/main/java/org/apache/jena/shacl/compact/reader/parser
-FILE="shaclc.jj"
-CLASS=ShaclCompactParserJJ
+# Grammar HTML to a form of an HTML page suitable for cut&paste as fragments.
 
-(cd "$DIR" ; rm -f *.java )
+$DOC = 1 ;
 
-javacc -OUTPUT_DIRECTORY=$DIR  -JDK_VERSION=1.8 "${FILE}"
+if ( $DOC )
+{
+    print <<'EOF'
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html>
+  <head>
+  <title>SHACL-C Grammar</title>
+  <link rel="stylesheet" type="text/css" 
href="https://www.w3.org/StyleSheets/TR/base.css"; />
+  <link rel="stylesheet" type="text/css" 
href="https://www.w3.org/2001/sw/DataAccess/rq23/local.css"; />
+  </head>
+<body>
+EOF
+}
 
-RC=$?
-[ "$RC" = 0 ] || exit $RC
+while(<>)
+{
+    s/\<a id="([^=\"]*)" name="([^=\"]*)"\>/<a href="#$1">/ ;
+    print ;
+}
 
-echo "---- Fixing Java warnings in TokenMgrError"
-F="$DIR/TokenMgrError.java"
-if [ -e "$F" ]
-then
-    sed -e 's/public class TokenMgrError/\n@SuppressWarnings("all")\npublic 
class TokenMgrError/' < $F > F 
-    mv F $F
-fi
-    
-echo "---- Fixing Java warnings in ${CLASS} ..."
-F="$DIR/${CLASS}.java"
-sed -e 's/@SuppressWarnings("serial")//' \
-    < $F > F
-mv F $F
-
-echo "---- Done"
+if ( $DOC )
+{
+    print <<'EOF'
+</body>
+</html>
+EOF
+}
diff --git a/jena-shacl/shaclc/jj2html b/jena-shacl/shaclc/jj2html
new file mode 100755
index 0000000000..e13ddc14d3
--- /dev/null
+++ b/jena-shacl/shaclc/jj2html
@@ -0,0 +1,420 @@
+#!/usr/bin/perl
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+
+# Grammar into HTML
+# Read in grammar.txt and the tokens.txt file
+#   jj2html grammar.txt tokens.txt
+
+if ( $#ARGV != 1 )
+{
+    print STDERR "Usage: grammar.txt tokens.txt\n" ;
+    exit 1 ;
+}
+
+$/ = undef ;
+# Just table or full page.
+$TABLE = 1 ;
+
+$grammarFile = $ARGV[0] ;
+$tokensFile = $ARGV[1] ;
+
+$grammar = &readFile($grammarFile) ;
+$tokens = &readFile($tokensFile) ;
+
+$grammar =~ s!DOCUMENT START!! ;
+# $grammar =~ s!NON-TERMINALS!! ;
+$grammar =~ s!DOCUMENT END!! ;
+$grammar =~ s!TOKENS.*NON-TERMINALS!!s ;
+
+$grammar =~ s!//.*!!g ;
+$grammar =~ s!\r!!g ;
+
+# remove leading whitespace
+$grammar =~ s!^[\n\s]*!\n! ;
+
+# Merge alts
+$grammar =~ s!\n\s*\|!\ |!g ;
+
+$tokens =~ s!//.*!!g ;
+$tokens =~ s!\r!!g ;
+
+
+## Grammar
+#print "GRAMMAR\n" ;
+
+@g = split(/\n\s*/, $grammar) ;
+
+@rules = () ;
+%ruleMap = () ;
+%tokenMap = () ;
+%inline = () ;
+
+# Grammar rules
+# Direct from "jjdoc -TEXT=true"
+
+for $g (@g) {
+    ($rulename, $rulebody) = split(/:=/,$g) ;
+
+    $rulename =~ s!^\s*!! ;
+    $rulename =~ s!\s*$!! ;
+
+    $rulebody =~ s!^\s*!! ;
+    $rulebody =~ s!\s*$!! ;
+
+    
+    # Remove outer brackets
+#    $rulebody =~ s!^\((.*)\)$!$1! ;
+
+    next if $rulename eq '' ;
+
+    push @rules, $rulename ;
+    warn "Duplicate rule (grammar): $rulename\n" if 
defined($ruleMap{$rulename}) ;
+    $ruleMap{$rulename} = $rulebody ;
+
+##     print "----------\n" ;
+##     print $rulename,"\n" ;
+##     print $rulebody,"\n" ;
+}
+
+
+# Tokens
+# Produced by "jj2tokens"
+# Hand edited to indicate the inlines
+
+$tokens =~ s/\n+/\n/g ;
+$tokens =~ s/^\n// ;
+
+@t = split(/\n(?=\<|\[)/, $tokens) ;
+
+for $t (@t) {
+    ($tokenname,$tokenbody) = split(/::=/, $t) ;
+    $tokenname =~ s!^\s*!! ;
+    $tokenname =~ s!\s*$!! ;
+    $tokenname =~ s/#// ;
+
+    $tokenbody =~ s!^\s*!! ;
+    $tokenbody =~ s!\s*$!! ;
+
+    # Inline?
+    if ( $tokenname =~ /^\[\<\w*\>\]/ ) {
+       warn "Duplicate inline (token): $tokenname\n" if 
defined($inline{$tokenname}) ;
+       $tokenname =~ s/^\[//g ;
+       $tokenname =~ s/\]$//g ;
+       $tokenbody =~ s/"/'/g ; # '" -- But not literal " -- how?
+        $tokenbody =~ s/\<\>\'\{\}/\<\>\"\{\}/ ; # '" IRI fixup
+       $inline{$tokenname} = $tokenbody ;
+
+       #print "INLINE: ",$tokenname," => ",$tokenbody,"\n" ;
+    } else {
+       push @rules, $tokenname ;
+       warn "Duplicate rule (token): $tokenname\n" if 
defined($tokenMap{$tokenname}) ;
+       $ruleMap{$tokenname} = $tokenbody ; 
+    }
+    
+}
+
+# Table
+
+if ( ! $TABLE ) {
+    print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" ;
+    print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n" ;
+    print "    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\n" ;
+    print "\n" ;
+
+    print "<html>\n";
+    print "<head>\n";
+    print "<title>SPARQL Grammar</title>\n" ;
+    print "<style type=\"text/css\">\n" ;
+
+ # .token inline
+ # .ruleHead
+ # .ruleBody
+
+    print <<'EOF' ;
+div.grammarTable table * { border-width: 0 ; }
+div.grammarTable table * tr { border: 1px solid black ; }
+
+.grammar     { text-align: left ; vertical-align: top ; }
+.token       { color: #3f3f5f; }
+.gRuleHead   { font-style: italic ; font-family: monospace ; }
+.gRuleBody   { font-family: monospace ; }
+.gRuleLabel  { font-family: monospace ; }
+EOF
+
+     print "</style>\n" ;
+     print "</head>\n";
+     print "<body>\n";
+
+    print "\n" ;
+} ## End TABLE
+
+$indent = "        ";
+## $indent = "";
+
+print $indent,"<div class=\"grammarTable\">\n" ;
+print $indent,"  <table><tbody>\n" ;
+
+$ruleNum = 0 ;
+
+for $r (@rules) {
+    $DEBUG = 0 ;
+    $ruleNum++ ;
+    $rulename = $r ;
+    
+    $rulebody = $ruleMap{$rulename} ;
+
+##    $DEBUG = 1 if ( $rulename =~ /Prolog/ ) ;
+
+
+    if ( $DEBUG ) {
+       print STDERR "\n" ;
+       print STDERR "Rule: $rulename\n" ; 
+       print STDERR "Body: $rulebody\n" ; 
+    }
+
+    $ruleBodyStr = $rulebody ;
+    # Escape HTML chars before adding markup.
+    $ruleBodyStr = esc($ruleBodyStr) ;
+    
+    # Inlines
+    for $k (keys %inline) {
+       $s = '<span class="token">' . esc($inline{$k}) . '</span>' ;
+       $k = esc($k) ;
+       # Assumes escaped <> round tokens.
+       $k = quotemeta $k ;
+       $ruleBodyStr =~ s/$k/$s/g ;
+    }
+
+    if ( $DEBUG ) {
+       print STDERR "After inlining\n" ;
+       print STDERR $ruleBodyStr,"\n" ; ; 
+    }
+
+    # Add hrefs - issue if one is a substring of another \W helps.
+
+    for $k (keys %ruleMap) {
+       $s = '<a href="#r' . sane($k) . '">' . esc($k) . '</a>' ;
+
+       $k = esc($k) ;
+       $k = quotemeta $k ;
+
+##     if ( $DEBUG )
+##     {
+##       print STDERR "K:$k\n" ;  
+##     }
+
+
+       $ruleBodyStr =~ s/(?=\W)(\s*)$k(\s*)(?=\W)/$1$s$2/g ;
+       $ruleBodyStr =~ s/^$k(\s*)(?=\W)/$s$1/g ;
+       $ruleBodyStr =~ s/(?=\W)(\s*)$k$/$1$s/g ;
+       $ruleBodyStr =~ s/^$k$/$s/g ;
+    }
+    
+    if ( $DEBUG ) {
+       print STDERR "After hrefs\n" ;
+       print STDERR $ruleBodyStr,"\n" ; ; 
+    }
+
+    #exit if $ruleNum > 2 ;
+
+    $ruleId = sane("r".$rulename) ;
+
+    if($rulename eq 'IRIREF') {
+       print $indent,"  </tbody></table>\n" ;
+       print $indent,"</div>\n" ;
+       print $indent,"<p>Productions for terminals:</p>\n" ;
+       print $indent,"<div class=\"grammarTable\">\n" ;
+       print $indent,"  <table><tbody>\n" ;
+    }
+
+    print "\n" ;
+    $indentRule = "              ";
+    ##$indentRule = "";
+    print $indentRule,"<tr style=\"vertical-align: baseline\">\n";
+    
+    $rlabel = '[' . $ruleNum .  ']&nbsp;&nbsp;' ;
+
+    print $indentRule,"  <td><code>",$rlabel,"</code></td>\n" ;
+
+    $rn = $rulename;
+    $rn =~ s!^<!!; 
+    $rn =~ s!>$!!; 
+    
+    print $indentRule,
+       '  <td><code><span class="doc-ref" id="',$ruleId,'">',
+       esc($rn),
+       '</span></code></td>',"\n";
+    
+    print $indentRule,"  <td>&nbsp;&nbsp;::=&nbsp;&nbsp;</td>\n" ;
+    
+    $ruleBodyStr = fixupRule($rulename, $ruleBodyStr) ;
+    print $indentRule,"  <td>",code('gRuleBody',$ruleBodyStr),"</td>\n" ;
+
+    print $indentRule,"</tr>\n" ;
+
+#    $rule{$rulename, $rulebody) ;
+#    print $rulename , "\n" ;
+}
+
+print $indent,"  </tbody></table>\n" ;
+print $indent,"</div>\n" ;
+
+if ( !$TABLE ) {
+    print "\n" ;
+    print "</body>\n" ;
+    print "</html>\n" ;
+}
+
+sub readFile {
+    my $f = $_[0] ;
+    open(F, "$f") || die "$f: $!"; 
+    my $s = <F> ;
+    return $s ;
+}
+
+sub esc {
+    my $s = $_[0] ;
+    $s =~ s/&/&amp;/g ; 
+    $s =~ s/</&lt;/g ; 
+    $s =~ s/>/&gt;/g ; 
+    return $s ;
+}
+
+sub sane {
+   my $a = $_[0] ;
+   $a =~ s/\W//g ;
+   return $a ;
+}
+
+sub code {
+    my $c = $_[0] ;
+    my $t = $_[1] ;
+    return '<code class="' . $c . '">' . $t . '</code>' ;
+}
+
+sub fixupHead {
+    my $head = $_[0] ;
+    # Remove <> around tokens.
+    $head =~ s/&lt;(\w+)&gt;/$1/g ;
+    return $head ;
+}
+
+sub fixupRule {
+    my $head = $_[0] ;
+    my $body = $_[1] ;
+
+    # Remove unnecessary ()
+    $body =~ s/\(\s*([^()| ]*) \)/$1/g ;
+
+    # Remove outer matching () where there are no inner ()
+    $body =~ s/^\(\s+([^\(]*)\s+\)$/$1/ ;
+
+    # ( A )* => A* and for + and ? where A is a linked or spanned object
+    $body =~ s!\(\s+(\<a[^>]*\>[^<>]*\</a\>)\s+\)!$1!g ;
+    $body =~ s!\(\s+(\<span[^>]*\>[^<>]*\</span\>)\s+\)!$1!g ;
+
+    # There aren't any of these
+##    $body =~ s!\(\s+(\S*)\s+\)!$1!g ;
+
+    # Remove <> around tokens.
+    $body =~ s/&lt;(\w+)&gt;/$1/g ;
+
+    # Specials
+    # Split long bodies
+    if ( $head eq "CallExpression" ||
+        $head eq "UnaryExpression" ||
+        $head eq "<NCCHAR1p>" ||
+        $head eq "PatternElement" ||
+        $head eq "BuiltInCall" )
+    {
+       $body =~ s%\|%\<br/\>\|%g ;
+       $body =~ s/^\s+// ;
+       $body = "&nbsp;&nbsp;".$body ;
+    }
+
+     if ( $head eq "Aggregate" )
+     {
+        # Strip outer ()
+        $body =~ s/^\(\s*(.*)\s*\)$/$1/ ;      
+        ## Be careful of nested | in COUNT
+        $body =~ s%(\| \<span class="token")%\<br/\>$1%g ;
+        $body =~ s/^\s+// ;
+        $body = "&nbsp;&nbsp;".$body ;
+     }
+
+
+    if (  $head eq "BuiltInCall" )
+    {
+       # Undo <br/> for BNODE, RAND
+       # <br/>| <a href="#rNIL">NIL</a> )
+       $body =~ s%\<br/\>\| *\<a href="#rNIL"\>NIL\</a\>%\| \<a 
href="#rNIL"\>NIL\</a\>%g ;
+    }
+
+##     if ( $head eq "RelationalExpression" ||
+##      $head eq "AdditiveExpression" ||
+##      $head eq "MultiplicativeExpression" ||
+##      $head eq "ConditionalOrExpression")
+##     {
+##     $body =~ s%\*\(%<br/>\(% ;
+##     }
+
+    # These failed the outer () test because they have nested () in them
+    if (  $head eq "QueryPattern" ||
+          $head eq "OrderCondition" )
+    {
+       # Remove outer ()
+       $body =~ s/^\((.*)\)$/$1/ ;     
+    }
+
+    if (  $head eq "Query" )
+    {
+       $body =~ s! \(!<br/>\(! ;
+       $body =~ s!\) !\)<br/>! ;
+    }
+
+    if (  $head =~ m/(Select|Construct|Describe|Ask)Query/ )
+    {
+       # Put a line break before the DatasetClause
+       # <a href="#rDatasetClause">DatasetClause</a>
+       $c = '<a href="#rDatasetClause">DatasetClause</a>' ;
+       $c = quotemeta $c ;
+       # Expects the dataset clause to be unbracketted
+       $body =~ s!(\(\s*$c)!<br/>$1! ;
+    }
+
+    if ( $head eq "OrderCondition" )
+    {
+       $body =~ s!\)\s*\|\s*\(!\)<br/>\| \(! ;
+       $body = "  ".$body ;
+    }
+
+    #Rules where an outer () is unnecessary.
+    if ( $head eq "GroupCondition" ||
+        $head eq "LimitOffsetClauses" ||
+        $head eq "GraphOrDefault" ||
+        $head eq "ArgList" ||
+        $head eq "ExpressionList" ||
+        $head eq "PathPrimary" ||
+        $head eq "PathMod" ||
+        $head eq "PathPrimary" ||
+        $head eq "PathNegatedPropertySet" || 
+        $head eq "PathOneInPropertySet")
+    {
+       $body =~ s/^\(\s*(.*)\s*\)$/$1/ ;       
+    }
+    return $body ;
+}
diff --git a/jena-shacl/shaclc/jj2tokens b/jena-shacl/shaclc/jj2tokens
new file mode 100755
index 0000000000..c4a298de22
--- /dev/null
+++ b/jena-shacl/shaclc/jj2tokens
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+# Extract tokens (will need more editting)
+# Fixes:
+##  IRIref
+##  Replace " for '
+
+## WARNING: This script will do the bulk work of translation but it is 
imperfect.
+## The output will need editing for us in HTML as W3C BNF
+
+$/ = undef ;
+$_ = <> ;
+
+## JavaCC Comments
+s!//.*!!g ;
+
+## Find TOKEN { } blocks, terminated by } at start of line.
+# A block is \WTOKEN { ... }
+# Not greedy to find end brace
+@t = m/[^_]TOKEN\s*(?:\[IGNORE_CASE\])?\s*:\s*\n\{(.*?)\n\}/sg ;
+
+#{\s*([^{}]*)}/sg ;
+
+## For each block of TOKENS
+for $t (@t)
+{
+    $t =~ s/\r//g ;
+
+    #print "\nTEXT:\nT:",$t,":\n" ;
+
+    ## Split on | to get individual tokens
+    
+    @s = split(/\n\|/,$t) ;
+    for $s (@s)
+    {
+       ## Trim
+       $s =~ s/^\s+//s;
+       $s =~ s/\s+$//s;
+       
+       ($name, $rule) = split(/:/,$s,2) ;
+
+
+       ## Leading < and excess whitespace
+       $name =~ s/^\s*\<\s*// ;
+       $name =~ s/\s+$// ;
+
+       ## Remove # for internal tokens
+       $name =~ s/^#// ;
+       
+       ## Trailing > and excess whitespace
+       $rule =~ s/^\s+// ;
+       $rule =~ s/\s*\>\s*$// ;
+
+       ## Flatten around |
+       $rule =~ s/\|\s*\n\s*/\|/sg ;
+       $rule =~ s/\n\s*\|/\|/sg ;
+
+       ## Replace wrapping " with '
+       ## This may corrupt a token but cover the majority of cases - check 
output
+       $rule =~ s/^"/'/;
+       $rule =~ s/"$/'/;
+
+##     print "NAME: /",$name , "/\n" ;
+##     print "-->   ", $rule , "\n" ;
+
+       ## Format and output
+       $spc = ' ' x (15-length($name)) ;
+
+       print "<",$name,">", $spc, " ::= ",$rule,"\n" ;
+    }
+}
diff --git a/jena-shacl/shaclc/shaclc-parser b/jena-shacl/shaclc/shaclc-parser
index 3a2a3aaa05..3896e7586c 100755
--- a/jena-shacl/shaclc/shaclc-parser
+++ b/jena-shacl/shaclc/shaclc-parser
@@ -40,4 +40,7 @@ sed -e 's/@SuppressWarnings("serial")//' \
     < $F > F
 mv F $F
 
+echo "---- Producing text form"
+jjdoc -TEXT=true -OUTPUT_FILE=${FILE%%.jj}.txt "${FILE}"
+
 echo "---- Done"
diff --git a/jena-shacl/shaclc/shaclc.jj b/jena-shacl/shaclc/shaclc.jj
index 6d76506ac7..e54c28571a 100644
--- a/jena-shacl/shaclc/shaclc.jj
+++ b/jena-shacl/shaclc/shaclc.jj
@@ -505,10 +505,6 @@ SKIP : { " " | "\t" | "\n" | "\r" | "\f" }
 SPECIAL_TOKEN :
 { <SINGLE_LINE_COMMENT: "#" (~["\n","\r"])* ("\n"|"\r"|"\r\n")? > }
 
-TOKEN: { 
-  <BOM:    "\uFEFF">
-}
-
 TOKEN [IGNORE_CASE] :
 {
   // Keywords
@@ -524,7 +520,8 @@ TOKEN [IGNORE_CASE] :
 
 TOKEN:
 {
-  <#HEX             : ["0"-"9"] | ["A"-"F"] | ["a"-"f"] >
+  <BOM              : "\uFEFF">
+| <#HEX             : ["0"-"9"] | ["A"-"F"] | ["a"-"f"] >
 | <PLUS             : "+" >
 | <MINUS            : "-" >
 | <VBAR             : "|" >
diff --git a/jena-shacl/shaclc/shaclc.txt b/jena-shacl/shaclc/shaclc.txt
new file mode 100644
index 0000000000..60de75f6fd
--- /dev/null
+++ b/jena-shacl/shaclc/shaclc.txt
@@ -0,0 +1,166 @@
+
+DOCUMENT START
+TOKENS
+<DEFAULT> SKIP : {
+" "
+| "\t"
+| "\n"
+| "\r"
+| "\f"
+}
+
+<DEFAULT> SPECIAL : {
+<SINGLE_LINE_COMMENT: "#" (~["\n","\r"])* ("\n" | "\r" | "\r\n")?>
+}
+
+<DEFAULT> TOKEN [IGNORE_CASE] : {
+<BASE: "BASE">
+| <IMPORTS: "IMPORTS">
+| <PREFIX: "PREFIX">
+| <SHAPE_CLASS: "shapeClass">
+| <SHAPE: "shape">
+| <TRUE: "true">
+| <FALSE: "false">
+}
+
+<DEFAULT> TOKEN : {
+<BOM: "\ufeff">
+| <#HEX: ["0"-"9"] | ["A"-"F"] | ["a"-"f"]>
+| <PLUS: "+">
+| <MINUS: "-">
+| <VBAR: "|">
+| <AT: "@">
+| <CARAT: "^">
+| <DOT: ".">
+| <BANG: "!">
+| <QMARK: "?">
+| <SLASH: "/">
+| <STAR: "*">
+| <EQUALS: "=">
+| <LPAREN: "(">
+| <RPAREN: ")">
+| <LBRACE: "{">
+| <RBRACE: "}">
+| <LBRACKET: "[">
+| <RBRACKET: "]">
+| <IRIref: "<" (~[">","<","\"","{","}","^","\\","|","`","\u0000"-" "] | 
<UCHAR>)* ">">
+| <PNAME_NS: (<PN_PREFIX>)? ":">
+| <PNAME_LN: <PNAME_NS> <PN_LOCAL>>
+| <ATPNAME_NS: "@" <PNAME_NS>>
+| <ATPNAME_LN: "@" <PNAME_LN>>
+| <#QUOTE_3D: "\"\"\"">
+| <#QUOTE_3S: "\'\'\'">
+| <#ECHAR: "\\" ("t" | "b" | "n" | "r" | "f" | "\\" | "\"" | "\'")>
+| <#UCHAR: <UCHAR4> | <UCHAR8>>
+| <#UCHAR4: "\\" "u" <HEX> <HEX> <HEX> <HEX>>
+| <#UCHAR8: "\\" "U" <HEX> <HEX> <HEX> <HEX> <HEX> <HEX> <HEX> <HEX>>
+| <STRING_LITERAL1: "\'" (~["\'","\\","\n","\r"] | <ECHAR> | <UCHAR>)* "\'">
+| <STRING_LITERAL2: "\"" (~["\"","\\","\n","\r"] | <ECHAR> | <UCHAR>)* "\"">
+| <STRING_LITERAL_LONG1: <QUOTE_3S> (("\'" | "\'\'")? (~["\'","\\"] | <ECHAR> 
| <UCHAR>))* <QUOTE_3S>>
+| <STRING_LITERAL_LONG2: <QUOTE_3D> (("\"" | "\"\"")? (~["\"","\\"] | <ECHAR> 
| <UCHAR>))* <QUOTE_3D>>
+| <#DIGITS: (["0"-"9"])+>
+| <INTEGER: (<PLUS> | <MINUS>)? <DIGITS>>
+| <DECIMAL: (<PLUS> | <MINUS>)? (<DIGITS>)? "." <DIGITS>>
+| <DOUBLE: (<PLUS> | <MINUS>)? ((["0"-"9"])+ "." (["0"-"9"])* <EXPONENT> | "." 
(["0"-"9"])+ <EXPONENT> | (["0"-"9"])+ <EXPONENT>)>
+| <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+>
+| <LANGTAG: <AT> (<A2Z>)+ ("-" (<A2ZN>)+)*>
+| <#A2Z: ["a"-"z","A"-"Z"]>
+| <#A2ZN: ["a"-"z","A"-"Z","0"-"9"]>
+| <#SURROGATE_PAIR: ["\ud800"-"\udbff"] ["\udc00"-"\udfff"]>
+| <#PN_CHARS_BASE: ["A"-"Z"] | ["a"-"z"] | ["\u00c0"-"\u00d6"] | 
["\u00d8"-"\u00f6"] | ["\u00f8"-"\u02ff"] | ["\u0370"-"\u037d"] | 
["\u037f"-"\u1fff"] | ["\u200c"-"\u200d"] | ["\u2070"-"\u218f"] | 
["\u2c00"-"\u2fef"] | ["\u3001"-"\ud7ff"] | ["\uf900"-"\ufffd"] | 
<SURROGATE_PAIR>>
+| <#PN_CHARS_U: <PN_CHARS_BASE> | "_">
+| <#PN_CHARS: <PN_CHARS_U> | "-" | ["0"-"9"] | "\u00b7" | ["\u0300"-"\u036f"] 
| ["\u203f"-"\u2040"]>
+| <#PN_PREFIX: <PN_CHARS_BASE> ((<PN_CHARS> | ".")* <PN_CHARS>)?>
+| <#PN_LOCAL: (<PN_CHARS_U> | ":" | ["0"-"9"] | <PLX>) ((<PN_CHARS> | "." | 
":" | <PLX>)* (<PN_CHARS> | ":" | <PLX>))?>
+| <#VARNAME: (<PN_CHARS_U> | ["0"-"9"]) (<PN_CHARS_U> | ["0"-"9"] | "\u00b7" | 
["\u0300"-"\u036f"] | ["\u203f"-"\u2040"])*>
+| <#PN_LOCAL_ESC: "\\" ("_" | "~" | "." | "-" | "!" | "$" | "&" | "\'" | "(" | 
")" | "*" | "+" | "," | ";" | "=" | "/" | "?" | "#" | "@" | "%")>
+| <#PLX: <PERCENT> | <PN_LOCAL_ESC>>
+| <#PERCENT: "%" <HEX> <HEX>>
+}
+
+// Catch-all tokens.  Must be last.  
+// Any non-whitespace.  Causes a parser exception, rather than a
+// token manager error (which hides the line numbers).
+<DEFAULT> TOKEN : {
+<#UNKNOWN: (~[" ","\t","\n","\r","\f"])+>
+}
+
+NON-TERMINALS
+       Unit    :=      ByteOrderMark shaclDoc <EOF>
+       ByteOrderMark   :=      ( <BOM> )?
+       shaclDoc        :=      ( directive )* ( nodeShape | shapeClass )*
+       directive       :=      ( baseDecl | prefixDecl | importDecl )
+       baseDecl        :=      <BASE> IRIREF
+       prefixDecl      :=      <PREFIX> <PNAME_NS> IRIREF
+       importDecl      :=      <IMPORTS> iri
+       nodeShape       :=      <SHAPE> iri ( targetClass )? nodeShapeBody
+       shapeClass      :=      <SHAPE_CLASS> iri nodeShapeBody
+       targetClass     :=      "->" ( iri )+
+       nodeShapeBody   :=      <LBRACE> ( constraint )* <RBRACE>
+       constraint      :=      ( ( nodeOr )+ | propertyShape | shapeRef ) <DOT>
+       nodeOr  :=      nodeNot ( <VBAR> nodeNot )*
+       nodeNot :=      ( negation )? nodeValue
+       negation        :=      <BANG>
+       nodeValue       :=      nodeParam <EQUALS> ( iriOrLiteral | array )
+       propertyShape   :=      path ( propertyCount | propertyOr )*
+       propertyOr      :=      propertyNot ( <VBAR> propertyNot )*
+       propertyNot     :=      ( negation )? propertyAtom
+       propertyAtom    :=      propertyType
+               |       nodeKind
+               |       shapeRef
+               |       propertyValue
+               |       ( nodeShapeBody )
+       propertyCount   :=      <LBRACKET> propertyMinCount ".." 
propertyMaxCount <RBRACKET>
+       propertyMinCount        :=      <INTEGER>
+       propertyMaxCount        :=      ( <INTEGER> | <STAR> )
+       propertyType    :=      iri
+       nodeKind        :=      ( "BlankNode" | "IRI" | "Literal" | 
"BlankNodeOrIRI" | "BlankNodeOrLiteral" | "IRIOrLiteral" )
+       shapeRef        :=      ( <ATPNAME_LN> | <ATPNAME_NS> | <AT> IRIREF )
+       propertyValue   :=      propertyParam <EQUALS> ( iriOrLiteral | array )
+// Assemble items to build with from hereon down.
+// Return Java objects.
+       nodeParam       :=      ( "targetNode" | "targetObjectsOf" | 
"targetSubjectsOf" | "targetClass" | "deactivated" | "severity" | "message" | 
"class" | "datatype" | "nodeKind" | "minExclusive" | "minInclusive" | 
"maxExclusive" | "maxInclusive" | "minLength" | "maxLength" | "pattern" | 
"flags" | "languageIn" | "equals" | "disjoint" | "closed" | "ignoredProperties" 
| "hasValue" | "in" )
+       propertyParam   :=      ( "deactivated" | "severity" | "message" | 
"class" | "datatype" | "nodeKind" | "minExclusive" | "minInclusive" | 
"maxExclusive" | "maxInclusive" | "minLength" | "maxLength" | "pattern" | 
"flags" | "languageIn" | "uniqueLang" | "equals" | "disjoint" | "lessThan" | 
"lessThanOrEquals" | "qualifiedValueShape" | "qualifiedMinCount" | 
"qualifiedMaxCount" | "qualifiedValueShapesDisjoint" | "closed" | 
"ignoredProperties" | "hasValue" | "in" | "group" | "order" | "name" | "descr 
[...]
+// Paths - subset of SPARQL Paths - no negation, no path property sets.
+       PathUnit        :=      ByteOrderMark path <EOF>
+// Weakest outermost
+       path    :=      pathAlternative
+       pathAlternative :=      pathSequence ( <VBAR> pathSequence )*
+       pathSequence    :=      pathEltOrInverse ( <SLASH> pathEltOrInverse )*
+// Path unit element, no inverse
+       pathElt :=      pathPrimary ( pathMod )?
+// Path unit element, including inverse.
+       pathEltOrInverse        :=      ( pathElt | <CARAT> pathElt )
+       pathMod :=      ( <QMARK> | <STAR> | <PLUS> )
+       pathPrimary     :=      ( iri | <LPAREN> path <RPAREN> )
+// To preserve types, use ( iriOrLiteral() | array() ) directly
+// void iriOrLiteralOrArray() : {}
+// {
+//   (
+//     { Node n = null; }
+//     n = iriOrLiteral()
+//     { iriOrLiteralOrArray(n); }
+//   |
+//     { List<Node> x = null; }
+//     x = array()
+//     { iriOrLiteralOrArray(x); }
+//   )
+// }
+       array   :=      <LBRACKET> ( iriOrLiteral )* <RBRACKET>
+// Term generation
+       iriOrLiteral    :=      ( iri | literal )
+       literal :=      ( rdfLiteral | numericLiteral | booleanLiteral )
+       booleanLiteral  :=      <TRUE>
+               |       <FALSE>
+       numericLiteral  :=      <INTEGER>
+               |       <DECIMAL>
+               |       <DOUBLE>
+       rdfLiteral      :=      string ( ( <LANGTAG> ) | ( "^^" datatype ) )?
+       datatype        :=      iri
+       string  :=      ( <STRING_LITERAL1> | <STRING_LITERAL2> | 
<STRING_LITERAL_LONG1> | <STRING_LITERAL_LONG2> )
+       iri     :=      IRIREF
+               |       PrefixedName
+       PrefixedName    :=      ( <PNAME_LN> | <PNAME_NS> )
+       IRIREF  :=      <IRIref>
+
+DOCUMENT END
diff --git a/jena-shacl/shaclc/shaclc2html b/jena-shacl/shaclc/shaclc2html
new file mode 100755
index 0000000000..a9ccd0e251
--- /dev/null
+++ b/jena-shacl/shaclc/shaclc2html
@@ -0,0 +1,12 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+echo "Grammar to X.html"
+echo "Fragments file to Y.html"
+
+(
+    echo "        <!-- GRAMMAR -->"
+    jj2html 'shaclc.txt' 'tokens.txt'
+    echo "        <!-- GRAMMAR -->"
+) > X.html
+
+grammarExtracts < X.html > Y.html
diff --git a/jena-shacl/shaclc/tokens.txt b/jena-shacl/shaclc/tokens.txt
new file mode 100644
index 0000000000..e50e04d324
--- /dev/null
+++ b/jena-shacl/shaclc/tokens.txt
@@ -0,0 +1,93 @@
+// Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+//Tokens in BNF
+// [] means will be inlined.
+// The presense of a token in the file does not mean it is actually used.
+
+[<BASE>]          ::= 'BASE'
+[<IMPORTS>]       ::= 'IMPORTS'
+[<PREFIX>]        ::= 'PREFIX'
+[<SHAPE_CLASS>]   ::= 'shapeClass'
+[<SHAPE>]         ::= 'shape'
+[<TRUE>]          ::= 'true'
+[<FALSE>]         ::= 'false'
+
+[<BOM>]           ::= '\uFEFF'
+<HEX>             ::= [0-9] | [A-F] | [a-f]
+
+[<PLUS>]          ::= '+'
+[<MINUS>]         ::= '-'
+[<VBAR>]          ::= '|'
+[<AT>]            ::= '@'
+[<CARAT>]         ::= '^'
+[<DOT>]           ::= '.'
+[<BANG>]          ::= '!'
+[<QMARK>]         ::= '?'
+[<SLASH>]         ::= '/'
+[<STAR>]          ::= '*'
+[<EQUALS>]        ::= '='
+[<LPAREN>]        ::= '('
+[<RPAREN>]        ::= ')'
+[<LBRACE>]        ::= '{'
+[<RBRACE>]        ::= '}'
+[<LBRACKET>]      ::= '['
+[<RBRACKET>]      ::= ']'
+
+## <IRIref>          ::= '<"
+##                   (~[ ">","<", "\"", "{", "}", "^", "\\", "|", 
"`","\u0000"-"\u0020"]| <UCHAR>
+##                   )*
+##                  ">'
+
+[<IRIref>]        ::= '<' ([^<>"{}|^`\]-[#x00-#x20])* '>'
+
+<PNAME_NS>        ::= (<PN_PREFIX>)? ":'
+<PNAME_LN>        ::= <PNAME_NS> <PN_LOCAL>
+<ATPNAME_NS>      ::= '@"<PNAME_NS>
+<ATPNAME_LN>      ::= '@"<PNAME_LN>
+<QUOTE_3D>        ::= '"""'
+<QUOTE_3S>        ::= "'''"
+
+<ECHAR>             ::= '\' [tbnrf"']
+
+<UCHAR>             ::= <UCHAR4> | <UCHAR8>
+<UCHAR4>            ::= '\u' <HEX> <HEX> <HEX> <HEX>
+<UCHAR8>            ::= '\U" <HEX> <HEX> <HEX> <HEX> <HEX> <HEX> <HEX> <HEX>
+
+<STRING_LITERAL1>   ::= "'" ( ([^#x27#x5C#xA#xD]) | <ECHAR> )* "'"
+<STRING_LITERAL2>   ::= '"' ( ([^#x22#x5C#xA#xD]) | <ECHAR> )* '"'
+
+<STRING_LITERAL_LONG1> ::= "'''" ( ( "'" | "''" )? ( [^'\] | <ECHAR> ) )* "'''"
+<STRING_LITERAL_LONG2> ::= '"""' ( ( '"' | '""' )? ( [^"\] | <ECHAR> ) )* '"""'
+
+// <DIGITS>         ::= ['0'-'9'])+[0-9]+
+<INTEGER>           ::= (<PLUS>|<MINUS>)? [0-9]+
+<DECIMAL>           ::= (<PLUS>|<MINUS>)? ( [0-9]* '.' [0-9]+ )
+<DOUBLE>            ::= (<PLUS>|<MINUS>)? [0-9]+ '.' [0-9]* <EXPONENT> | '.' 
([0-9])+ <EXPONENT> | ([0-9])+ <EXPONENT>
+
+<EXPONENT>          ::= [eE] [+-]? [0-9]+
+<LANGTAG>           ::= '@' [a-zA-Z]+ ('-' [a-zA-Z0-9]+)*
+// <A2Z>            ::= ["a"-"z","A"-"Z"]
+// <A2ZN>           ::= ["a"-"z","A"-"Z","0"-"9"]
+
+<PN_CHARS_BASE>     ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | 
[#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | 
[#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | 
[#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
+
+<PN_CHARS_U>        ::= <PN_CHARS_BASE> | '_'
+
+<VARNAME>           ::=  ( <PN_CHARS_U>  | [0-9] ) ( <PN_CHARS_U> | [0-9] | 
#x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )*
+
+<PN_CHARS>          ::=  <PN_CHARS_U> | '-' | [0-9] | #x00B7 | [#x0300-#x036F] 
| [#x203F-#x2040]
+
+<PN_PREFIX>         ::= <PN_CHARS_BASE> ((<PN_CHARS>|'.')* <PN_CHARS>)?
+
+<PN_LOCAL>          ::= (<PN_CHARS_U> | ':' | [0-9] | <PLX> ) ((<PN_CHARS> | 
'.' | ':' | <PLX>)* (<PN_CHARS> | ':' | <PLX>) )?
+
+<PLX>               ::= <PERCENT> | <PN_LOCAL_ESC>
+
+
+<VARNAME>        ::= ( <PN_CHARS_U> | ["0"-"9"] )
+                     ( <PN_CHARS_U> | ["0"-"9"] | "\u00B7" 
|["\u0300"-"\u036F"] | ["\u203F"-"\u2040"] )*
+<PN_LOCAL_ESC>    ::= '\' ( '_' | '~' | '.' | '-' | '!' | '$' | '&' | "'" | 
'(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%' )
+
+<PLX>            ::= <PERCENT> | <PN_LOCAL_ESC>
+
+<PERCENT>        ::= '%' <HEX> <HEX>
diff --git 
a/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJ.java
 
b/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJ.java
index 6a601027a1..336c1c817d 100644
--- 
a/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJ.java
+++ 
b/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJ.java
@@ -1476,7 +1476,7 @@ lex = unescapeStr(lex,  t.beginLine, t.beginColumn) ;
           jj_la1_0 = new int[] 
{0x0,0x0,0x0,0x0,0x0,0x2,0x0,0xfffffe00,0xfffffe00,0xfffffe00,0x0,0x0,0x0,0xffffe1f8,0xffffe1f8,0x0,0x0,0xffffe1f8,0x0,0x1f8,0x0,0x0,0xfffffe00,0xffffe000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
        }
        private static void jj_la1_init_1() {
-          jj_la1_1 = new int[] 
{0x200000,0x1c00000,0x6000000,0x6000000,0x1c00000,0x0,0x0,0x3,0x3,0x3,0x0,0x0,0x18000000,0x3fff,0x3fff,0x0,0x0,0x3fff,0x0,0x0,0x0,0x18000000,0x3,0x3fff,0x0,0x0,0x40000000,0x0,0x40000000,0x0,0x18000000,0x18000000,0x18000000,0x18000000,0x0,0x4000,0x4000,0x0,0x0,0x0,};
+          jj_la1_1 = new int[] 
{0x10000000,0xe00000,0x3000000,0x3000000,0xe00000,0x0,0x0,0x3,0x3,0x3,0x0,0x0,0xc000000,0x3fff,0x3fff,0x0,0x0,0x3fff,0x0,0x0,0x0,0xc000000,0x3,0x3fff,0x0,0x0,0x40000000,0x0,0x40000000,0x0,0xc000000,0xc000000,0xc000000,0xc000000,0x0,0x4000,0x4000,0x0,0x0,0x0,};
        }
        private static void jj_la1_init_2() {
           jj_la1_2 = new int[] 
{0x0,0x0,0x0,0x0,0x0,0x0,0x38000,0xf8216,0x10,0xf8216,0x1,0x10,0xbc03a000,0xfa812,0xfa812,0x1,0x10,0xf8802,0x80000080,0x0,0xc0002,0xbc03a000,0x0,0x0,0x1,0x40,0xa0,0x38204,0xa0,0x38200,0xbc038000,0xbc038000,0xbc000000,0x0,0x80000000,0x0,0x0,0x3c000000,0x38000,0x30000,};
diff --git 
a/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJConstants.java
 
b/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJConstants.java
index 08e04b6cbe..4bc35fb02d 100644
--- 
a/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJConstants.java
+++ 
b/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJConstants.java
@@ -31,21 +31,21 @@ public interface ShaclCompactParserJJConstants {
   /** RegularExpression Id. */
   int SINGLE_LINE_COMMENT = 52;
   /** RegularExpression Id. */
-  int BOM = 53;
+  int BASE = 53;
   /** RegularExpression Id. */
-  int BASE = 54;
+  int IMPORTS = 54;
   /** RegularExpression Id. */
-  int IMPORTS = 55;
+  int PREFIX = 55;
   /** RegularExpression Id. */
-  int PREFIX = 56;
+  int SHAPE_CLASS = 56;
   /** RegularExpression Id. */
-  int SHAPE_CLASS = 57;
+  int SHAPE = 57;
   /** RegularExpression Id. */
-  int SHAPE = 58;
+  int TRUE = 58;
   /** RegularExpression Id. */
-  int TRUE = 59;
+  int FALSE = 59;
   /** RegularExpression Id. */
-  int FALSE = 60;
+  int BOM = 60;
   /** RegularExpression Id. */
   int HEX = 61;
   /** RegularExpression Id. */
@@ -209,7 +209,6 @@ public interface ShaclCompactParserJJConstants {
     "\"\\r\"",
     "\"\\f\"",
     "<SINGLE_LINE_COMMENT>",
-    "\"\\ufeff\"",
     "\"BASE\"",
     "\"IMPORTS\"",
     "\"PREFIX\"",
@@ -217,6 +216,7 @@ public interface ShaclCompactParserJJConstants {
     "\"shape\"",
     "\"true\"",
     "\"false\"",
+    "\"\\ufeff\"",
     "<HEX>",
     "\"+\"",
     "\"-\"",
diff --git 
a/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJTokenManager.java
 
b/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJTokenManager.java
index 4190d0a479..08d441f305 100644
--- 
a/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJTokenManager.java
+++ 
b/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/ShaclCompactParserJJTokenManager.java
@@ -19,8 +19,15 @@
  */
 
 package org.apache.jena.shacl.compact.reader.parser;
+import java.util.List;
+import java.util.ArrayList;
+import org.apache.jena.graph.*;
+import org.apache.jena.sparql.path.*;
+import org.apache.jena.shacl.compact.reader.*;
+import static org.apache.jena.riot.lang.extra.LangParserLib.*;
 
 /** Token Manager. */
+@SuppressWarnings ("unused")
 public class ShaclCompactParserJJTokenManager implements 
ShaclCompactParserJJConstants {
 
   /** Debug output. */
@@ -85,19 +92,19 @@ private int jjMoveStringLiteralDfa0_0(){
          jjmatchedKind = 65;
          return jjMoveNfa_0(0, 0);
       case 66:
-         return jjMoveStringLiteralDfa1_0(0x400000000000c8L);
+         return jjMoveStringLiteralDfa1_0(0x200000000000c8L);
       case 70:
-         return jjMoveStringLiteralDfa1_0(0x1000000000000000L);
+         return jjMoveStringLiteralDfa1_0(0x800000000000000L);
       case 73:
-         return jjMoveStringLiteralDfa1_0(0x80000000000110L);
+         return jjMoveStringLiteralDfa1_0(0x40000000000110L);
       case 76:
          return jjMoveStringLiteralDfa1_0(0x20L);
       case 80:
-         return jjMoveStringLiteralDfa1_0(0x100000000000000L);
+         return jjMoveStringLiteralDfa1_0(0x80000000000000L);
       case 83:
-         return jjMoveStringLiteralDfa1_0(0x600000000000000L);
+         return jjMoveStringLiteralDfa1_0(0x300000000000000L);
       case 84:
-         return jjMoveStringLiteralDfa1_0(0x800000000000000L);
+         return jjMoveStringLiteralDfa1_0(0x400000000000000L);
       case 91:
          jjmatchedKind = 77;
          return jjMoveNfa_0(0, 0);
@@ -108,7 +115,7 @@ private int jjMoveStringLiteralDfa0_0(){
          jjmatchedKind = 66;
          return jjMoveStringLiteralDfa1_0(0x400000000000L);
       case 98:
-         return jjMoveStringLiteralDfa1_0(0x40000000000000L);
+         return jjMoveStringLiteralDfa1_0(0x20000000000000L);
       case 99:
          return jjMoveStringLiteralDfa1_0(0x40010000L);
       case 100:
@@ -116,13 +123,13 @@ private int jjMoveStringLiteralDfa0_0(){
       case 101:
          return jjMoveStringLiteralDfa1_0(0x10000000L);
       case 102:
-         return jjMoveStringLiteralDfa1_0(0x1000000004000000L);
+         return jjMoveStringLiteralDfa1_0(0x800000004000000L);
       case 103:
          return jjMoveStringLiteralDfa1_0(0x20000000000L);
       case 104:
          return jjMoveStringLiteralDfa1_0(0x100000000L);
       case 105:
-         return jjMoveStringLiteralDfa1_0(0x80000280000000L);
+         return jjMoveStringLiteralDfa1_0(0x40000280000000L);
       case 108:
          return jjMoveStringLiteralDfa1_0(0x1808000000L);
       case 109:
@@ -132,13 +139,13 @@ private int jjMoveStringLiteralDfa0_0(){
       case 111:
          return jjMoveStringLiteralDfa1_0(0x40000000000L);
       case 112:
-         return jjMoveStringLiteralDfa1_0(0x100000002000000L);
+         return jjMoveStringLiteralDfa1_0(0x80000002000000L);
       case 113:
          return jjMoveStringLiteralDfa1_0(0x1e000000000L);
       case 115:
-         return jjMoveStringLiteralDfa1_0(0x600000000004000L);
+         return jjMoveStringLiteralDfa1_0(0x300000000004000L);
       case 116:
-         return jjMoveStringLiteralDfa1_0(0x800000000001e00L);
+         return jjMoveStringLiteralDfa1_0(0x400000000001e00L);
       case 117:
          return jjMoveStringLiteralDfa1_0(0x400000000L);
       case 123:
@@ -151,7 +158,7 @@ private int jjMoveStringLiteralDfa0_0(){
          jjmatchedKind = 76;
          return jjMoveNfa_0(0, 0);
       case 65279:
-         jjmatchedKind = 53;
+         jjmatchedKind = 60;
          return jjMoveNfa_0(0, 0);
       default :
          return jjMoveNfa_0(0, 0);
@@ -179,13 +186,13 @@ private int jjMoveStringLiteralDfa1_0(long active0){
          }
          break;
       case 65:
-         return jjMoveStringLiteralDfa2_0(active0, 0x1040000000000000L);
+         return jjMoveStringLiteralDfa2_0(active0, 0x820000000000000L);
       case 72:
-         return jjMoveStringLiteralDfa2_0(active0, 0x600000000000000L);
+         return jjMoveStringLiteralDfa2_0(active0, 0x300000000000000L);
       case 77:
-         return jjMoveStringLiteralDfa2_0(active0, 0x80000000000000L);
+         return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L);
       case 82:
-         return jjMoveStringLiteralDfa2_0(active0, 0x900000000000110L);
+         return jjMoveStringLiteralDfa2_0(active0, 0x480000000000110L);
       case 94:
          if ((active0 & 0x400000000000L) != 0L)
          {
@@ -194,19 +201,19 @@ private int jjMoveStringLiteralDfa1_0(long active0){
          }
          break;
       case 97:
-         return jjMoveStringLiteralDfa2_0(active0, 0x104008010b621e00L);
+         return jjMoveStringLiteralDfa2_0(active0, 0x82008010b621e00L);
       case 101:
          return jjMoveStringLiteralDfa2_0(active0, 0x30180000e000L);
       case 103:
          return jjMoveStringLiteralDfa2_0(active0, 0x80000000L);
       case 104:
-         return jjMoveStringLiteralDfa2_0(active0, 0x600000000000000L);
+         return jjMoveStringLiteralDfa2_0(active0, 0x300000000000000L);
       case 105:
          return jjMoveStringLiteralDfa2_0(active0, 0x20980020L);
       case 108:
          return jjMoveStringLiteralDfa2_0(active0, 0x440100c8L);
       case 109:
-         return jjMoveStringLiteralDfa2_0(active0, 0x80000000000000L);
+         return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L);
       case 110:
          if ((active0 & 0x200000000L) != 0L)
          {
@@ -219,7 +226,7 @@ private int jjMoveStringLiteralDfa1_0(long active0){
       case 113:
          return jjMoveStringLiteralDfa2_0(active0, 0x10000000L);
       case 114:
-         return jjMoveStringLiteralDfa2_0(active0, 0x900060000000000L);
+         return jjMoveStringLiteralDfa2_0(active0, 0x480060000000000L);
       case 117:
          return jjMoveStringLiteralDfa2_0(active0, 0x1e000000000L);
       default :
@@ -237,9 +244,9 @@ private int jjMoveStringLiteralDfa2_0(long old0, long 
active0){
    switch(curChar)
    {
       case 65:
-         return jjMoveStringLiteralDfa3_0(active0, 0x600000000000000L);
+         return jjMoveStringLiteralDfa3_0(active0, 0x300000000000000L);
       case 69:
-         return jjMoveStringLiteralDfa3_0(active0, 0x100000000000000L);
+         return jjMoveStringLiteralDfa3_0(active0, 0x80000000000000L);
       case 73:
          if ((active0 & 0x10L) != 0L)
          {
@@ -248,25 +255,25 @@ private int jjMoveStringLiteralDfa2_0(long old0, long 
active0){
          }
          return jjMoveStringLiteralDfa3_0(active0, 0x100L);
       case 76:
-         return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L);
+         return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L);
       case 80:
-         return jjMoveStringLiteralDfa3_0(active0, 0x80000000000000L);
-      case 83:
          return jjMoveStringLiteralDfa3_0(active0, 0x40000000000000L);
+      case 83:
+         return jjMoveStringLiteralDfa3_0(active0, 0x20000000000000L);
       case 85:
-         return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L);
+         return jjMoveStringLiteralDfa3_0(active0, 0x400000000000000L);
       case 97:
-         return jjMoveStringLiteralDfa3_0(active0, 0x60001e0040120c8L);
+         return jjMoveStringLiteralDfa3_0(active0, 0x30001e0040120c8L);
       case 100:
          return jjMoveStringLiteralDfa3_0(active0, 0x40000040000L);
       case 101:
-         return jjMoveStringLiteralDfa3_0(active0, 0x100000000000000L);
+         return jjMoveStringLiteralDfa3_0(active0, 0x80000000000000L);
       case 102:
          return jjMoveStringLiteralDfa3_0(active0, 0x200000000000L);
       case 105:
          return jjMoveStringLiteralDfa3_0(active0, 0x400000000L);
       case 108:
-         return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L);
+         return jjMoveStringLiteralDfa3_0(active0, 0x800000000000000L);
       case 109:
          return jjMoveStringLiteralDfa3_0(active0, 0x80000000000L);
       case 110:
@@ -274,15 +281,15 @@ private int jjMoveStringLiteralDfa2_0(long old0, long 
active0){
       case 111:
          return jjMoveStringLiteralDfa3_0(active0, 0x20040000000L);
       case 112:
-         return jjMoveStringLiteralDfa3_0(active0, 0x80000000000000L);
+         return jjMoveStringLiteralDfa3_0(active0, 0x40000000000000L);
       case 114:
          return jjMoveStringLiteralDfa3_0(active0, 0x1e00L);
       case 115:
-         return jjMoveStringLiteralDfa3_0(active0, 0x40101920008000L);
+         return jjMoveStringLiteralDfa3_0(active0, 0x20101920008000L);
       case 116:
          return jjMoveStringLiteralDfa3_0(active0, 0x2020020L);
       case 117:
-         return jjMoveStringLiteralDfa3_0(active0, 0x800000010000000L);
+         return jjMoveStringLiteralDfa3_0(active0, 0x400000010000000L);
       case 118:
          return jjMoveStringLiteralDfa3_0(active0, 0x4000L);
       case 120:
@@ -302,29 +309,29 @@ private int jjMoveStringLiteralDfa3_0(long old0, long 
active0){
    switch(curChar)
    {
       case 69:
-         if ((active0 & 0x40000000000000L) != 0L)
+         if ((active0 & 0x20000000000000L) != 0L)
          {
-            jjmatchedKind = 54;
+            jjmatchedKind = 53;
             jjmatchedPos = 3;
          }
-         else if ((active0 & 0x800000000000000L) != 0L)
+         else if ((active0 & 0x400000000000000L) != 0L)
          {
-            jjmatchedKind = 59;
+            jjmatchedKind = 58;
             jjmatchedPos = 3;
          }
          return jjMoveStringLiteralDfa4_0(active0, 0x280000L);
       case 70:
-         return jjMoveStringLiteralDfa4_0(active0, 0x100000000000000L);
+         return jjMoveStringLiteralDfa4_0(active0, 0x80000000000000L);
       case 73:
          return jjMoveStringLiteralDfa4_0(active0, 0x500000L);
       case 76:
          return jjMoveStringLiteralDfa4_0(active0, 0x1800000L);
       case 79:
-         return jjMoveStringLiteralDfa4_0(active0, 0x80000000000100L);
+         return jjMoveStringLiteralDfa4_0(active0, 0x40000000000100L);
       case 80:
-         return jjMoveStringLiteralDfa4_0(active0, 0x600000000000000L);
+         return jjMoveStringLiteralDfa4_0(active0, 0x300000000000000L);
       case 83:
-         return jjMoveStringLiteralDfa4_0(active0, 0x1000000000000000L);
+         return jjMoveStringLiteralDfa4_0(active0, 0x800000000000000L);
       case 86:
          return jjMoveStringLiteralDfa4_0(active0, 0x100000000L);
       case 97:
@@ -337,19 +344,19 @@ private int jjMoveStringLiteralDfa3_0(long old0, long 
active0){
             jjmatchedKind = 43;
             jjmatchedPos = 3;
          }
-         else if ((active0 & 0x40000000000000L) != 0L)
+         else if ((active0 & 0x20000000000000L) != 0L)
          {
-            jjmatchedKind = 54;
+            jjmatchedKind = 53;
             jjmatchedPos = 3;
          }
-         else if ((active0 & 0x800000000000000L) != 0L)
+         else if ((active0 & 0x400000000000000L) != 0L)
          {
-            jjmatchedKind = 59;
+            jjmatchedKind = 58;
             jjmatchedPos = 3;
          }
          return jjMoveStringLiteralDfa4_0(active0, 0x40000044020L);
       case 102:
-         return jjMoveStringLiteralDfa4_0(active0, 0x100000000000000L);
+         return jjMoveStringLiteralDfa4_0(active0, 0x80000000000000L);
       case 103:
          return jjMoveStringLiteralDfa4_0(active0, 0xc001e00L);
       case 106:
@@ -359,13 +366,13 @@ private int jjMoveStringLiteralDfa3_0(long old0, long 
active0){
       case 110:
          return jjMoveStringLiteralDfa4_0(active0, 0xc8L);
       case 111:
-         return jjMoveStringLiteralDfa4_0(active0, 0x80000080000000L);
+         return jjMoveStringLiteralDfa4_0(active0, 0x40000080000000L);
       case 112:
-         return jjMoveStringLiteralDfa4_0(active0, 0x600000000000000L);
+         return jjMoveStringLiteralDfa4_0(active0, 0x300000000000000L);
       case 113:
          return jjMoveStringLiteralDfa4_0(active0, 0x400000000L);
       case 115:
-         return jjMoveStringLiteralDfa4_0(active0, 0x1000001840018000L);
+         return jjMoveStringLiteralDfa4_0(active0, 0x800001840018000L);
       case 116:
          return jjMoveStringLiteralDfa4_0(active0, 0x2000000L);
       case 117:
@@ -385,41 +392,41 @@ private int jjMoveStringLiteralDfa4_0(long old0, long 
active0){
    switch(curChar)
    {
       case 69:
-         if ((active0 & 0x400000000000000L) != 0L)
+         if ((active0 & 0x200000000000000L) != 0L)
          {
-            jjmatchedKind = 58;
+            jjmatchedKind = 57;
             jjmatchedPos = 4;
          }
-         else if ((active0 & 0x1000000000000000L) != 0L)
+         else if ((active0 & 0x800000000000000L) != 0L)
          {
-            jjmatchedKind = 60;
+            jjmatchedKind = 59;
             jjmatchedPos = 4;
          }
-         return jjMoveStringLiteralDfa5_0(active0, 0x200000000000000L);
-      case 73:
          return jjMoveStringLiteralDfa5_0(active0, 0x100000000000000L);
+      case 73:
+         return jjMoveStringLiteralDfa5_0(active0, 0x80000000000000L);
       case 75:
          return jjMoveStringLiteralDfa5_0(active0, 0x40000L);
       case 82:
-         return jjMoveStringLiteralDfa5_0(active0, 0x80000000000000L);
+         return jjMoveStringLiteralDfa5_0(active0, 0x40000000000000L);
       case 84:
          return jjMoveStringLiteralDfa5_0(active0, 0x1800000000L);
       case 97:
          return jjMoveStringLiteralDfa5_0(active0, 0x100008000L);
       case 101:
-         if ((active0 & 0x400000000000000L) != 0L)
+         if ((active0 & 0x200000000000000L) != 0L)
          {
-            jjmatchedKind = 58;
+            jjmatchedKind = 57;
             jjmatchedPos = 4;
          }
-         else if ((active0 & 0x1000000000000000L) != 0L)
+         else if ((active0 & 0x800000000000000L) != 0L)
          {
-            jjmatchedKind = 60;
+            jjmatchedKind = 59;
             jjmatchedPos = 4;
          }
-         return jjMoveStringLiteralDfa5_0(active0, 0x200000043801e00L);
+         return jjMoveStringLiteralDfa5_0(active0, 0x100000043801e00L);
       case 105:
-         return jjMoveStringLiteralDfa5_0(active0, 0x10001e000000000L);
+         return jjMoveStringLiteralDfa5_0(active0, 0x8001e000000000L);
       case 107:
          return jjMoveStringLiteralDfa5_0(active0, 0xc8L);
       case 108:
@@ -441,7 +448,7 @@ private int jjMoveStringLiteralDfa4_0(long old0, long 
active0){
             jjmatchedKind = 42;
             jjmatchedPos = 4;
          }
-         return jjMoveStringLiteralDfa5_0(active0, 0x80100080004120L);
+         return jjMoveStringLiteralDfa5_0(active0, 0x40100080004120L);
       case 115:
          if ((active0 & 0x10000L) != 0L)
          {
@@ -475,24 +482,24 @@ private int jjMoveStringLiteralDfa5_0(long old0, long 
active0){
    switch(curChar)
    {
       case 67:
-         return jjMoveStringLiteralDfa6_0(active0, 0x200000000000000L);
+         return jjMoveStringLiteralDfa6_0(active0, 0x100000000000000L);
       case 76:
          return jjMoveStringLiteralDfa6_0(active0, 0x100L);
       case 78:
          return jjMoveStringLiteralDfa6_0(active0, 0xc8L);
       case 84:
-         return jjMoveStringLiteralDfa6_0(active0, 0x80000000000000L);
+         return jjMoveStringLiteralDfa6_0(active0, 0x40000000000000L);
       case 88:
-         if ((active0 & 0x100000000000000L) != 0L)
+         if ((active0 & 0x80000000000000L) != 0L)
          {
-            jjmatchedKind = 56;
+            jjmatchedKind = 55;
             jjmatchedPos = 5;
          }
          break;
       case 97:
          return jjMoveStringLiteralDfa6_0(active0, 0x8000020L);
       case 99:
-         return jjMoveStringLiteralDfa6_0(active0, 0x200000000780000L);
+         return jjMoveStringLiteralDfa6_0(active0, 0x100000000780000L);
       case 100:
          if ((active0 & 0x40000000L) != 0L)
          {
@@ -524,11 +531,11 @@ private int jjMoveStringLiteralDfa5_0(long old0, long 
active0){
          }
          break;
       case 116:
-         return jjMoveStringLiteralDfa6_0(active0, 0x80000000001e00L);
+         return jjMoveStringLiteralDfa6_0(active0, 0x40000000001e00L);
       case 120:
-         if ((active0 & 0x100000000000000L) != 0L)
+         if ((active0 & 0x80000000000000L) != 0L)
          {
-            jjmatchedKind = 56;
+            jjmatchedKind = 55;
             jjmatchedPos = 5;
          }
          break;
@@ -551,15 +558,15 @@ private int jjMoveStringLiteralDfa6_0(long old0, long 
active0){
       case 67:
          return jjMoveStringLiteralDfa7_0(active0, 0x1000L);
       case 76:
-         return jjMoveStringLiteralDfa7_0(active0, 0x200000400000000L);
+         return jjMoveStringLiteralDfa7_0(active0, 0x100000400000000L);
       case 78:
          return jjMoveStringLiteralDfa7_0(active0, 0x200L);
       case 79:
          return jjMoveStringLiteralDfa7_0(active0, 0x400L);
       case 83:
-         if ((active0 & 0x80000000000000L) != 0L)
+         if ((active0 & 0x40000000000000L) != 0L)
          {
-            jjmatchedKind = 55;
+            jjmatchedKind = 54;
             jjmatchedPos = 6;
          }
          return jjMoveStringLiteralDfa7_0(active0, 0x800L);
@@ -584,7 +591,7 @@ private int jjMoveStringLiteralDfa6_0(long old0, long 
active0){
             jjmatchedKind = 5;
             jjmatchedPos = 6;
          }
-         return jjMoveStringLiteralDfa7_0(active0, 0x200000000780000L);
+         return jjMoveStringLiteralDfa7_0(active0, 0x100000000780000L);
       case 110:
          if ((active0 & 0x2000000L) != 0L)
          {
@@ -597,9 +604,9 @@ private int jjMoveStringLiteralDfa6_0(long old0, long 
active0){
       case 112:
          return jjMoveStringLiteralDfa7_0(active0, 0x100000020000L);
       case 115:
-         if ((active0 & 0x80000000000000L) != 0L)
+         if ((active0 & 0x40000000000000L) != 0L)
          {
-            jjmatchedKind = 55;
+            jjmatchedKind = 54;
             jjmatchedPos = 6;
          }
          break;
@@ -624,13 +631,13 @@ private int jjMoveStringLiteralDfa7_0(long old0, long 
active0){
    switch(curChar)
    {
       case 65:
-         return jjMoveStringLiteralDfa8_0(active0, 0x200000000000000L);
+         return jjMoveStringLiteralDfa8_0(active0, 0x100000000000000L);
       case 80:
          return jjMoveStringLiteralDfa8_0(active0, 0x80000000L);
       case 86:
          return jjMoveStringLiteralDfa8_0(active0, 0x200000000000L);
       case 97:
-         return jjMoveStringLiteralDfa8_0(active0, 0x200000400002000L);
+         return jjMoveStringLiteralDfa8_0(active0, 0x100000400002000L);
       case 98:
          return jjMoveStringLiteralDfa8_0(active0, 0x400L);
       case 100:
@@ -698,7 +705,7 @@ private int jjMoveStringLiteralDfa8_0(long old0, long 
active0){
       case 79:
          return jjMoveStringLiteralDfa9_0(active0, 0x1000000000L);
       case 83:
-         return jjMoveStringLiteralDfa9_0(active0, 0x200000000000000L);
+         return jjMoveStringLiteralDfa9_0(active0, 0x100000000000000L);
       case 97:
          return jjMoveStringLiteralDfa9_0(active0, 0x200000001000L);
       case 98:
@@ -733,7 +740,7 @@ private int jjMoveStringLiteralDfa8_0(long old0, long 
active0){
       case 114:
          return jjMoveStringLiteralDfa9_0(active0, 0x80000000L);
       case 115:
-         return jjMoveStringLiteralDfa9_0(active0, 0x200000000780000L);
+         return jjMoveStringLiteralDfa9_0(active0, 0x100000000780000L);
       case 116:
          return jjMoveStringLiteralDfa9_0(active0, 0x2000L);
       default :
@@ -755,9 +762,9 @@ private int jjMoveStringLiteralDfa9_0(long old0, long 
active0){
       case 79:
          return jjMoveStringLiteralDfa10_0(active0, 0xc0L);
       case 83:
-         if ((active0 & 0x200000000000000L) != 0L)
+         if ((active0 & 0x100000000000000L) != 0L)
          {
-            jjmatchedKind = 57;
+            jjmatchedKind = 56;
             jjmatchedPos = 9;
          }
          break;
@@ -795,9 +802,9 @@ private int jjMoveStringLiteralDfa9_0(long old0, long 
active0){
       case 114:
          return jjMoveStringLiteralDfa10_0(active0, 0x1000000100L);
       case 115:
-         if ((active0 & 0x200000000000000L) != 0L)
+         if ((active0 & 0x100000000000000L) != 0L)
          {
-            jjmatchedKind = 57;
+            jjmatchedKind = 56;
             jjmatchedPos = 9;
          }
          return jjMoveStringLiteralDfa10_0(active0, 0x1000L);
@@ -2826,30 +2833,30 @@ private int jjMoveNfa_0(int startState, int curPos)
 
 /** Token literal values. */
 public static final String[] jjstrLiteralImages = {
-"", "\55\76", "\56\56", "\102\154\141\156\153\116\157\144\145",
-"\111\122\111", "\114\151\164\145\162\141\154",
-"\102\154\141\156\153\116\157\144\145\117\162\111\122\111", 
"\102\154\141\156\153\116\157\144\145\117\162\114\151\164\145\162\141\154",
-"\111\122\111\117\162\114\151\164\145\162\141\154", 
"\164\141\162\147\145\164\116\157\144\145",
-"\164\141\162\147\145\164\117\142\152\145\143\164\163\117\146", 
"\164\141\162\147\145\164\123\165\142\152\145\143\164\163\117\146",
-"\164\141\162\147\145\164\103\154\141\163\163", 
"\144\145\141\143\164\151\166\141\164\145\144",
-"\163\145\166\145\162\151\164\171", "\155\145\163\163\141\147\145", 
"\143\154\141\163\163",
-"\144\141\164\141\164\171\160\145", "\156\157\144\145\113\151\156\144",
-"\155\151\156\105\170\143\154\165\163\151\166\145", 
"\155\151\156\111\156\143\154\165\163\151\166\145",
-"\155\141\170\105\170\143\154\165\163\151\166\145", 
"\155\141\170\111\156\143\154\165\163\151\166\145",
-"\155\151\156\114\145\156\147\164\150", 
"\155\141\170\114\145\156\147\164\150", "\160\141\164\164\145\162\156",
-"\146\154\141\147\163", "\154\141\156\147\165\141\147\145\111\156", 
"\145\161\165\141\154\163",
-"\144\151\163\152\157\151\156\164", "\143\154\157\163\145\144",
-"\151\147\156\157\162\145\144\120\162\157\160\145\162\164\151\145\163", 
"\150\141\163\126\141\154\165\145", "\151\156",
-"\165\156\151\161\165\145\114\141\156\147", "\154\145\163\163\124\150\141\156",
-"\154\145\163\163\124\150\141\156\117\162\105\161\165\141\154\163",
-"\161\165\141\154\151\146\151\145\144\126\141\154\165\145\123\150\141\160\145",
 "\161\165\141\154\151\146\151\145\144\115\151\156\103\157\165\156\164",
-"\161\165\141\154\151\146\151\145\144\115\141\170\103\157\165\156\164",
-"\161\165\141\154\151\146\151\145\144\126\141\154\165\145\123\150\141\160\145\163\104\151\163\152\157\151\156\164",
 "\147\162\157\165\160", "\157\162\144\145\162", "\156\141\155\145",
-"\144\145\163\143\162\151\160\164\151\157\156", 
"\144\145\146\141\165\154\164\126\141\154\165\145", "\136\136", null, null,
-null, null, null, null, "\ufeff", null, null, null, null, null, null, null, 
null,
-"\53", "\55", "\174", "\100", "\136", "\56", "\41", "\77", "\57", "\52", "\75",
-"\50", "\51", "\173", "\175", "\133", "\135", null, null, null, null, null, 
null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, 
null,
+"", "\55\76", "\56\56", "\102\154\141\156\153\116\157\144\145", 
+"\111\122\111", "\114\151\164\145\162\141\154", 
+"\102\154\141\156\153\116\157\144\145\117\162\111\122\111", 
"\102\154\141\156\153\116\157\144\145\117\162\114\151\164\145\162\141\154", 
+"\111\122\111\117\162\114\151\164\145\162\141\154", 
"\164\141\162\147\145\164\116\157\144\145", 
+"\164\141\162\147\145\164\117\142\152\145\143\164\163\117\146", 
"\164\141\162\147\145\164\123\165\142\152\145\143\164\163\117\146", 
+"\164\141\162\147\145\164\103\154\141\163\163", 
"\144\145\141\143\164\151\166\141\164\145\144", 
+"\163\145\166\145\162\151\164\171", "\155\145\163\163\141\147\145", 
"\143\154\141\163\163", 
+"\144\141\164\141\164\171\160\145", "\156\157\144\145\113\151\156\144", 
+"\155\151\156\105\170\143\154\165\163\151\166\145", 
"\155\151\156\111\156\143\154\165\163\151\166\145", 
+"\155\141\170\105\170\143\154\165\163\151\166\145", 
"\155\141\170\111\156\143\154\165\163\151\166\145", 
+"\155\151\156\114\145\156\147\164\150", 
"\155\141\170\114\145\156\147\164\150", "\160\141\164\164\145\162\156", 
+"\146\154\141\147\163", "\154\141\156\147\165\141\147\145\111\156", 
"\145\161\165\141\154\163", 
+"\144\151\163\152\157\151\156\164", "\143\154\157\163\145\144", 
+"\151\147\156\157\162\145\144\120\162\157\160\145\162\164\151\145\163", 
"\150\141\163\126\141\154\165\145", "\151\156", 
+"\165\156\151\161\165\145\114\141\156\147", 
"\154\145\163\163\124\150\141\156", 
+"\154\145\163\163\124\150\141\156\117\162\105\161\165\141\154\163", 
+"\161\165\141\154\151\146\151\145\144\126\141\154\165\145\123\150\141\160\145",
 "\161\165\141\154\151\146\151\145\144\115\151\156\103\157\165\156\164", 
+"\161\165\141\154\151\146\151\145\144\115\141\170\103\157\165\156\164", 
+"\161\165\141\154\151\146\151\145\144\126\141\154\165\145\123\150\141\160\145\163\104\151\163\152\157\151\156\164",
 "\147\162\157\165\160", "\157\162\144\145\162", "\156\141\155\145", 
+"\144\145\163\143\162\151\160\164\151\157\156", 
"\144\145\146\141\165\154\164\126\141\154\165\145", "\136\136", null, null, 
+null, null, null, null, null, null, null, null, null, null, null, "\ufeff", 
null, 
+"\53", "\55", "\174", "\100", "\136", "\56", "\41", "\77", "\57", "\52", 
"\75", 
+"\50", "\51", "\173", "\175", "\133", "\135", null, null, null, null, null, 
null, 
+null, null, null, null, null, null, null, null, null, null, null, null, null, 
null, 
 null, null, null, null, null, null, null, null, null, null, null, null, null, 
null, };
 protected Token jjFillToken()
 {
@@ -2875,15 +2882,15 @@ protected Token jjFillToken()
    return t;
 }
 static final int[] jjnextStates = {
-   188, 189, 190, 198, 199, 204, 205, 188, 189, 190, 192, 197, 116, 130, 132, 
135,
-   6, 7, 8, 1, 2, 4, 41, 42, 43, 23, 24, 25, 59, 60, 61, 63,
-   62, 79, 83, 84, 85, 87, 86, 103, 107, 108, 110, 113, 114, 137, 117, 118,
-   119, 121, 123, 124, 126, 146, 147, 149, 155, 156, 179, 158, 172, 174, 177, 
159,
-   160, 161, 163, 165, 166, 168, 198, 199, 204, 205, 107, 108, 109, 113, 114, 
115,
-   137, 110, 145, 152, 148, 154, 182, 157, 184, 9, 18, 26, 27, 36, 44, 45,
-   54, 64, 65, 74, 88, 89, 98, 122, 128, 146, 147, 148, 149, 155, 156, 157,
-   179, 164, 170, 195, 196, 202, 203, 206, 207, 141, 142, 111, 112, 120, 129, 
138,
-   139, 107, 108, 109, 110, 113, 114, 115, 137, 150, 151, 162, 171, 180, 181,
+   188, 189, 190, 198, 199, 204, 205, 188, 189, 190, 192, 197, 116, 130, 132, 
135, 
+   6, 7, 8, 1, 2, 4, 41, 42, 43, 23, 24, 25, 59, 60, 61, 63, 
+   62, 79, 83, 84, 85, 87, 86, 103, 107, 108, 110, 113, 114, 137, 117, 118, 
+   119, 121, 123, 124, 126, 146, 147, 149, 155, 156, 179, 158, 172, 174, 177, 
159, 
+   160, 161, 163, 165, 166, 168, 198, 199, 204, 205, 107, 108, 109, 113, 114, 
115, 
+   137, 110, 145, 152, 148, 154, 182, 157, 184, 9, 18, 26, 27, 36, 44, 45, 
+   54, 64, 65, 74, 88, 89, 98, 122, 128, 146, 147, 148, 149, 155, 156, 157, 
+   179, 164, 170, 195, 196, 202, 203, 206, 207, 141, 142, 111, 112, 120, 129, 
138, 
+   139, 107, 108, 109, 110, 113, 114, 115, 137, 150, 151, 162, 171, 180, 181, 
 };
 private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, 
long l2)
 {
@@ -3244,7 +3251,7 @@ int jjmatchedPos;
 int jjmatchedKind;
 
 /** Get the next Token. */
-public Token getNextToken()
+public Token getNextToken() 
 {
   Token specialToken = null;
   Token matchedToken;
@@ -3386,7 +3393,7 @@ private void jjCheckNAddStates(int start, int end)
   }
 
   /** Reinitialise parser. */
-
+  
   public void ReInit(SimpleCharStream stream)
   {
 
@@ -3409,7 +3416,7 @@ private void jjCheckNAddStates(int start, int end)
 
   /** Reinitialise parser. */
   public void ReInit(SimpleCharStream stream, int lexState)
-
+  
   {
     ReInit(stream);
     SwitchTo(lexState);
@@ -3432,23 +3439,23 @@ public static final String[] lexStateNames = {
 
 /** Lex State array. */
 public static final int[] jjnewLexState = {
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-1, -1, -1, -1, -1, -1, 
+   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-1, -1, -1, -1, -1, -1, 
+   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-1, -1, -1, -1, -1, -1, 
+   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-1, -1, -1, -1, -1, -1, 
+   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
 };
 static final long[] jjtoToken = {
-   0xdfe07fffffffffffL, 0xbbc0fffffL,
+   0xdfe07fffffffffffL, 0xbbc0fffffL, 
 };
 static final long[] jjtoSkip = {
-   0x1f800000000000L, 0x0L,
+   0x1f800000000000L, 0x0L, 
 };
 static final long[] jjtoSpecial = {
-   0x10000000000000L, 0x0L,
+   0x10000000000000L, 0x0L, 
 };
 static final long[] jjtoMore = {
-   0x0L, 0x0L,
+   0x0L, 0x0L, 
 };
     protected SimpleCharStream  input_stream;
 
diff --git 
a/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/TokenMgrError.java
 
b/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/TokenMgrError.java
index d6aef2121c..3635a241d2 100644
--- 
a/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/TokenMgrError.java
+++ 
b/jena-shacl/src/main/java/org/apache/jena/shacl/compact/reader/parser/TokenMgrError.java
@@ -123,11 +123,10 @@ public class TokenMgrError extends Error
    * Note: You can customize the lexical error message by modifying this 
method.
    */
   protected static String LexicalErr(boolean EOFSeen, int lexState, int 
errorLine, int errorColumn, String errorAfter, int curChar) {
-    char curChar1 = (char)curChar;
     return("Lexical error at line " + //
           errorLine + ", column " + //
           errorColumn + ".  Encountered: " + //
-          (EOFSeen ? "<EOF>" : ("'" + addEscapes(String.valueOf(curChar)) + "' 
(" + (int)curChar + "),")) + //
+          (EOFSeen ? "<EOF>" : ("'" + addEscapes(String.valueOf(curChar)) + "' 
(" + curChar + "),")) + //
           (errorAfter == null || errorAfter.length() == 0 ? "" : " after 
prefix \"" + addEscapes(errorAfter) + "\"")) + //
           (lexState == 0 ? "" : " (in lexical state " + lexState + ")");
   }
@@ -165,4 +164,4 @@ public class TokenMgrError extends Error
     this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, 
curChar), reason);
   }
 }
-/* JavaCC - OriginalChecksum=ef63201cbbded6731b21ef60c14ae171 (do not edit 
this line) */
+/* JavaCC - OriginalChecksum=d164666275ee355fa466386aad606682 (do not edit 
this line) */

Reply via email to