lua-users home
lua-l archive

Re: Ternary operator patch

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


If you want to make a statement about the function of \n in the Lua
language, please write it into a complete file you feed into Lua (and
obviously not via input redirection).
From lparse.c:609
static void funcargs (LexState *ls, expdesc *f) {
 FuncState *fs = ls->fs;
 expdesc args;
 int base, nparams;
 int line = ls->linenumber;
 switch (ls->t.token) {
 case '(': { /* funcargs -> `(' [ explist1 ] `)' */
 if (line != ls->lastline)
luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)");
.....
That if checks and fails if there is newline before '(' where function arguments are expected
Example file:
======8<==========8<=========
print
(1)
======8<==========8<=========

AltStyle によって変換されたページ (->オリジナル) /