[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ambiguous syntax
- From: Sven Olsen <sven2718@...>
- Date: Sun, 16 Dec 2012 11:08:52 -0800
So, for very little cost, we could keep the 5.1 check in the parser, but only trigger it in cases where we're extending a primary _expression_ that's already a complete function call or table index.
Here's something that may be a better idea:  Only trigger the error once the primary _expression_ reaches some threshold of complexity.  For example, 2+ function calls, one of which has its '(' at the start of a new line.  Then you could error on cases like:
  local a = t[k]
  (f or g)()
but, only emit the error when you start parsing the second '('.  
Without backtracking, I don't think there's any way to guarantee that the check won't sometimes be triggered by false positives.  But, I do think keeping a little logic in the parser to check for particularly dangerous formatting is sensible.
-Sven
- References:
- Ambiguous syntax, Dirk Laurie
- Re: Ambiguous syntax, Coda Highland
- Re: Ambiguous syntax, Peter Loveday
- Re: Ambiguous syntax, Sven Olsen
- Re: Ambiguous syntax, Roberto Ierusalimschy
- Re: Ambiguous syntax, Sven Olsen
- Re: Ambiguous syntax, Roberto Ierusalimschy
- Ambiguous syntax, Sven Olsen
- Re: Ambiguous syntax, Dan
- Re: Ambiguous syntax, Sven Olsen