Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Syntax highlighter for Eclipse IDE


  • Please log in to reply
40 replies to this topic
RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005
I agree with PhiLho that parsing ahk scripts is not an easy task... I´ve found one more annoyance the outliner stumbles over:
A line like
myVar := lastVar + nextVar
is outlined as label definition :(
Even worse, because I usually indent those lines with tabs, the outliner shows a square for every tab...

RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005
Hi, one more question: how can I define the colors I want to use? I had a look at the ahk.hrc file but cannot find out where to set the colors...

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005

A line like

myVar := lastVar + nextVar
is outlined as label definition :(

No space in a label definition (which accepts otherwise almost all Ascii chars! Except comma, percent and backtick (and of course colon!). A label cannot start with these, nor with semi-colon (as it would be a comment!). And after the colon, you cannot have anything except comments.
[EDIT] Testing label syntax:
labels = !"#$&'()*+-./<=>?@{|}~
Loop Parse, labels
{
	c := A_LoopField
	Gosub %c%L
}
c = `;
Gosub L;L
MsgBox %r%
Return

!L:
"L:
#L:
$L:
; Not label %L:
&L:
'L:
(L:
)L:
*L:
+L:
; Not label ,L:
-L:
.L:
/L:
; Not label :L:
; Not label ;L:
L;L:
<L:
=L:
>L:
?L:
@L:
; Not label `L:
{L:
|L:
}L:
~L:
	r = %r%%c%
Return

Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005

No space in a label definition (which accepts otherwise almost all Ascii chars! Except comma, percent and backtick (experimental list! May be incomplete). A label cannot start with these, nor with colon and semi-colon... And after the colon, you cannot have anything except comments.

I think I´ll leave the exact recognizing regexp up to jonib but as quick hack, I was able to eliminate the false labels by altering the code in ahk.hrc from
<scheme name="Labels">
			<regexp match="/^(?{ahkOutline}%varname;:[^;]*)/i" region="Label"/>
</scheme>
to
<scheme name="Labels">
			<regexp match="/^(?{ahkOutline}%varname;:[^;=]*)/i" region="Label"/>
</scheme>
(note the equals character)

I don´t know if it will have some unwanted side effects...

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006

Hi, one more question: how can I define the colors I want to use? I had a look at the ahk.hrc file but cannot find out where to set the colors...


You can change coloring style in Eclipse "preferences" "Colorer Library Editor"

If you want your own colors go to the directory where the "catalog.xml" file is and then the "hrd\rgb" directory, that seems to be where the colors are defined.

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006

I agree with PhiLho that parsing ahk scripts is not an easy task... I´ve found one more annoyance the outliner stumbles over:
A line like

myVar := lastVar + nextVar
is outlined as label definition :(
Even worse, because I usually indent those lines with tabs, the outliner shows a square for every tab...

There are probably many more like this as I wanted to know what I could get working while I learned the Colorer syntax, but if you find more problems and can fix them, less work for me :twisted:

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006

No space in a label definition (which accepts otherwise almost all Ascii chars! Except comma, percent and backtick (and of course colon!). A label cannot start with these, nor with semi-colon (as it would be a comment!). And after the colon, you cannot have anything except comments.

I assumed labels used the same characters as variables. and thanks for the label syntax testing script.

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006

<scheme name="Labels">
			<regexp match="/^(?{ahkOutline}%varname;:[^;=]*)/i" region="Label"/>
</scheme>
(note the equals character)

I don´t know if it will have some unwanted side effects...

It should at least work better then before.

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006
Hi

I finally had some time to work on this and made a new thread here.
Outlines should work better but functions still need to have "{" on the same line as the function name.

M'o
  • Members
  • 10 posts
  • Last active: Feb 14 2012 10:57 AM
  • Joined: 09 Mar 2006
Hi @ all,

anything changes made since jun2006, the date from the last post? An plugin for the eclipse ide is an very good idea...

Regards
M'o

jonib
  • Members
  • 75 posts
  • Last active: Feb 18 2017 04:44 PM
  • Joined: 09 May 2006

Hi @ all,

anything changes made since jun2006, the date from the last post? An plugin for the eclipse ide is an very good idea...

Regards
M'o


Hi M'o

Did you look at my thread here, it should have a functional but not complete syntax highlighting for Eclipse using Colorer plug-in.
I have not updated it in a while because I have not done much with AutoHotkey lately and there haven't been much interest, but that can change fast :D

jonib