# JOE syntax highlight file for ADA

# Define colors

=Idle
=Comment green
=Constant cyan
=Escape bold cyan
=Keyword bold
=Operator bold

:idle Idle
	*		idle
	"-"		maybe_comment
	"'"		char		recolor=-1
	"\""		string		recolor=-1
	"0-9"		first_digit	recolor=-1
	"."		maybe_float
	"\""		string		recolor=-1
	"Bb"		maybe_binary	buffer
	"Oo"		maybe_octal	buffer
	"Xx"		maybe_hex	buffer
	"ac-np-wyzAC-NP-WYZ"	ident	buffer

:maybe_comment Idle
	*		idle		noeat
	"-"		comment		recolor=-2

:comment Comment
	*		comment
	"\n"		idle


# Character constant

:char Idle
	*		char1

:char1 Idle
	*		idle
	"'"		char2		recolor=-3

:char2 Constant
	*		idle		noeat

# Strings

:maybe_binary Idle
	*		ident		noeat
	"\""		string		recolor=-2

:maybe_octal Idle
	*		ident		noeat
	"\""		string		recolor=-2

:maybe_hex Idle
	*		ident		noeat
	"\""		string		recolor=-2

:string	Constant
	*		string
	"\n"		idle
	"\""		idle
	"\\"		string_escape	recolor=-1

:string_escape Escape
	*		string
	"\n"		string		recolor=-2

# Integer constants

:first_digit Constant
	*		idle		noeat
	"."		float
	"_"		first_digit
	"0-9"		first_digit

# Floating point

:maybe_float Constant
	*		idle	recolor=-2	noeat
	"0-9"		float		recolor=-2

:float Constant
	*		idle	noeat
	"eE"		epart
	"0-9"		float

:epart	Constant
	*		idle	noeat
	"0-9+\-"	enum

:enum	Constant
	*		idle	noeat
	"0-9"		enum

# Identifiers

:ident	Idle
	*		quote		noeat istrings
	"abort"		kw
	"abs"		operator
	"abstract"	kw
	"accept"	kw
	"aliased"	kw
	"all"		kw
	"and"		operator
	"array"		kw
	"at"		kw
	"begin"		kw
	"body"		kw
	"case"		kw
	"constant"	kw
	"declare"	kw
	"delay"		kw
	"delta"		kw
	"digits"	kw
	"do"		kw
	"else"		kw
	"elsif"		kw
	"end"		kw
	"entry"		kw
	"exception"	kw
	"exit"		kw
	"for"		kw
	"function"	kw
	"generic"	kw
	"goto"		kw
	"if"		kw
	"in"		kw
	"interface"	kw
	"is"		kw
	"limited"	kw
	"loop"		kw
	"mod"		kw
	"new"		kw
	"not"		operator
	"null"		kw
	"of"		kw
	"or"		operator
	"others"	kw
	"out"		kw
	"overriding"	kw
	"package"	kw
	"pragma"	kw
	"private"	kw
	"procedure"	kw
	"protected"	kw
	"raise"		kw
	"range"		kw
	"record"	kw
	"rem"		operator
	"renames"	kw
	"requeue"	kw
	"return"	kw
	"reverse"	kw
	"select"	kw
	"separate"	kw
	"subtype"	kw
	"synchronized"	kw
	"tagged"	kw
	"task"		kw
	"terminate"	kw
	"then"		kw
	"type"		kw
	"until"		kw
	"use"		kw
	"when"		kw
	"while"		kw
	"with"		kw
	"xor"		operator
done
	"a-zA-Z0-9_"	ident

:operator Operator
	*	idle	noeat

:kw Keyword
	*	idle	noeat

# identifiers separated with quote '

:quote	Idle
	*	idle	noeat
	"'"	quote_word

:quote_word	Idle
	*	idle	noeat
	"a-zA-Z"	ident	buffer
