Commented curly brace in init code

24 views
Skip to first unread message

Roded Bahat

unread,
Nov 27, 2012, 12:44:59 PM11/27/12
to pe...@googlegroups.com
Hi,
It seems like a commented { in the init section at the beginning of the grammar causes the grammar to fail parsing.
Same fate for both single & multi-line comments.

Amazing work on PEG.js.
Roded

{
/**
{
*/

}
start
  = additive

additive
  = left:multiplicative "+" right:additive { return left + right; }
  / multiplicative

multiplicative
  = left:primary "*" right:multiplicative { return left * right; }
  / primary

primary
  = integer
  / "(" additive:additive ")" { return additive; }

integer "integer"
  = digits:[0-9]+ { return parseInt(digits.join(""), 10); }

David Majda

unread,
Nov 28, 2012, 2:15:05 PM11/28/12
to Roded Bahat, pegjs
2012/11/27 Roded Bahat <rod...@gmail.com>:
> It seems like a commented { in the init section at the beginning of the
> grammar causes the grammar to fail parsing.
> Same fate for both single & multi-line comments.

This is "by design" but I will probably fix it at some point. See
https://github.com/dmajda/pegjs/issues/89.

--
David Majda
Entropy fighter
http://majda.cz/
Reply all
Reply to author
Forward
0 new messages