gorillascript icon indicating copy to clipboard operation
gorillascript copied to clipboard

line breaks (\n) in long conditionals

Open sterpe opened this issue 11 years ago • 5 comments

It feels like something like this shouldn't break the gorilla compiler:

   if e and (e.source != this.global or                                       
      e.origin != this.origin or e.data != this.token)                         
          return                                            

Yet I can't for the life of me figure out how to format a long conditional to under 80 cols and still have the gorilla compiler accept it.

sterpe avatar Aug 09 '14 01:08 sterpe

Check out this question I asked awhile back: https://github.com/ckknight/gorillascript/issues/142 it should help you out.

kkirby avatar Aug 11 '14 15:08 kkirby

Thanks. I'll check this out.

Sent from my iPhone

On Aug 11, 2014, at 8:52 AM, Kyle Kirby [email protected] wrote:

Check out this question I asked awhile back: #142 it should help you out.

— Reply to this email directly or view it on GitHub.

sterpe avatar Aug 11 '14 16:08 sterpe

@kkirby, @ckknight;

The solution in #142 seems okay to get me past my current issue, but I'm sort of reluctant to close the issue because from a grammar and syntax point of view there doesn't seem to be any ambiguity...i.e, the 'newline' (or any whitespace really) should not be a syntactically significant character when it occurs inside an as yet unterminated conditional.

conditional -> value
conditional -> conditional  operator  (whitespace shouldn't have significance here...) conditional
//not ambiguous
 if x and y and
   z

//somewhat ambiguous
if x and y
  and z

Edit. remove double negative in statement.

sterpe avatar Aug 11 '14 16:08 sterpe

Yeah, I definitely don't disagree with you.

kkirby avatar Aug 12 '14 01:08 kkirby

Yeah, the internals of the parser would need to be updated. I'm not against this happening, but I don't have the capacity right now to do it myself. I'm completely willing to accept a patch.

ckknight avatar Aug 12 '14 04:08 ckknight