w3c/shacl

problems with shaclc.jison

Closed this issue · 3 comments

hi @jeswr !
I'll submit a PR that converts the 4 candidate grammars to EBNF and generates RailRoad diagrams
(see #37 (comment))

The others convert ok, but there's a problem with your grammar https://github.com/jeswr/shaclcjs/blob/main/lib/shaclc.jison :

java -jar c:/prog/bin/ebnf-convert.war shaclc-Jison-orig.jison
Exception de.bottlecaps.convert.Convert$ConvertException: lexical analysis failed
while expecting ['%start', LEX_BLOCK, ACTION, '%left', '%right', '%nonassoc', '%token', '%%']
after successfully scanning 1 characters beginning at line 256, column 1:
...%ebnf

%start shaclDoc

%%

// TODO: Work out why this occurs mu...
        at de.bottlecaps.convert.Convert.convert(Convert.java:416)
        at de.bottlecaps.convert.Convert.main(Convert.java:171)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at de.bottlecaps.fatjar.Loader.main(Loader.java:70)

I tried commenting out some lines around that point but got nowhere:

https://gerhobbelt.github.io/jison/try/usf/index.html also returns an error at an earlier spot:

Oops. Make sure your grammar is in the correct format.
JisonLexerError: Lexical error on line 151: 
unsupported lexer input encountered while lexing
macro's (i.e. jison lex regexes).

    NOTE: When you want this input to be interpreted as a LITERAL part
          of a lex rule regex, you MUST enclose it in double or
          single quotes.

          If not, then know that this input is not accepted as a valid
          regex expression here in jison-lex macro's.

  Erroneous area:
148: 
149: 
150: 
151: PASS                    [ \t\r\n]+ -> skip
^^^......................................^
152: COMMENT                 '#' ~[\r\n]* -> skip
153: 
    at Object.parseError (https://gerhobbelt.github.io/jison/assets/js/jison.js:2813:19)
    at Object.lexer_parseError [as parseError] (https://gerhobbelt.github.io/jison/assets/js/jison.js:4476:54)
    at Object.yyError [as yyerror] (https://gerhobbelt.github.io/jison/assets/js/jison.js:4507:25)
    at Object.lexer__performAction [as performAction] (https://gerhobbelt.github.io/jison/assets/js/jison.js:6278:25)
    at Object.lexer_test_match [as test_match] (https://gerhobbelt.github.io/jison/assets/js/jison.js:5305:40)
    at Object.lexer_next [as next] (https://gerhobbelt.github.io/jison/assets/js/jison.js:5416:30)
    at Object.lexer_lex [as lex] (https://gerhobbelt.github.io/jison/assets/js/jison.js:5485:26)
    at stdLex (https://gerhobbelt.github.io/jison/assets/js/jison.js:3337:31)
    at Object.parse (https://gerhobbelt.github.io/jison/assets/js/jison.js:3468:34)
    at Object.yyparse [as parse] (https://gerhobbelt.github.io/jison/assets/js/jison.js:6704:27)

Finally, https://gerhobbelt.github.io/jison/try/ just returns

Oops. Make sure your grammar is in the correct format.
undefined

Thanks for all your conversion work @VladimirAlexiev! I'll look into getting the jison converted in the next couple of days.

Apologies for the delay on this @VladimirAlexiev a - I've now opened a PR to VladimirAlexiev#1 where I've modified the way the .jison grammar is expressed to make enbf-convert happy.