lua-users home
lua-l archive

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


> is there somewhere some list of the error messages used by Lua?

No. Several error messages are composed of "submessages", so that there
is great variability in their formats. (In general, we think that,
when we use standardized error messages, there is a tendency to give
less information than is available, in order to fit the standard.)


> In luac.c there is a function named "incomplete" which contains the
> following code:
> 
> #define EOFMARK "<eof>"
> #define marklen (sizeof(EOFMARK)/sizeof(char) - 1)
> ...
> if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) {
> [...]
> (anyway this luaX_tokens list of reserved workds is a bit longer than the
> reserved word list int he reference manual, chapter 3.1: It further
> contains the following 5 strings as reserved words: "<eof>", "<number>",
> "<integer>", "<name>", "<string>" ... but I do not really see in the
> reference manual where those are really used... . (Looking of "<eof>" in
> the reference manual gives no result...).

That is not a list of reserved words, it is a list of printable names
for tokens. The extra elements are used for error messages. For
instance, in the message

  <name> expected near '('

"<name>" came from that list.  Similarly, "<eof>" comes from that list
when needed:

  $ echo 'function end' | lua 
  lua: stdin:1: <name> expected near 'end'

  $ echo 'function ()' | lua 
  lua: stdin:1: <name> expected near '('

  $ echo function | lua 
  lua: stdin:2: <name> expected near <eof>

-- Roberto