lua-users home
lua-l archive

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

The problem with the error messages is that what the eventual Lua parser sees is not what the user saw.

Let's say we have these "skins" (might be a very bad example):

#...		->	(select('#',...))
...[exp]	->	(select(exp,...))

I don't think any static error in 'exp' can rock this, but if there's something at runtime, Lua will report the function "select" to be involved. What select? the user might ask, since he's probably never seen one.


steve donovan kirjoitti 31.10.2007 kello 15:31:

That is very cool - you are doing transforms on the AST
representation, but the AST can be 'quoted'. I enjoyed Lisp in the
80s, but eventually got tired of writing programs virtually in raw

But, to refer to the point about losing lexical information; since
token filter extensions are hooked into the raw token stream, they can
actually give pretty appropriate error messages.

steve d.

On 10/31/07, Fabien <> wrote:
mlp.stat:add{ 'try', mlp.block, 'except', mlp.block, 'end', builder =
exn_builder }
function exn_builder(args)
    local try_block, exn_block = unpack(args)
    return +{stat:
         local status, exn = pcall(function() -{try_block} end)
          if not status then -{exn_block} end
      end }
end }