lua-users home
lua-l archive

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


twoonkio wrote:
> 
> 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.

I think that this would be a lovely "patch" to Lua. I think this because
I have 
exactly the same problem but with nuweb in place of noweb. The "#line"
solution 
gets my vote.

> 
> Thanks,
> - WK
> 
> >From:  Roberto Ierusalimschy <roberto@inf.puc-rio.br>
> > 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 ;-)
> >
> >print(getinfo(1, 'l').currentline)
> >
> > -- Roberto
> 
> twoonkio wrote:
> 
> > Hi,
> >
> > 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?
> >
> > Regards,
> > - WK