[英]Telling GAS to use semicolons for comments in Intel syntax mode
Can I use semicolons in GAS for comment characters?我可以在 GAS 中使用分号作为注释字符吗?
I am using GAS 2.30 with the Intel syntax as below.我正在使用 GAS 2.30 和 Intel 语法,如下所示。
.intel_syntax noprefix
.section .text
# Program entry point
.globl _start
_start:
# Put the code number for system call
mov eax, 1
# Return value
mov ebx, 0
# Kernel call
int 0x80
This works nicely except that I have to use '#' as a comment character instead of ';'.这很好用,只是我必须使用“#”作为注释字符而不是“;”。
The main reason why it matters is that the editor that I have (SublimeText 3.2.2, build 3211) only has syntax highligting for ARM or NASM assembly syntax, neither of which understands '#' for comments and as I am following materials that mainly use Intel syntax, this is something I would just like to keep consistent with what I am reading about.这很重要的主要原因是我拥有的编辑器(SublimeText 3.2.2,build 3211)只有 ARM 或 NASM 汇编语法的语法高亮,它们都不理解“#”的注释,因为我正在关注主要的材料使用英特尔语法,这是我想与我正在阅读的内容保持一致的东西。
I checked the Intel manuals, the 5000+ pages PDF document, and unless I missed it somehow, it says nothing about comments although an introductory page by Intel uses semicolons for comments.我查看了英特尔手册,5000 多页的 PDF 文档,除非我以某种方式错过了它,否则尽管英特尔的介绍页面使用分号进行评论,但它没有提及评论。
My question is if there is maybe a switch to let GAS use semicolons instead of pound signs in this context or is that perhaps one of the little differences to simply get used to?我的问题是,是否有可能让 GAS 在这种情况下使用分号而不是英镑符号,或者这可能是简单习惯的小区别之一?
I understand that GAS will also accept /, // and /* */ but none of these is understood by SublimeText.我知道 GAS 也会接受 /、// 和 /* */ 但 SublimeText 不理解这些。
Interestingly enough, telling SublimeText to use Bash syntax highlighting is quite a good solution as in the screenshot below but perhaps there is a way to configure GAS to use semicolons too?有趣的是,告诉 SublimeText 使用 Bash 语法突出显示是一个很好的解决方案,如下面的屏幕截图所示,但也许有一种方法可以配置 GAS 以使用分号? Thanks.
谢谢。
No, gas has no command-line switch or directive for this.不,gas 没有用于此的命令行开关或指令。 The comment characters are hardcoded .
注释字符是硬编码的。
However, it looks like it wouldn't be too hard to change them in the gas source and compile a custom version, if you really want that.但是,如果您真的想要的话,看起来在气体源中更改它们并编译自定义版本并不太难。 At a glance you would want to add
;
一目了然,您想添加
;
to i386_comment_chars
and line_comment_chars
, and remove it from line_separator_chars
.到
i386_comment_chars
和line_comment_chars
,并将其从line_separator_chars
删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.