#mode file for !Gawk application
#  New version - ListOfFound and GoToFound now allow use of keyword
#  'func' as well as 'function' when defining user functions

HelpPath	gawk,

ID_FirstChar	A-Za-z_$
ID_Middle	A-Za-z_0-9

SyntaxComment 1
	Type		OneLine
	StartWith	#
End

SyntaxOptions
	SingleQuote	No
	DoubleQuote	Yes
	QuoteQuote	Yes
	SplitString	No
	QuoteChar	\
#	HexPrefix	&
#	BinPrefix	%
End

# Suggested colour-scheme
# background	cream
# id		blue/cream
# Comm		grey5/grey1
# Punctuation	black/cream
# strings	khaki/cream
# numbers	cyan/cream
# fn()		green/cream
# reserved words:
# 1		red/cream
# 2		cyan/white
# 3		red/white
# 4		blue/white
# 5		khaki/white
# 6		black/white


SyntaxWords Group1 EndAlways StartSpace case
	BEGIN END func function
End

SyntaxWords Group2 EndNonID case
	FS NF ARGC ARGIND ARGV CONVFMT FIELDWIDTHS
	ENVIRON ERRNO FILENAME FNR IGNORECASE
	NR OFMT OFS ORS RS RT
	RSTART RLENGTH SUBSEP
End

SyntaxWords Group3 EndNonID case
	getline next nextfile print printf
End

SyntaxWords Group4 EndNonID case
	atan2 cos exp int log rand sin sqrt srand systime strftime
	close fflush system
End

SyntaxWords Group5 EndNonID case
	gensub gsub index length match split sprintf
	sub substr tolower toupper
End

SyntaxWords Group6 EndNonID case
	if else while do for break continue in
	delete exit return
End

Search
	_MarkWord	{AlphaNum|"_$"}+ | {Punct}+
	awkfunc		{" "}"func"{"tion"}" " @0 {AlphaNum|"_"}+
	awkfunc2	{" "}"func"{"tion"}" " CW "("
End

FoldParm1 (awkfunc,,StartOfLine,case)

Functions
	Key	F2
	Menu	List of functions F2
	Icon	LoF
	Select	ListOfFound(awkfunc,,,Line)
	Help	HCM_lof

	Key 	PgUp
	Icon	up
	Select	GotoPrev (awkfunc,Text,Line,Case)
	Help	HBa_up

	Key 	PgDown
	Icon	down
	Select	GotoNext (awkfunc,Text,Line,Case)
	Help	HBa_dn

	Key	F10
	Menu	Run F10
	Icon	Run
	Select	SetTmp() Process(text,"TaskWindow \"gawk -f \"\"<Wimp$ScrapDir>.out\"\" \"\"<Awk$Data>\"\"  \"-quit ",,noreplace)
	# I don't believe it!   It's HORRIBLE!!!  Double escaped double quotes!
	Help	Click to run awk program on current awk text|MAdjust-click to save program first

	Key	^F10
	Adjust	SaveText() SetTmp() Process(text,"TaskWindow \"gawk -f \"\"<Wimp$ScrapDir>.out\"\" \"\"<Awk$Data>\"\"  \"-quit ",,noreplace)

	Key	^G
	Menu	Goto label/DEF PROC/FN
	Icon	goto
	Select	Push GotoFound (awkfunc2,All,Whole,NoLine,Case)
	Help	HBa_go

	Key	^G 2
	Adjust	Pop
 

End

Shortcuts
	``B	BEGIN{ \@\n      }
	``E	END{ \@\n    }
	``f	function \@(\@)\n{\n \@\n}\n
End
