Hi,
First of all I would like to say, I love this program, I love how it is much easier to configure than gnome-text-editor.
Now for my questions (2):
I have edited the filedefs.asm file so that it will work for mips isa. Everything is great except for one thing, the comments. Geany won't recognized anything following # as a comment.
The only way I have found for Geany to treat everything to the right of # correctly is by doing CTRL - D to comment a line. Here is the fun part, the symbol it inserts is whatever is in the "comment_open= " field. Well I tried having "comment_open=#" but that doesnt work, if I try something like "comment_open=;" geany treats it as a one line comment when I CTRL-D that line.
So any idea how to get Geany to treat # correctly would be great.
The second question is if there is a special keyword I could use so that Geany would color a label. For reference a label is anything preceding a ":". As a HUGE bonus is there any way that Geany could keep track of the labels so that when it is used in the code some where geany will color it?
Example of Label
LOOP: addi $1,$0,3 j LOOP
Thanks
Manuel Mendez
Unfortunately, the ASM lexer in Scintilla does not support customizable comments. But you can make a modification to add # as a comment char. It's in LexASM.cxx
Coloring labels would also require changes to the lexer to support this, as far as I know. After adding a "label" style, then you would have to change Geany to give the new "label" style its color and font attributes.
On Oct 5, 2008, at 3:56 PM, Manuel Mendez wrote:
Hi,
First of all I would like to say, I love this program, I love how it is much easier to configure than gnome-text-editor.
Now for my questions (2):
I have edited the filedefs.asm file so that it will work for mips isa. Everything is great except for one thing, the comments. Geany won't recognized anything following # as a comment.
The only way I have found for Geany to treat everything to the right of # correctly is by doing CTRL - D to comment a line. Here is the fun part, the symbol it inserts is whatever is in the "comment_open= " field. Well I tried having "comment_open=#" but that doesnt work, if I try something like "comment_open=;" geany treats it as a one line comment when I CTRL-D that line.
So any idea how to get Geany to treat # correctly would be great.
The second question is if there is a special keyword I could use so that Geany would color a label. For reference a label is anything preceding a ":". As a HUGE bonus is there any way that Geany could keep track of the labels so that when it is used in the code some where geany will color it?
Example of Label
LOOP: addi $1,$0,3 j LOOP
Thanks
Manuel Mendez _______________________________________________ Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
On Sun, 5 Oct 2008 16:02:57 -0700 Jason Oster parasytic@gmail.com wrote:
Unfortunately, the ASM lexer in Scintilla does not support customizable comments. But you can make a modification to add # as a comment char. It's in LexASM.cxx
line 150, scintilla/LexASM.cxx: if (sc.ch == ';'){
change to: if (sc.ch == '#'){
Really the Scintilla ASM lexer could be improved to have a customizable comment char property and also a label style.
Regards, Nick
I installed Geany from Ubuntu 8.04 repos and I cant find scintilla/LexASM.cxx anywhere.
Any clues to what might be going on?
Thanks
On Tue, Oct 7, 2008 at 7:44 AM, Nick Treleaven < nick.treleaven@btinternet.com> wrote:
On Sun, 5 Oct 2008 16:02:57 -0700 Jason Oster parasytic@gmail.com wrote:
Unfortunately, the ASM lexer in Scintilla does not support customizable comments. But you can make a modification to add # as a comment char. It's in LexASM.cxx
line 150, scintilla/LexASM.cxx: if (sc.ch == ';'){
change to: if (sc.ch == '#'){
Really the Scintilla ASM lexer could be improved to have a customizable comment char property and also a label style.
Regards, Nick _______________________________________________ Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
On Wed, 8 Oct 2008 22:53:23 -0400 "Manuel Mendez" mmendez534@gmail.com wrote:
I installed Geany from Ubuntu 8.04 repos and I cant find scintilla/LexASM.cxx anywhere.
Any clues to what might be going on?
You will need to build from source: http://www.geany.org/manual/dev/index.html#source-compilation
Download & extract geany-0.14.tar.gz.
For Ubuntu I think you can get the source dependencies with: apt-get install gtk2-dev
But you will also need build tools - maybe try the build-essential package.
Regards, Nick
Correction:
apt-get build-dep geany
Will install all necessary dependencies to build Geany under Ubuntu.
Nick Treleaven wrote:
On Wed, 8 Oct 2008 22:53:23 -0400 "Manuel Mendez" mmendez534@gmail.com wrote:
I installed Geany from Ubuntu 8.04 repos and I cant find scintilla/LexASM.cxx anywhere.
Any clues to what might be going on?
You will need to build from source: http://www.geany.org/manual/dev/index.html#source-compilation
Download & extract geany-0.14.tar.gz.
For Ubuntu I think you can get the source dependencies with: apt-get install gtk2-dev
But you will also need build tools - maybe try the build-essential package.
Regards, Nick _______________________________________________ Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
Thanks to Jason and Nick, I edited and installed and its working just fine.
Thanks again,
Manuel Mendez
On Thu, Oct 9, 2008 at 10:37 AM, Jason Oster parasytic@gmail.com wrote:
Correction:
apt-get build-dep geany
Will install all necessary dependencies to build Geany under Ubuntu.
Nick Treleaven wrote:
On Wed, 8 Oct 2008 22:53:23 -0400 "Manuel Mendez" mmendez534@gmail.com wrote:
I installed Geany from Ubuntu 8.04 repos and I cant find scintilla/LexASM.cxx anywhere.
Any clues to what might be going on?
You will need to build from source: http://www.geany.org/manual/dev/index.html#source-compilation
Download & extract geany-0.14.tar.gz.
For Ubuntu I think you can get the source dependencies with: apt-get install gtk2-dev
But you will also need build tools - maybe try the build-essential package.
Regards, Nick _______________________________________________ Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
Geany mailing list Geany@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
On Tue, 7 Oct 2008 12:44:53 +0100, Nick Treleaven nick.treleaven@btinternet.com wrote:
On Sun, 5 Oct 2008 16:02:57 -0700 Jason Oster parasytic@gmail.com wrote:
Unfortunately, the ASM lexer in Scintilla does not support customizable comments. But you can make a modification to add # as a comment char. It's in LexASM.cxx
line 150, scintilla/LexASM.cxx: if (sc.ch == ';'){
change to: if (sc.ch == '#'){
Really the Scintilla ASM lexer could be improved to have a customizable comment char property and also a label style.
Maybe if (sc.ch == '#' || sc.ch == ';'){
would be enough for now? I don't know any ASM very well, but are there many more comment characters used besides route and semicolon? If it would be enough, we sould send a patch to Scintilla. No idea about the label style.
Jason now has some experience in adding properties to Scintilla lexers, don't you? :-)
Regards, Enrico
Enrico Tröger wrote:
On Tue, 7 Oct 2008 12:44:53 +0100, Nick Treleaven nick.treleaven@btinternet.com wrote:
On Sun, 5 Oct 2008 16:02:57 -0700 Jason Oster parasytic@gmail.com wrote:
Unfortunately, the ASM lexer in Scintilla does not support customizable comments. But you can make a modification to add # as a comment char. It's in LexASM.cxx
line 150, scintilla/LexASM.cxx: if (sc.ch == ';'){
change to: if (sc.ch == '#'){
Really the Scintilla ASM lexer could be improved to have a customizable comment char property and also a label style.
Maybe if (sc.ch == '#' || sc.ch == ';'){
would be enough for now? I don't know any ASM very well, but are there many more comment characters used besides route and semicolon? If it would be enough, we sould send a patch to Scintilla. No idea about the label style.
It's a good idea to patch the ASM lexer, since it is not generic enough to support all ASM dialects. (Which I think was the original intent?)
# and ; characters are widely used for ASM comments, but also C/C++ style // and /*...*/ comments are common, too. I have seen cases where @ characters are used as comments, but also cases where @ characters are used for special pseudo-operands! Obviously, not all comment characters should be hard-coded into the lexer, but maybe they should be made customizable.
This would be easy for single comment characters and C++-style // comments by adding a new keywords field. For C-style /*...*/ comments, I think a lexer pref to enable/disable multi-line comments is the way to go.
I'm sure I could hack these features in when I get home today. Oh, and label styles, too. (If I can remember to do it!)
Jason now has some experience in adding properties to Scintilla lexers, don't you? :-)
Yep. ;)
A few other things to think about with ASM syntaxes, which may or may not be within the scope of this discussion:
Number styling could use some work I think, since there are many ways to specify numbers among languages. For example, MOS 6502/65816 uses $... to specify hex numbers, where most others use 0x... or even ...h
BUT, MIPS ASM (which is where this discussion comes from) can use $... to specify registers! Common MIPS register syntaxes include:
$0, r0, zero, $zero ... $1, a0, $a0 ...
etc.
So is $a0 a register (MIPS) or a hex number (MOS 6502/6581)? I think these need to be made more generic, too. ;)
Jay
On Thu, 09 Oct 2008 10:56:30 -0700, Jason Oster parasytic@gmail.com wrote:
Enrico Tröger wrote:
On Tue, 7 Oct 2008 12:44:53 +0100, Nick Treleaven nick.treleaven@btinternet.com wrote:
On Sun, 5 Oct 2008 16:02:57 -0700 Jason Oster parasytic@gmail.com wrote:
Unfortunately, the ASM lexer in Scintilla does not support customizable comments. But you can make a modification to add # as a comment char. It's in LexASM.cxx
line 150, scintilla/LexASM.cxx: if (sc.ch == ';'){
change to: if (sc.ch == '#'){
Really the Scintilla ASM lexer could be improved to have a customizable comment char property and also a label style.
Maybe if (sc.ch == '#' || sc.ch == ';'){
would be enough for now? I don't know any ASM very well, but are there many more comment characters used besides route and semicolon? If it would be enough, we sould send a patch to Scintilla. No idea about the label style.
It's a good idea to patch the ASM lexer, since it is not generic enough to support all ASM dialects. (Which I think was the original intent?)
# and ; characters are widely used for ASM comments, but also C/C++ style // and /*...*/ comments are common, too. I have seen cases where @ characters are used as comments, but also cases where @ characters are used for special pseudo-operands! Obviously, not all comment characters should be hard-coded into the lexer, but maybe they should be made customizable.
This would be easy for single comment characters and C++-style // comments by adding a new keywords field. For C-style /*...*/ comments, I think a lexer pref to enable/disable multi-line comments is the way to go.
Once available, we could set this pref with our comment_open/comment_close prefs from filetypes.asm. Then users can choose their preferred comment characters.
Jason now has some experience in adding properties to Scintilla lexers, don't you? :-)
Yep. ;)
A few other things to think about with ASM syntaxes, which may or may not be within the scope of this discussion:
Number styling could use some work I think, since there are many ways to specify numbers among languages. For example, MOS 6502/65816 uses $... to specify hex numbers, where most others use 0x... or even ...h
BUT, MIPS ASM (which is where this discussion comes from) can use $... to specify registers! Common MIPS register syntaxes include:
$0, r0, zero, $zero ... $1, a0, $a0 ...
etc.
So is $a0 a register (MIPS) or a hex number (MOS 6502/6581)? I think these need to be made more generic, too. ;)
How? No idea what MOS 6502/6581 is but it is widely used? I think in general it doesn't make much sense to support every single minor ASM dialect in the lexer. Providing support for the main variants should be good enough, IMO. And in particular, I assume Neil thinks similar about this.
And further more, this discusion should move to the Scintilla list/bug tracker as this not directly Geany-specific but more an issue of the Scintilla ASM lexer.
Regards, Enrico
Enrico Tröger wrote: ...snip...
So is $a0 a register (MIPS) or a hex number (MOS 6502/6581)? I think these need to be made more generic, too. ;)
How? No idea what MOS 6502/6581 is but it is widely used? I think in general it doesn't make much sense to support every single minor ASM dialect in the lexer. Providing support for the main variants should be good enough, IMO. And in particular, I assume Neil thinks similar about this.
6502 is the 8-bit CPU used in Nintendo NES, Commodore 64, and several Atari systems. 65816 was the 16-bit upgrade used in SNES. ;) It's not used today outside of hobbyist projects like emulators and homebrew games.
As for how to differentiate between a 6502 numeric hex value and a MIPS register? The ASM lexer already supports register keywords; just add $a0 etc to it. That takes care of the MIPS case. I think a preference for specifying valid number characters is a very simple way to handle the 6502 case.
Default: lex.asm.numerals = "0123456789-."
The lexer would then parse "words" on whitespace and check that they only contain (in this example) numbers, hyphen (negative) and period (decimal points). If it matches, it's styled as a number. To support hex:
lex.asm.numerals = "0123456789abcdefxh-."
And for 6502, you just have to add $ to the hex example. This level of configurability I think is not too difficult to achieve. I have been thinking about such problems with the ASM lexer for many months, now. ;)
I wanted to use Scintilla for a project of my own, at one point. I'm now looking into getting similar functionality out of XULRunner; the Mozilla platform which Firefox is built on. (But that's another topic!) It's still possible to embed Scintilla into XULRunner (Komodo does this) so I'm still interested in discussing possibilities of improving Scintilla.
And further more, this discusion should move to the Scintilla list/bug tracker as this not directly Geany-specific but more an issue of the Scintilla ASM lexer.
I agree, here! I'll start an initial post on scintilla-interest for the ASM lexer. But I hope it gets more attention than the CSS thread! :P
Jay