[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Small syntactic note (Was Re: string.gsub ...)
- From: Rici Lake <lua@...>
- Date: Sun, 29 Aug 2004 16:37:11 -0500
It is possibly worth saying that in Lua, as in many languages, ()
is used in two syntactically distinct contexts for two semantically
distinct purposes:
( [exprlist1] ) is a postfix "call" operator
( exp ) is a term
Like prefix/infix "-", the two contexts can easily be distinguished:
-- following a term (prefixexp or prefixexp ':' Name, in the Lua
grammar):
( [exprlist] ) "call" (args)
- "binary operator" (binop)
-- following a binop or at the beginning of an expression:
( expr ) "term" (prefixexp)
- "unary operator" (unop)
It is perhaps the fact that this "pun" is so common that makes
it invisible.