unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* At&t assembler syntax highlighting
@ 2008-11-19  6:46 Alexander
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander @ 2008-11-19  6:46 UTC (permalink / raw)
  To: help-gnu-emacs

Good day.
Unfortunately, standard emacs asm-mode does not understand syntax of 
at&t mode.
Does anybody have syntax highlight file for at&t assembler?

Thanks.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: At&t assembler syntax highlighting
       [not found] <mailman.726.1227077176.26697.help-gnu-emacs@gnu.org>
@ 2008-11-19  7:57 ` Xah
  2008-11-19 10:08   ` rustom
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Xah @ 2008-11-19  7:57 UTC (permalink / raw)
  To: help-gnu-emacs

On Nov 18, 10:46 pm, Alexander <coo...@gmail.com> wrote:
> Good day.
> Unfortunately, standard emacs asm-mode does not understand syntax of
> at&t mode.
> Does anybody have syntax highlight file for at&t assembler?

don't know.

but if you produce a list of function names, type names, keyword
names, etc, i can produce the mode for you.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: At&t assembler syntax highlighting
  2008-11-19  7:57 ` Xah
@ 2008-11-19 10:08   ` rustom
  2008-11-20  6:07     ` Alexander
  2008-11-20  6:13   ` Alexander
       [not found]   ` <mailman.808.1227161618.26697.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 8+ messages in thread
From: rustom @ 2008-11-19 10:08 UTC (permalink / raw)
  To: help-gnu-emacs

On Nov 19, 12:57 pm, Xah <xah...@gmail.com> wrote:
> On Nov 18, 10:46 pm, Alexander <coo...@gmail.com> wrote:
>
> > Good day.
> > Unfortunately, standard emacs asm-mode does not understand syntax of
> > at&t mode.
> > Does anybody have syntax highlight file for at&t assembler?
> ☄
I had different (and more serious) problems with the builtin assembler
mode.  See

http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/bde0ea73a7e9b7ac?q=comment+assembly+gnu.emacs.help+rustom


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: At&t assembler syntax highlighting
@ 2008-11-19 12:49 martin rudalics
  0 siblings, 0 replies; 8+ messages in thread
From: martin rudalics @ 2008-11-19 12:49 UTC (permalink / raw)
  To: rustompmody; +Cc: help-gnu-emacs

 > I had different (and more serious) problems with the builtin assembler
 > mode.

But you never told us whether `gas-mode' DTRT for you.  Otherwise, we
might have been able to convince Emacs maintainers to distribute it ;-)

martin





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: At&t assembler syntax highlighting
       [not found] <mailman.739.1227099258.26697.help-gnu-emacs@gnu.org>
@ 2008-11-19 13:08 ` rustom
  0 siblings, 0 replies; 8+ messages in thread
From: rustom @ 2008-11-19 13:08 UTC (permalink / raw)
  To: help-gnu-emacs

On Nov 19, 5:49 pm, martin rudalics <rudal...@gmx.at> wrote:
>  > I had different (and more serious) problems with the builtin assembler
>  > mode.
>
> But you never told us whether `gas-mode' DTRT for you.  Otherwise, we
> might have been able to convince Emacs maintainers to distribute it ;-)
>
> martin

Yeah... Sorry :-)
I needed to try out gas for a couple of days. By the time I asked and
got this data from you I was done.
If/when I get back to gas and find it useful, I'll report here.

For now I'll only say here that automatically inserting a non-comment
character as a comment character is a very misleading action -- a bug.

I dont know too much about too many systems but I would have guessed
that
-- .s means gas
-- .asm means intel


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: At&t assembler syntax highlighting
  2008-11-19 10:08   ` rustom
@ 2008-11-20  6:07     ` Alexander
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander @ 2008-11-20  6:07 UTC (permalink / raw)
  Cc: help-gnu-emacs

rustom пишет:
> On Nov 19, 12:57 pm, Xah<xah...@gmail.com>  wrote:
>    
>> On Nov 18, 10:46 pm, Alexander<coo...@gmail.com>  wrote:
>>
>>      
>>> Good day.
>>> Unfortunately, standard emacs asm-mode does not understand syntax of
>>> at&t mode.
>>> Does anybody have syntax highlight file for at&t assembler?
>>>        
>> ☄
>>      
> I had different (and more serious) problems with the builtin assembler
> mode.  See
>
> http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/bde0ea73a7e9b7ac?q=comment+assembly+gnu.emacs.help+rustom
>    

I've tried gas-mode,
but it does not work at all for me, it highlights only labels, but not 
highlit commands an operands.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: At&t assembler syntax highlighting
  2008-11-19  7:57 ` Xah
  2008-11-19 10:08   ` rustom
@ 2008-11-20  6:13   ` Alexander
       [not found]   ` <mailman.808.1227161618.26697.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Alexander @ 2008-11-20  6:13 UTC (permalink / raw)
  To: help-gnu-emacs

