google-code-export / notepad2-mod

Automatically exported from code.google.com/p/notepad2-mod
Other
2 stars 1 forks source link

Add AviSynth highlighting #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Use existent lexers for this.

Original issue reported on code.google.com by XhmikosR on 13 Dec 2011 at 2:55

GoogleCodeExporter commented 9 years ago
Issue 67 has been merged into this issue.

Original comment by XhmikosR on 9 Jan 2012 at 10:18

GoogleCodeExporter commented 9 years ago
I just finished writing a Scintilla lexer for AviSynth (to tell you the truth, 
I mostly edited LexPOV to fit AviSynth syntax needes).
Then I added the keywords and styling (both taken from AvsP) to Notepad2 (I 
also added the lexer file to both VS project files).

I hope it works alright.
Here's the patch.

Original comment by bruno...@gmail.com on 18 Jan 2012 at 6:38

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for your contribution. The patch still needs some work. I will commit it 
in the next days.

Here are a couple of notes:

1) I don't really think we need different colors for incomplete/triple quoted 
strings. I merged those into one single color.
2) I updated Notepad2.c to toggle comment/stream comment for the new lexer.
3) Added the new LexAVS.cxx file in the *.filters project files and the 
makefiles.
4) The filters keywords need to be updated. This is easy but might be time 
consuming.

Everything else seems to be ok, attached is the updated patch until now. Let me 
know what you think and thanks again for your contribution.

Original comment by XhmikosR on 18 Jan 2012 at 7:13

Attachments:

GoogleCodeExporter commented 9 years ago
>1) I don't really think we need different colors for incomplete/triple quoted 
strings. I merged those into one single color.

Well, that's how AvsP does it.
A couple important points though.
1)You shouldn't set the background color for string or triple-quoted string.
2)This* is why the incomplete string is handled that way.

(*) attached file

Original comment by bruno...@gmail.com on 18 Jan 2012 at 7:25

Attachments:

GoogleCodeExporter commented 9 years ago
That was a typo from my end, but I don't really like that so I won't use 
different colors for each string type.

Original comment by XhmikosR on 18 Jan 2012 at 7:27

Attachments:

GoogleCodeExporter commented 9 years ago
Looks fine like that too, the important thing is that it's still visible.

Oops, just caught a small typo on the lexer code.
There's a SCE_C_DEFAULT, just change it SCE_AVS_DEFAULT.

Original comment by bruno...@gmail.com on 18 Jan 2012 at 7:44

GoogleCodeExporter commented 9 years ago
OK, so the patch so far is attached with the typo fix.

I'm not sure I understand what you mean by it's still visible. It look ok to 
me, but perhaps I miss something.

Original comment by XhmikosR on 18 Jan 2012 at 7:59

Attachments:

GoogleCodeExporter commented 9 years ago
I mean you can still see the string is closing (which is good).

Original comment by bruno...@gmail.com on 18 Jan 2012 at 8:08

GoogleCodeExporter commented 9 years ago
Just one more thing, I sent this to the Scintilla tracker, so I now added the 
license stuff on the comments. The comments are the only thing I changed, so 
it's not really important.

I did it because someone else who sent a lexer there was asked to do the same.

Original comment by bruno...@gmail.com on 18 Jan 2012 at 9:46

Attachments:

GoogleCodeExporter commented 9 years ago
Unfortunately, there was another problem (and I noticed it purely by accident).

AviSynth syntax has two types for comment blocks, one uses /* */ and the other 
uses [* *], I handled this with a simple OR, but that created a problem, you 
could close the first type of comment block using the second type and vice 
versa.
The easy solution was to create a new place to hold the second type, and that's 
what I did.

Here's the patch with the relevant files.

Original comment by bruno...@gmail.com on 19 Jan 2012 at 2:33

Attachments:

GoogleCodeExporter commented 9 years ago
Notepad2.c is not supposed to be there, sorry about that.

Original comment by bruno...@gmail.com on 19 Jan 2012 at 2:42

Attachments:

GoogleCodeExporter commented 9 years ago
I need a patch based on my latest patch which is attached in this post; 
otherwise this can't work if you post patches unrelated to mine. If the changes 
you made are in LexAVS.cxx then post that file only since that's unmodified 
compared to mine.
In this latest patch I have added more internal AviSynth keywords.

Original comment by XhmikosR on 19 Jan 2012 at 2:57

Attachments:

GoogleCodeExporter commented 9 years ago
Okay, I applied that latest patch and then made the changes, this is the full 
patch that can be applied to the SVN rev.

Original comment by bruno...@gmail.com on 19 Jan 2012 at 12:10

Attachments:

GoogleCodeExporter commented 9 years ago
There's a typo in your last patch regarding SCE_AVS_COMMENTBLOCKN.

Attached is the fixed patch. Try it, use it, see if there are any problems and 
let me know so that I can commit it soon-ish.

Original comment by XhmikosR on 19 Jan 2012 at 12:18

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Yeah, I just caught that (trying to compile, then my computer suddenly shut 
itself off, sigh).
One other thing I saw looking at the patch is that you forgot to change LexAU3 
to LexAVS in Notepad2_icl12.vcxproj.filters. It can be changed in the patch 
itself. I didn't fix it because I saw after I sent the patch.

