Gedit汇编语法高亮设置

这两天一不小心玩上了ubuntu,查看汇编文件的时候才发现gedit没有汇编语法高亮,于是就有了本文。


原理:将配置好的汇编高亮xml文件(见附件)命名为asm.lang,然后移动该配置文件至gedit 环境中。

gedit 环境目录:/usr/share/gtksourceview-2.0/language-specs

打开gedit,依次选择查看->语法高亮模式->源代码->asm即可


asm.lang:




	
	\

	
		;
	

	
		^[0-9]*:{1}lt;/start-regex>
	

	
		/\*
        	\*/
	

	
		^[ \t]*#[ \t]*if[ \t]*0
        	[ \t]*#[ \t]*(endif|else)
	

	
		"
		"
	

	
		^#[ \t]*(include|pragma)
	         \n
	

	
		add
		adc
		adiw
		sub
		subi
		sbc
		sbci
		sbiw
		and
		andi
		or
		ori
		eor
		com
		neg
		sbr
		cbr
		inc
		dec
		tst
		clr
		ser
		mul
		muls
		mulsu
		fmul
		fmuls
		fmulsu
		rjmp
		ijmp
		eijmp
		jmp
		rcall
		icall
		eicall
		call
		ret
		reti
		cpse
		cp
		cpc
		cpi
		sbrc
		sbrs
		sbic
		sbis
		brbs
		brbc
		breq
		brne
		brcs
		brcc
		brsh
		brlo
		brmi
		brpl
		brge
		brlt
		brhs
		brhc
		brts
		brtc
		brvs
		brvc
		brie
		brid
		mov
		movw
		ldi
		lds
		ld
		ldd
		sts
		st
		std
		lpm
		elpm
		spm
		in
		out
		push
		pop
		lsl
		lsr
		rol
		ror
		asr
		swap
		bset
		bclr
		sbi
		cbi
		bst
		bld
		sec
		clc
		sen
		cln
		sez
		clz
		sei
		cli
		ses
		cls
		sev
		clv
		set
		clt
		seh
		clh
		break
		nop
		sleep
		wdr
	

	
		'
		'
	

	
		\b([1-9][0-9]*|0)([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b
	

	
		\b([0-9]+[Ee][-]?[0-9]+|([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-]?[0-9]+)?)[fFlL]?
	

	
		\b0[0-7]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b
	

	
		\b0[xX][0-9a-fA-F]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b
	

	
		abort
		align
		arch
		ascii
		asciz
		byte
		comm
		data
		desc
		dim
		eject
		else
		endef
		endif
		equ
		equiv
		err
		extern
		file
		fill
		float
		global
		hword
		ident
		if
		include
		int
		irp
		irpc
		lcomm
		lflags
		line
		linkonce
		ln
		list
		long
		macro
		mri
		nolist
		octa
		org
		p2align
		psize
		quad
		rept
		sbttl
		scl
		section
		set
		short
		single
		size
		skip
		space
		string
		tag
		text
		title
		type
		word
	

	
		if
		ifdef
		ifndef
		else
		elif
		define
		endif
		undef
		error
		pragma
		line
	


配置好后的汇编文件展示:



你可能感兴趣的:(工具相关)