You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When in the following program (which is a modification of the example in bin/parse3.js):
constfs=require('fs');letinput=' ( ( ( 1) ) )';constgruffalo=require('../gruffalo');letgrammar=newgruffalo.Grammar({start: 'E'});letrule=(left,right,f)=>{returngrammar.add(newgruffalo.Rule(left,right,f));};rule('E',['LP','E','RP'],(LP,E,RP)=>[E]);rule('E',['ONE'],(one)=>one);rule('ONE',['_','1','_'],(_,a)=>a.type);rule('LP',['_','(','_'],()=>'');rule('RP',['_',')'],()=>'');// Substituting the former rule by this one produces an error. Seems to be a bug?//rule ('RP', ['_', ')', '_'], () => ''); // whitesrule('_',[]);rule('_',['_',' ']);letp=eval(gruffalo.compile(grammar))({});varindex=0;functionlex(){return{type: input[index++]||'$'};}console.log(JSON.stringify(p(lex)));
I substitute the rule for 'RP' by the commented one (Intending to catch white spaces on the right side of the right parenthesis):
When in the following program (which is a modification of the example in
bin/parse3.js
):I substitute the rule for
'RP'
by the commented one (Intending to catch white spaces on the right side of the right parenthesis):I get this error:
Is this a bug in the grammar or is a bug in the gruffalo parser?
The text was updated successfully, but these errors were encountered: