#
#	Mode for PERL.  Tested with  StrongEd 4.12 (7 Sept  96)
#
# $Header: RCS.perl 1.4 96/10/01 21:07:40 root Exp $
#
# 	Written by Andrew Black  andrew@bach.demon.co.uk
#
#	You are welcome to make additions for your own purposes, and submit them
#	to me as possible enhancements.  But please  do no circulate to anyone else
#	except in this form.
#
#	Restrictions :
#	 - it makes no attempt understand regular expressions, or other
#	   contorted parts of PERL syntax
#	 - It gets confused by ' symbols inside " " strings
#	 - It only colours "if" when proceded by tab (dont understand that one
#	   - I will contact Guttorm)
#
##
#	


#HelpPath	C,

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

Search
	_Indent2	{" "} [ "#"  {" "} ]
	
	include1	( "require" | "use" ) _spct @0  {AD}+ @9 
	_perlsub 	"sub" _spct   @0 { AD | "_" }+ @9
	_pod		"=" @0 {AD}+ @9
	_sub_or_head	_perlsub | _pod
# click on any number of $, @ & % \ followed by alphnumeric
	_markword	{'$@&%\\'}  {AD | '_' }+
#	 | "=" )
End

ClickList
	include1	LoadOne ("<PerlPrivLib$Dir>.pm.<tmp$word>","<PerlPrivLib$Dir>.pl.<tmp$word>","<tmp$path>.pm.<tmp$word>")
	
End

#-------------------------------------------
# ID are not of great benefit - see the variable ones below
ID_FirstChar	A-Za-z_0-9$@% 
ID_Middle	A-Za-z_0-9

SyntaxOptions
	SingleQuote	Yes
# quotes are not treated - as we want to colour varaibles in " "
	DoubleQuote	No
	QuoteChar	\
	QuoteQuote	No
	SplitString	Yes
	HexPrefix	0x
End

SyntaxComment 1
	Type		Oneline
	StartWith	#
	EndWith		'''
End

SyntaxWords Group1 case Startspace
	do default
	continue
	for while break do return goto next last
       	if else elsif
	foreach
End

#variables 
SyntaxWords Group2 case EndOfId
     $ @ % 
End

SyntaxWords Group3 StartOfLine EndOfLine case
	sub package = @ISA @EXPORT
End
#subroutine calls
SyntaxWords Group4 case EndOfId
      &
End
SyntaxWords Group5 case EndOfId
      print write open close
End



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

KeyList

#  return automatically continues comments 
	Return		NewLine(indent,_Indent2)
	^Return		NewLine(noindent)
End

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

Functions

	Key	F2
	Menu	List of functions F2
	Icon	LoF
	Select	ListOfFound (_sub_or_head ,Text,Align,Line,Case)
	Help	Click to generate list of all functions.

	Key 	PgUp
	Icon	up
	Select	GotoPrev (_sub_or_head ,Text,Line,Case)
#	Help	Click to go to previous function

	Key 	PgDown
	Icon	down
	Select	GotoNext (_sub_or_head ,Text,Line,Case)
	Help	Click to go to next function

	Key	^H
	Menu	Load pl or pm file
	Icon	save
	Help	Click to load the .pm or .pl file under cursor.
	Select	SetTmp() LoadOne ("<PerlPrivLib$Dir>.pm.<tmp$word>","<PerlPrivLib$Dir>.pl.<tmp$word>")

	Key	F10
	Menu	Save & Compile      F10
	Icon	Run
	Select	SetTmp() SaveDClick ("<tmp$path>.<tmp$leaf>")
	Help	Click to save text and run.

	Adjust	SetTmp() SaveDrag ("perl")


#	Key	^G 1
#	Menu	Goto function definition
#	Icon	goto
#	Select	Push ListOfC (all,gotofound)
#	Help	Click to go to the definition of the function you're standing on.


End

Shortcuts
	''w	while (\@) \n\i{\n\i  \@\n\i}
	''f	for (\@;\@;\@) \n\i{\n\i  \@\n\i}

#	This inroduces an if statement, followed by a "pseudo-comment"
#	#els.   This may be followed by
#	  -     (deletes the  #els )
#	  e     for else
#	  if    for elsif 
	''i	if (\@) \n\i{\n\i  \@\n\i}\n\i#els\@
	#els-	 
	#elsif	elsif (\@) \n\i{\n\i  \@\n\i}\n\i#els\@
	#else	else\n\i{\n\i  \@\n\i}

#	iterate over key/value pairs of a hash
	''k	while ( ($key , $value ) = each (%\@) )\n\i{\n\i  \@\n\i}
	''p	print "\@\\n" ;
	''l     &print_line ( "\@") ;

	''s     #------------------------------------------------------------------------\nsub  \@ \n{\n    local ( \@ ) = @_  ;\n    \@\n}
	''or     open ( \@ , "\@" ) || die  "Cant open \@ file" ;
	''ow     open ( \@ , ">\@" ) || die  "Cant open \@ file" ;


End

#	Library routines are write protected by default.
WriteProtect
,**.!Perl.**
End