Compiled and tested, no apparent problems.

Original comment by bruno...@gmail.com on 19 Jan 2012 at 12:30

GoogleCodeExporter commented 9 years ago
Yep, bad copy-paste. OK, so the attached patch should be complete.

I will probably commit it later today or tomorrow, but the filters keywords 
really need to be updated at some point. At least with the most common ones, 
like removegrain, masktools, mvtools2 etc.

I say we wait until the patch goes in first.

Original comment by XhmikosR on 19 Jan 2012 at 12:39

Attachments:

GoogleCodeExporter commented 9 years ago
Okay, I'll gather as many as find and send a patch here (or perhaps a different 
bug?) after it's committed.

Original comment by bruno...@gmail.com on 19 Jan 2012 at 12:58

GoogleCodeExporter commented 9 years ago
Either way it's the same for me. Just wait until it's in the svn. I can add a 
few plugins myself too then.

Original comment by XhmikosR on 19 Jan 2012 at 1:30

GoogleCodeExporter commented 9 years ago
All right, I finished adding all the internal keywords for AviSynth up to v2.6. 
Attached is the updated patch.

Now, I noticed something weird. Write for example "float" and don't press space 
or anything; the word float isn't highlighted yet while it should. The same 
happens with every keyword I believe. See the attached png image.

Original comment by XhmikosR on 19 Jan 2012 at 2:42

Attachments:

GoogleCodeExporter commented 9 years ago
I believe it's supposed to work like that.
The C/C++/Java highlighting works the same way, at least.

Original comment by bruno...@gmail.com on 19 Jan 2012 at 5:17

GoogleCodeExporter commented 9 years ago
Here's what I got.
There are 280 items total.

Original comment by bruno...@gmail.com on 19 Jan 2012 at 7:04

Attachments:

GoogleCodeExporter commented 9 years ago
Regarding #20..
The AutoHotKey lexer highlights the word after you finish typing if it's on one 
of the word lists, so I went to see how it does it.
Turns out it simply checked the wordlists again after the loop was done (that's 
when it reaches the end of the file).

Here's the updated lexer with the fix.

Original comment by bruno...@gmail.com on 19 Jan 2012 at 8:03

Attachments:

GoogleCodeExporter commented 9 years ago
Updated patch with:
1)The updated lexer
2)Plugin list from #22 added
3)The filter list had a lot of duplicate items that belonged to the function 
list, I removed them (even the plugin list from #22 had one duplicate from the 
filter list, oops)

Original comment by bruno...@gmail.com on 19 Jan 2012 at 8:48

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the update. Altough I don't support adding really obsolete plugins 
so I might remove those in the future.

Attached is one more patch based on your #7 patch. I removed the bold from the 
operator and used existant ID, removed a couple of useless whitespaces in 
LexAVS.cxx and broke the keywords in smaller lines.

Please, do not keep updating this patch unless something important is changed, 
i.e. not for the keywords.

Original comment by XhmikosR on 19 Jan 2012 at 9:10

Attachments:

GoogleCodeExporter commented 9 years ago
Another thing I noticed in the latest patch is that for example "_Deblock" the 
word Deblock is highlighted. Not sure if that's how it should be.

Original comment by XhmikosR on 19 Jan 2012 at 9:39

GoogleCodeExporter commented 9 years ago
No, it's not how it should be.
I actually forgot to fix that when I edited the POV lexer.

Leading underscore will be include when looking for the word now, so it won't 
get highlighted. Even though I set up specific conditions to leading characters 
which I want the keyword to stay highlighted (period, comma, parenthesis, 
space, and new line), numbers/operators will still have that effect for some 
reason.

That happens with AvsP too.

I also fixed another bug where numbers glued to commas wouldn't get recognized 
as numbers.

Original comment by bruno...@gmail.com on 20 Jan 2012 at 12:41

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for fixing that. From a quick look it seems ok now.

Another thing, can you have a look in FastDegrain.avsi in the MT() part. The 
whole thing is highlighted as a string, but as you can see it's not.

Also, attached should be the final patch from my side which I will commit 
tomorrow.

Original comment by XhmikosR on 20 Jan 2012 at 12:59

Attachments:

GoogleCodeExporter commented 9 years ago
It's supposed to look like that, it's a triple-quote string.
It can be used for commands but will be shown as a string.

Original comment by bruno...@gmail.com on 20 Jan 2012 at 2:40

GoogleCodeExporter commented 9 years ago
Committed in r702. I'll close this issue, so if you have any more updates 
either post here or open a new issue.

PS. I added more keywords.

Original comment by XhmikosR on 20 Jan 2012 at 11:31

GoogleCodeExporter commented 9 years ago
One last change for the AVS lexer (hopefully).
Since the multiline triple-quote string is being handled that way, I removed 
SCE_AVS_STRINGEOL and now the normal string works the same way.

It just works better overall like that, as seen in this example.

http://avisynth.org/mediawiki/Script_examples#Example_5:_poptones.27_Layer_examp
le

Original comment by bruno...@gmail.com on 20 Jan 2012 at 2:46

Attachments: