lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



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