# Ada mode for StrongED
# Version 1.00
# Written by Peter Burwood
#
# I've only just started using StrongEd (I normally use Zap!) so the
# this mode file might not be the best way to do things in StrongEd.
# You'll need to set your own colour preferences since I can't see how to
# include this in this file rather than the global config file.
#
# Please send comments, improvements, complaints! and suggestions to
# gnat@arcangel.dircon.co.uk

# Regular expression for finding procedures and functions. I've included
# accept clauses because they can be considered similar to procedures.
Search
	Func		[_spct] ("accept"|"procedure"|"function" _spct @0 Alpha {Alphanum|"_"}) | ("function" _spct @0 '\"' {'=<>/*+-'|A} '\"')
	With_Use	[_spct] ("with"|"use") [_spct Alpha {Alphanum|"_"} [_spct] ','] _spct @0 Alpha {Alphanum|"_"}
End

# Allow clicking on a package name in a with or use clause. This will not work
# if the name is munged by GNAT. If StrongEd could run gnatk8 then this would
# work better.
ClickList
	With_Use	LoadOne ("<tmp$path>.^.ads.<tmp$word>")
End

#--------------------------------
ID_FirstChar	A-Za-z
ID_Middle	A-Za-z_0-9
#ID_LastChar	A-Za-z0-9

# StrongEd needs better number handling to work with based numbers.
SyntaxOptions
	SingleQuote	Yes
	DoubleQuote	Yes
	QuoteQuote	Yes
	SplitString	No
	HexPrefix	16#
	BinPrefix	2#
End

SyntaxComment
	Type		OneLine
	StartWith	--
End

# StrongEd 4 now has 8 syntax word categories so could add more or split
# those below further. The problem is then getting enough distinct and clearly
# visible colours.
# Keywords used in actual code + begin/end.
SyntaxWords Group1 nocase EndNonID
	abs all and begin case declare do else elsif end exception
	exit for goto if loop mod new not null or others raise rem return
	reverse then until when while xor
End

# Keywords associated with declarations, including some standard types.
SyntaxWords Group2 nocase EndNonID
	abstract access aliased array at body boolean character constant delta
	digits float function generic integer in is limited of out natural
	package positive private procedure protected range record renames
	separate subtype tagged task type use with
End

# Tasking keywords. I suggest red for these, since RISCOS GNAT doesn't
# support tasking at runtime.
SyntaxWords Group3 nocase EndNonID
	abort accept delay entry requeue select terminate
End

# All those wacky attributes.
SyntaxWords Group4 nocase EndNonID
	'access 'address 'adjacent 'aft 'alignment 'base 'bit_order
	'body_version 'callable 'caller 'ceiling 'class 'component_size
	'compose 'constrained 'copy_sign 'count 'definite 'delta 'denorm
	'digits 'exponent 'external_tag 'first 'first_bit 'floot 'fore
	'fraction 'identity 'image 'input 'last 'last_bit 'leading_part
	'length 'machine 'machine_emax 'machine_emin 'machine_mantissa
	'machine_overflows 'machine_radix 'machine_rounds 'max
	'max_size_in_storage_elements 'min 'model 'model_emin 'model_epsilon
	'model_mantissa 'model_small 'modulus 'output 'partition_id 'pos
	'position 'pred 'range 'read 'remainder 'round 'rounding 'safe_first
	'safe_last 'scale 'scaling 'signed_zeros 'size 'small 'storage_pool
	'storage_size 'succ 'tag 'terminated 'truncation 'unbiased_rounding
	'unchecked_access 'val 'valid 'value 'version 'wide_image 'wide_value
	'wide_width 'width 'write
End

#--------------------------------

Functions

# What does All and Line do in ListOfFound ?

	Key	F2
	Menu	List of functions F2
	Icon	LoF
	Select	ListOfFound (Func,All,Whole,Line,NoCase,Sort)
	Help	Click to generate list of all functions.

	Key 	PgUp
	Icon	up
	Select	GotoPrev (Func,All,Whole,NoLine,NoCase)
	Help	Click to go to previous function.

	Key 	PgDown
	Icon	down
	Select	GotoNext (Func,All,Whole,NoLine,NoCase)
	Help	Click to go to next function.

# Why does C use the save icon ? Okay, we'll do the same.
	Key	^H
	Menu	Load ads.*
	Icon	save
	Help	Click to load the specification of this file.
	Select	SetTmp() LoadOne ("<tmp$path>.^.ads.<tmp$leaf>")

	Key	^G 1
	Menu	Goto function definition
	Icon	goto
	Select	Push GotoFound (Func,All,Whole,Line,NoCase)
	Help	Click to go to the definition of the function you're standing on.

	Key	^G 2
	Select	Pop

End

# A start at some useful shortcuts.
# Can you have a space at the end of the shortcut ? If so, then I could use
# it instead of '\' (chosen so you don't need to press shift).
# It would be nice if StrongEd's templates were more powerful to allow
# more than one entry in a field and also display a tag for the item to be
# entered. e.g., something like
# p(	procedure <name> [(<formal> : in [out] <type> {; <formal> : in [out] <type>})] is\n\ibegin\n{\i   <statement>;\n}+\iend <name#1>;
# <> is for tags, [] optionals, {} 0 or more, {}+ 1 or more.
# <tag#n> means use the value from the n'th occurence of the tag
Shortcuts
	p(	procedure \@ (\@) is\n\ibegin\n\i   \@\n\iend \@;
	f(	function \@ (\@) return \@ is\n\ibegin\n\i   \@\n\iend \@;
	body\	package body \@ is\n\i   \@\n\ibegin\n\i   \@\n\iend \@;
	spec\	package \@ is\n\i   \@\n\ibegin\n\i   \@\n\iprivate\n\iend \@;
	case\	case \@ is\n\i   when \@ =>\n\i      \@\n\iend case;
	decl\	declare\n\i   \@\n\ibegin\n\i   \@\n\iend;
	for\	for \@ in \@ do\n\i   \@\n\iend loop;
	if\	if \@ then\n\i   \@\n\iend if;
	else\	else\n\i   \@
	elsif\	elsif\n\i   \@
	loop\	loop\n\i   \@\n\iend loop;
	while\	while \@ do\n\i   \@\n\iend loop;
End
