[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Line info for Lua Scripts
- From: twoonkio <twoonkio@...>
- Date: Tue, 19 Jun 2001 11:54:01 +0800
As I use the literate programming tool noweb
(http://www.eecs.harvard.edu/~nr/noweb/), source codes are generated from
the document files. Suppose the document is called 'doc.nw' and the
generated lua code 'code.lua'. When there is a syntax error, the lua
interpreter points to the problem line in 'code.lua'. However, the line
number does not coincides with the actual line number in 'doc.nw'. As the
document grew, it becomes harder to trace the error message back to the
actual location in the file 'doc.nw'.
I usually use lua for scripting. Is there a good way to modify the lua
interpreter 'lua' such that it is able to handle metainformation such as '
#line 40 "doc.nw" '? Better still, is there a way to simply add some codes
within 'code.lua' that modifies the state of dblib's 'currentline'
appropriately? In the second way, the interpreter need not be modified.
>From: Roberto Ierusalimschy <email@example.com>
> Date: Tue Jun 12, 2001 12:35 pm
>Subject: Re: Line info for Lua Scripts
> > Does Lua supports some kind of meta line information?
>The debug library (dblib) has a function that returns (among other things)
>the current line number, but it is not very efficient (it does a kind of
>search into an internal data structure, and also builds a table to return
>its results; its main use is for debugging ;-)
> -- Roberto
> Does Lua supports some kind of meta line information?
> For instance, in C, line information can be included in generated source
> codes as follows:
> > #line 40 "doc.nw"
> > double f(int x)
> > :
> Is there any equivalent syntax for Lua scripts?
> - WK