Re: Experiments with read/write external files

2017-07-19 Thread Edward K. Ream
On Wed, Jul 19, 2017 at 1:45 PM, vitalije wrote: One possible use of these generators is for calculating line number in > external files. > ​...​ > If v.lines is ready then it is just matter of indexing in tuple. If every > leaf node has the answer to a question: "how many lines in output do you

Re: Experiments with read/write external files

2017-07-19 Thread Edward K. Ream
On Wed, Jul 19, 2017 at 12:16 PM, vitalije wrote: > Edward it seems that you have picked wrong version of my example file > (which I published by mistake, and later re-uploaded). > The mistake was in check_all_files_read_ok. Here is corrected version: > ​Thanks for this. I got even more errors.

Re: PHP colorizer mode

2017-07-19 Thread Adrian
By 'monkey-patching' do you mean that, if I distribute the plugin, with it's own version of qt_events for the user to install on their own? On Sunday, July 9, 2017 at 10:02:45 AM UTC-5, Adrian wrote: > > Hello, > > I am having some trouble figuring out how the colroizer works. I have > success

Re: PHP colorizer mode

2017-07-19 Thread Adrian
no importa, https://stackoverflow.com/questions/5626193/what-is-a-monkey-patch I honestly had never heard this term until I started reading the leo group, being new to python. I understand now. Thanks, Edward On Sunday, July 9, 2017 at 10:02:45 AM UTC-5, Adrian wrote: > > Hello, > > I am hav

Re: Experiments with read/write external files

2017-07-19 Thread vitalije
One possible use of these generators is for calculating line number in external files. Currently command goto-global-line is implemented in such a way that it generates whole content of external file, then it splits generated content into lines and then starts counting. It is rather expensive o

Re: Experiments with read/write external files

2017-07-19 Thread vitalije
Edward it seems that you have picked wrong version of my example file (which I published by mistake, and later re-uploaded). The mistake was in check_all_files_read_ok. Here is corrected version: def check_all_files_read_ok(): ok = True p1 = c.find_h('Core classes')[0] for p2 in p1.ch

Re: Experiments with read/write external files

2017-07-19 Thread vitalije
Regarding the differences that were reported, they are all top nodes. For retrieving lines of top nodes `body_lines_of_top_node` generator should be used and for all other nodes `body_lines_of_node` should be used. The only difference is handling at-first and at-last lines which (if I am not mi

Re: Experiments with read/write external files

2017-07-19 Thread vitalije
> > > The others_replacer and others_replacer concern me. I don't see how they > handle nested @others properly. > > That is part of writing code. Function all_lines(p, zero_ -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from

Re: Experiments with read/write external files

2017-07-19 Thread Edward K. Ream
On Wednesday, July 19, 2017 at 11:01:11 AM UTC-5, Edward K. Ream wrote: Naturally, this assume that the old and new code are *exactly* equivalent. > Unit tests are a start, but I'm not sure they cover all the significant > cases.​ > Actually, I would be shocked if the present unit tests cover a

Re: Experiments with read/write external files

2017-07-19 Thread Edward K. Ream
On Wednesday, July 19, 2017 at 10:37:04 AM UTC-5, Edward K. Ream wrote: > > On Wednesday, July 19, 2017 at 9:12:34 AM UTC-5, Terry Brown wrote: > > > Don't forget Leo reads a lot of languages other than Python, not sure > how much of that code is relevant here. > > Leo's read/write code works exa

Re: PHP colorizer mode

2017-07-19 Thread Edward K. Ream
On Wed, Jul 19, 2017 at 10:14 AM, Adrian wrote: > thank you so much Edward. > ​You're welcome.​ > > The rulesDict, with the lead-in character portion is where I was going > wrong. > ​Oh good.​ PS - nearing completion of the PHP autocompleter, code suggest plugin. As > usual, I need to poli

Re: Experiments with read/write external files

2017-07-19 Thread Edward K. Ream
On Wed, Jul 19, 2017 at 10:32 AM, Edward K. Ream wrote: ​> ​ Improving the code will make Leo stronger and more flexible. I am thrilled that you are interested in improving the code. ​Naturally, this assume that the old and new code are *exactly* equivalent. Unit tests are a start, but I'm not s

Re: Experiments with read/write external files

2017-07-19 Thread Edward K. Ream
On Wed, Jul 19, 2017 at 10:32 AM, Edward K. Ream wrote: ​A tiny improvement. others_iterator contains: p1 = p.copy().moveToThreadNext()​ You can always replace by: p1 = p.threadNext() because all the getters that *don't* start with "moveTo" leave their "receiver" position (p, in this

Re: Experiments with read/write external files

2017-07-19 Thread Edward K. Ream
On Wednesday, July 19, 2017 at 9:12:34 AM UTC-5, Terry Brown wrote: > Don't forget Leo reads a lot of languages other than Python, not sure how much of that code is relevant here. Leo's read/write code works exactly the same for all languages. That's why, for example, Leo recognizes section r

Re: Experiments with read/write external files

2017-07-19 Thread Edward K. Ream
On Wednesday, July 19, 2017 at 8:58:31 AM UTC-5, vitalije wrote: > For last few days I was experimenting with writing external files (at-file trees) and parsing those files to recreate tree. I have started this exploration looking for a better way to use new v.lines property. This is short repo

Re: PHP colorizer mode

2017-07-19 Thread Adrian
thank you so much Edward. The rulesDict, with the lead-in character portion is where I was going wrong. PS - nearing completion of the PHP autocompleter, code suggest plugin. As usual, I need to polish it, and also figure out a way to make it work even after a user updates Leo (because I adde

Re: Experiments with read/write external files

2017-07-19 Thread vitalije
On Wednesday, July 19, 2017 at 4:12:34 PM UTC+2, Terry Brown wrote: > > not sure how much of that code is relevant here. > > Perhaps it is not relevant, but think of this thread just as theme for discussing new strategy in parsing lines of text into tree structure. Vitalije -- You received th

Re: Experiments with read/write external files

2017-07-19 Thread vitalije
In first attempt I have attached bad version of .leo file. Now I have re-uploaded correct version. I hope nobody has downloaded it yet. Vitalije -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emai

Re: Experiments with read/write external files

2017-07-19 Thread Terry Brown
Don't forget Leo reads a lot of languages other than Python, not sure how much of that code is relevant here. Cheers -Terry -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an

Experiments with read/write external files

2017-07-19 Thread vitalije
For last few days I was experimenting with writing external files (at-file trees) and parsing those files to recreate tree. I have started this exploration looking for a better way to use new v.lines property. This is short report of what I have found so far. Attached to this post is example .l

Re: PHP colorizer mode

2017-07-19 Thread Edward K. Ream
On Sun, Jul 9, 2017 at 10:02 AM, Adrian wrote: ​> ​ Please advise on how to make one color. Just as""" """works correctly in python mode. ​Why not start with the python rules as your guide. From modes/python.py: def python_rule1(colorer, s, i): return colorer.match_span(s, i, kind="literal