Re: [Boa Constr] boa parser bug?
Status: Beta
Brought to you by:
riaan
From: Riaan B. <riaan@e.co.za> - 2004-01-09 12:05:48
|
Hi Chris, Chris Gahan wrote: >>Yes, I'm aware of this problem. It is very difficult to fix >>(I have tried before). The root of the problem is that the >>source code parser Boa uses parses a line at a time, some >>line continuations are handled, but things like multiline doc >>strings where the indentation dedents really confuse it. >>[...] >>This limitation of the parser has always bothered me, but >>there aren't any simple fixes as far as I can see. Yet >>another todo item... > > > Well, there is one simple fix... You could write a function that does a > pre-processing pass over the code's and concatenates continued-lines into a > single line. Identifying continued is not that simple. (The simple cases are handled already) > And, since this is going to mess up line numbering, you could > use a dictionary that maps this processed-file's line numbers to real line > numbers! :D The line numbers are used way too much in the code, changing everything to work through a mapping is not an option. > It's a simple hack, thanks to python's pythonness. Probably ungodly slow > though. Speed is indeed another issue, the current per-line-parser is *very* fast. Thanks for your suggestion, but I'd prefer a better way. Cheers, Riaan. |