Highlight Object-Methods possible ?

Discuss syntax highlighting or submit new syntax files.
User avatar
micha_he
Posts: 570
Joined: 24 Jul 2011 12:16
Location: Helmstedt, NDS, Germany

Highlight Object-Methods possible ?

Post 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 27376 times
P.S.: Is it possible, to define more than nine keywords in a theme ?
User avatar
Rickard Johansson
Site Admin
Posts: 6575
Joined: 19 Jul 2006 14:29

Re: Highlight Object-Methods possible ?

Post 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)...
User avatar
micha_he
Posts: 570
Joined: 24 Jul 2011 12:16
Location: Helmstedt, NDS, Germany

Re: Highlight Object-Methods possible ?

Post 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' ?
User avatar
Rickard Johansson
Site Admin
Posts: 6575
Joined: 19 Jul 2006 14:29

Re: Highlight Object-Methods possible ?

Post by Rickard Johansson »

That should work as well.
User avatar
micha_he
Posts: 570
Joined: 24 Jul 2011 12:16
Location: Helmstedt, NDS, Germany

Re: Highlight Object-Methods possible ?

Post 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.
User avatar
Rickard Johansson
Site Admin
Posts: 6575
Joined: 19 Jul 2006 14:29

Re: Highlight Object-Methods possible ?

Post 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.
User avatar
micha_he
Posts: 570
Joined: 24 Jul 2011 12:16
Location: Helmstedt, NDS, Germany

Re: Highlight Object-Methods possible ?

Post 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 !
User avatar
micha_he
Posts: 570
Joined: 24 Jul 2011 12:16
Location: Helmstedt, NDS, Germany

Re: Highlight Object-Methods possible ?

Post by micha_he »

Ok, with V8.63 it looks good! Thanks.

Here is the result: viewtopic.php?p=9971#p9971
User avatar
micha_he
Posts: 570
Joined: 24 Jul 2011 12:16
Location: Helmstedt, NDS, Germany

Re: Highlight Object-Methods possible ?

Post by micha_he »

Is there any help about RegEx-character like this:

Code: Select all

(?<=\.)
User avatar
Rickard Johansson
Site Admin
Posts: 6575
Joined: 19 Jul 2006 14:29

Re: Highlight Object-Methods possible ?

Post by Rickard Johansson »

It's called "positive lookbehind" and you can find some more information at http://www.regular-expressions.info/lookaround.html.
User avatar
micha_he
Posts: 570
Joined: 24 Jul 2011 12:16
Location: Helmstedt, NDS, Germany

Re: Highlight Object-Methods possible ?

Post 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.
User avatar
micha_he
Posts: 570
Joined: 24 Jul 2011 12:16
Location: Helmstedt, NDS, Germany

Re: Highlight Object-Methods possible ?

Post by micha_he »

Has nobody an idea ?
Waht's wrong at my RegEx ?

Thanks,...
Micha
User avatar
Rickard Johansson
Site Admin
Posts: 6575
Joined: 19 Jul 2006 14:29

Re: Highlight Object-Methods possible ?

Post 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]+
User avatar
micha_he
Posts: 570
Joined: 24 Jul 2011 12:16
Location: Helmstedt, NDS, Germany

Re: Highlight Object-Methods possible ?

Post by micha_he »

Yes, if tried it. No error, but no proper function (nothing highlighted).
User avatar
Rickard Johansson
Site Admin
Posts: 6575
Joined: 19 Jul 2006 14:29

Re: Highlight Object-Methods possible ?

Post 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 |
Post Reply