RockstarLang / rockstar

Home of the Rockstar programming language
https://codewithrockstar.com/
GNU Affero General Public License v3.0
6.88k stars 223 forks source link

One closing parenthesis closes all parenthesis #340

Open thebees86 opened 3 months ago

thebees86 commented 3 months ago
(This is a comment)
(This is a (nested comment))

One would assume that the above are both valid comments, but Satriani closes all parenthesis when it encounters one closing parenthesis, so the second comment is marked as invalid. While comments are discouraged in Rockstar, this behavior is not mentioned in the docs, and goes against the standard behavior of nested parenthesis.

A few examples from testing this on the official website are attached below.

image image

dylanbeattie commented 3 months ago

You're right that this is not covered in the spec... I'll see if we can support nested parentheses in Rockstar 2, otherwise I'll update the docs to make it clear this isn't supported. (It requires stateful parsing which means maintaining a stack inside the parser to see how many comments deep you are, which isn't something that any other Rockstar feature currently requires, but I don't think it's that hard to implement.)