Page 1 of 2

Highlight Object-Methods possible ?

Posted: 03 Jul 2013 07:02
by micha_he
Is it possible, that i can modify the AutoIt-Syntax-Highlighter, so the object-methods are shown in a different color ?

The pattern is: $[object].[method][delimiter like space or '(']

Here is comparison to SciTE4:
Methoden.jpg
Methoden.jpg (51.73 KiB) Viewed 17740 times
P.S.: Is it possible, to define more than nine keywords in a theme ?

Re: Highlight Object-Methods possible ?

Posted: 03 Jul 2013 15:59
by Rickard Johansson
I tried this in v8.63,

[Keywords]
#Object method=(?<=\.)[a-zA-Z]+

You can probably create a better regex expression.

You should be able to add more keyword colors manually to the settings file (TextEd.ini)...

Re: Highlight Object-Methods possible ?

Posted: 03 Jul 2013 16:33
by micha_he
Rickard Johansson wrote: You should be able to add more keyword colors manually to the settings file (TextEd.ini)...
Not in 'Theme.xml' ?

Re: Highlight Object-Methods possible ?

Posted: 03 Jul 2013 16:39
by Rickard Johansson
That should work as well.

Re: Highlight Object-Methods possible ?

Posted: 03 Jul 2013 17:07
by micha_he
I have used '<Keyword9 color="#00000"....' (keyword 0-8 are exists) in my colortheme.xml-file, but the color doesn't work !?
Color is always blue (default) and styles also doesn't work.

Re: Highlight Object-Methods possible ?

Posted: 03 Jul 2013 17:59
by Rickard Johansson
Did you remove the theme in the options window first? The editor needs to re-load the .xml file from disk. Once that is done all options are stored in the TextEd.ini file.

Re: Highlight Object-Methods possible ?

Posted: 03 Jul 2013 18:14
by micha_he
No, i didn't. I think restart the editor is enough. I'll test it again tomorrow.

Thanks,
Micha

P.S.: A 'Reload'-function for the colortheme would be nice !

Re: Highlight Object-Methods possible ?

Posted: 04 Jul 2013 09:20
by micha_he
Ok, with V8.63 it looks good! Thanks.

Here is the result: viewtopic.php?p=9971#p9971

Re: Highlight Object-Methods possible ?

Posted: 04 Jul 2013 15:12
by micha_he
Is there any help about RegEx-character like this:

Code: Select all

(?<=\.)

Re: Highlight Object-Methods possible ?

Posted: 04 Jul 2013 17:09
by Rickard Johansson
It's called "positive lookbehind" and you can find some more information at http://www.regular-expressions.info/lookaround.html.

Re: Highlight Object-Methods possible ?

Posted: 24 Jul 2013 09:04
by micha_he
I have tried to improve the recognition of the object-methods.

The 'positive lookbehind'

(?<=\$abc\.)[a-zA-Z]+ --> does work

but

(?<=\$[a-zA-Z0-9]\.)[a-zA-Z]+

or

(?<=\$[a-zA-Z0-9]+\.)[a-zA-Z]+ --> produce an error !


Can someone help ?

Micha

P.S.: Pattern is like '$Abc2.dEf'. It begins with a '$', followed by some letters/numbers and a dot '.'. Then the method begins.

Re: Highlight Object-Methods possible ?

Posted: 29 Jul 2013 10:39
by micha_he
Has nobody an idea ?
Waht's wrong at my RegEx ?

Thanks,...
Micha

Re: Highlight Object-Methods possible ?

Posted: 29 Jul 2013 14:06
by Rickard Johansson
I don't think you can use regex expressions like \$[a-zA-Z0-9]+\. in a lookbehind or lookaround. It will only work with simple expressions like \. or \$

I'm not sure it works but have you tried (?<=\$\w+\.)[a-zA-Z]+

Re: Highlight Object-Methods possible ?

Posted: 29 Jul 2013 14:56
by micha_he
Yes, if tried it. No error, but no proper function (nothing highlighted).

Re: Highlight Object-Methods possible ?

Posted: 29 Jul 2013 17:08
by Rickard Johansson
This works, but it's not an elegant solution:

(?<=\$....\.)([a-zA-Z]+)|(?<=\$.....\.)([a-zA-Z]+)|(?<=\$......\.)([a-zA-Z]+) etc.

(?<=\$....\.) matches a 4 letter name starting with $ e.g. $Name

(?<=\$.....\.) matches a 5 letter name ...

You can add as many expressions you want separated by |