Xah пишет:
> On Nov 18, 10:46 pm, Alexander<coo...@gmail.com>  wrote:
>    
>
> don't know.
>
> but if you produce a list of function names, type names, keyword
> names, etc, i can produce the mode for you.
>
>    Xah
> ∑ http://xahlee.org/
It will be good.

asm-mode quite pretty highlights source code, but it is not able to add comments for at&t assembler.
comments for at&t assembler are added in following way:
# this is a comment
/* this is a comment */
but in current asm-mode, comments added with ";;".


Could give me some examples, how to change comments format for this mode?
Thanks.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: At&t assembler syntax highlighting
       [not found]   ` <mailman.808.1227161618.26697.help-gnu-emacs@gnu.org>
@ 2008-11-21  6:23     ` Xah
  0 siblings, 0 replies; 8+ messages in thread
From: Xah @ 2008-11-21  6:23 UTC (permalink / raw)
  To: help-gnu-emacs

On Nov 19, 10:13 pm, Alexander <coo...@gmail.com> wrote:
> Xahпишет:> On Nov 18, 10:46 pm, Alexander<coo...@gmail.com>  wrote:
>
> > don't know.
>
> > but if you produce a list of function names, type names, keyword
> > names, etc, i can produce the mode for you.
>
> >    Xah
> > ∑http://xahlee.org/
>
> It will be good.
>
> asm-mode quite pretty highlights source code, but it is not able to add comments for at&t assembler.
> comments for at&t assembler are added in following way:
> # this is a comment
> /* this is a comment */
> but in current asm-mode, comments added with ";;".
>
> Could give me some examples, how to change comments format for this mode?
> Thanks.

you'll have to do several things:

• modify the syntax table of that mode, using a hook.
• possibly modify the the keymap in that mode, using a hook, so that
the shortcut for comment-dwim do comment.

the mode is probably not very well written since it gets the comment
wrong. So the best thing is to either contact the author to have him
fix these, or just modify the mode' source code yourself and become
the maintainer/fork yourself.

Here's a example how to modify the syntax table using a hook, so that
the char “-” in elisp mode is considered part of word, so that cursor
movement will move a whole something-something instead of stopping at
“_”.

(add-hook 'emacs-lisp-mode-hook
 (lambda ()
  (modify-syntax-entry ?- "w" emacs-lisp-mode-syntax-table )
 )
)

the essense of using a hook to modify a mode's syntax table, is that
you need to find the hook name and syntax table name. If the mode name
is xyz-mode, its hook name is usually xyz-mode-hook and xyz-mode-
syntax-table.

To find out the mode's mode name, do Ctrl+h v then type major-mode.

Here's a example of modifying the source code on the syntax table
itself:

(defvar xlsl-mode-syntax-table
  (let ((synTable (make-syntax-table)))
    (modify-syntax-entry ?\/ ". 12b" synTable)
    (modify-syntax-entry ?\n "> b" synTable)
    synTable
    )
  "Syntax table for `xlsl-mode'."
)

in this case, the lsl lang's comment is

// this is comment
/* this is NOT comment */

the emacs's syntax table concept and code is rather esoteric... i'm
thinking it's that useful, or rather not powerful and flexible enough.

in your case, you probably want

    (modify-syntax-entry ?# ". 12b" synTable)
    (modify-syntax-entry ?\n "> b" synTable)

to cover the
# comment

 i haven't wrote a mode that deal with comment like:
/* comment here */

but basically 2 lines like the above will do. See

• Syntax Class Table - GNU Emacs Lisp Reference Manual
http://xahlee.org/elisp/Syntax-Class-Table.html

• Syntax Flags - GNU Emacs Lisp Reference Manual
http://xahlee.org/elisp/Syntax-Flags.html

the latter has some comments on how to do the “/* comment */”.

------------------------

maybe later today i'll write a full tutorial on how do deal with the 2
types of comments, one starts with a line and ends in a EOL, and the
other using matching pairs.


look at java mode's source code, since that lang uses the same as your
case.

--------------

if you find the above too hard, you can just resort to

C-x r k runs the command kill-rectangle
C-x r t runs the command string-rectangle

for the first 5 years of using emacs, i just used these for comments,
in any lang.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-11-21  6:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.739.1227099258.26697.help-gnu-emacs@gnu.org>
2008-11-19 13:08 ` At&t assembler syntax highlighting rustom
2008-11-19 12:49 martin rudalics
     [not found] <mailman.726.1227077176.26697.help-gnu-emacs@gnu.org>
2008-11-19  7:57 ` Xah
2008-11-19 10:08   ` rustom
2008-11-20  6:07     ` Alexander
2008-11-20  6:13   ` Alexander
     [not found]   ` <mailman.808.1227161618.26697.help-gnu-emacs@gnu.org>
2008-11-21  6:23     ` Xah
  -- strict thread matches above, loose matches on Subject: below --
2008-11-19  6:46 Alexander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).